Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotFound = makeErrorResponder(404) BadRequest = makeErrorResponder(400) MethodNotAllowed = makeErrorResponder(405) InternalError = makeErrorResponder(500) NotImplemented = makeErrorResponder(501) Forbidden = makeErrorResponder(403) Conflict = makeErrorResponder(409) )
standard error responses
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Path string GET ResponseFunc PUT ResponseFunc POST ResponseFunc DELETE ResponseFunc // contains filtered or unexported fields }
A Command routes a request to an individual per-verb ResponseFunc
type Response ¶
type Response interface {
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
Response knows how to serve itself, and how to find itself
func AsyncResponse ¶
AsyncResponse builds an "async" response from the given *Task
func SyncResponse ¶
func SyncResponse(result interface{}) Response
SyncResponse builds a "sync" response from the given result.
type ResponseFunc ¶
A ResponseFunc handles one of the individual verbs for a method
type ResponseType ¶
type ResponseType string
ResponseType is the response type
const ( ResponseTypeSync ResponseType = "sync" ResponseTypeAsync ResponseType = "async" ResponseTypeError ResponseType = "error" )
"there are three standard return types: Standard return value, Background operation, Error", each returning a JSON object with the following "type" field:
type SessionAgent ¶
type SessionAgent struct { Version string // contains filtered or unexported fields }
func New ¶
func New() (*SessionAgent, error)
func (*SessionAgent) Dying ¶
func (s *SessionAgent) Dying() <-chan struct{}
func (*SessionAgent) Init ¶
func (s *SessionAgent) Init() error
func (*SessionAgent) Start ¶
func (s *SessionAgent) Start()
func (*SessionAgent) Stop ¶
func (s *SessionAgent) Stop() error
Stop performs a graceful shutdown of the session agent and waits up to 5 seconds for it to complete.
Click to show internal directories.
Click to hide internal directories.