server

package
v0.0.0-...-b4bb62b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTaskNotFound = errors.New("task not found")

ErrTaskNotFound used when a task is not found for a specific node

Functions

This section is empty.

Types

type OnDemandServer

type OnDemandServer struct {
	insanelock.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

func (*OnDemandServer) Start

func (o *OnDemandServer) Start() error

Start the task

func (*OnDemandServer) Stop

func (o *OnDemandServer) Stop()

Stop the task

type OnDemandServerHandler

type OnDemandServerHandler interface {
	ResourceName() string
	DecodeMessage(msg json.RawMessage) (rest.Resource, error)
	CreateTask(*graph.Node, rest.Resource) (interface{}, error)
	RemoveTask(*graph.Node, rest.Resource, interface{}) error
}

OnDemandServerHandler is the interface to be implemented by ondemand servers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL