Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrTaskNotFound used when a task is not found for a specific node
Functions ¶
This section is empty.
Types ¶
type OnDemandServer ¶
type OnDemandServer struct {
common.RWMutex
graph.DefaultGraphListener
ws.DefaultSpeakerEventHandler
Graph *graph.Graph
// contains filtered or unexported fields
}
OnDemandServer describes an ondemand task server based on websocket
func NewOnDemandServer ¶
func NewOnDemandServer(g *graph.Graph, pool *ws.StructClientPool, handler OnDemandServerHandler) (*OnDemandServer, error)
NewOnDemandServer creates a new Ondemand tasks server based on graph and websocket
func (*OnDemandServer) OnNodeDeleted ¶
func (o *OnDemandServer) OnNodeDeleted(n *graph.Node)
OnNodeDeleted graph event
func (*OnDemandServer) OnStructMessage ¶
func (o *OnDemandServer) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)
OnStructMessage websocket message, valid message type are Start, Stop
type OnDemandServerHandler ¶
type OnDemandServerHandler interface {
ResourceName() string
DecodeMessage(msg json.RawMessage) (types.Resource, error)
CreateTask(*graph.Node, types.Resource) (interface{}, error)
RemoveTask(*graph.Node, types.Resource, interface{}) error
}
OnDemandServerHandler is the interface to be implemented by ondemand servers
Source Files
¶
- server.go
Click to show internal directories.
Click to hide internal directories.