Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrActionNotFound is returned when an action cannot be dispatched. ErrActionNotFound = errors.New("Action not found") // ErrMissingRequiredParameter is for when required parameters are missing. ErrMissingRequiredParameter = errors.New("Required parameters missing") // ErrInvalidParameter is for when parameters are supplied that are not allowed. ErrInvalidParameter = errors.New("Invalid parameters") )
Functions ¶
func TypeString ¶
func TypeString() interface{}
TypeString is a callback that returns a *string for marshalling.
func TypeUint64 ¶
func TypeUint64() interface{}
TypeUint64 is a callback that returns a *uint64 for marshalling.
Types ¶
type Action ¶
type Action struct { RequiredParameters ParameterTable OptionalParameters ParameterTable Dispatch Func }
Action is the definition of the protocol action item.
type Command ¶
type Command struct { UUID string Resource string Action string Parameters map[string]json.RawMessage `json:"-"` Dependencies []string // contains filtered or unexported fields }
Command is a unit of instruction; it contains a UUID, the unique identifier of the command, a Resource, the type of command to execute, an action, the name of the command to execute, and parameters, a collection of items that relate to the action for the purposes of execution.
Commands are typically fed to Packages, then the Package is Enqueued, Next() calls are made to yield the commands for the resource, the command is processed, FinishCommand is called to finish the command, then statuses are polled and eventually yielded.
type Func ¶
Func is the dispatch action function. It accepts a command and the status is published back to the broker automatically as a part of the Tick() and Loop() calls.
type ParameterTable ¶
type ParameterTable map[string]func() interface{}
ParameterTable is a map of parameter name -> type creation function. The type creation function is expected to return a type that is compatible with the JSON marshalling of the API. You must return a pointer from this call or encoding/json will vomit.