client

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnDemandClient

type OnDemandClient struct {
	insanelock.RWMutex
	etcd.MasterElection
	graph.DefaultGraphListener
	// contains filtered or unexported fields
}

OnDemandClient describes an ondemand task client based on a websocket

func NewOnDemandClient

func NewOnDemandClient(g *graph.Graph, ch rest.WatchableHandler, agentPool ws.StructSpeakerPool, subscriberPool ws.StructSpeakerPool, etcdClient *etcd.Client, handler OnDemandClientHandler) *OnDemandClient

NewOnDemandClient creates a new ondemand task client based on API, graph and websocket

func (*OnDemandClient) OnEdgeAdded

func (o *OnDemandClient) OnEdgeAdded(e *graph.Edge)

OnEdgeAdded graph event

func (*OnDemandClient) OnNodeAdded

func (o *OnDemandClient) OnNodeAdded(n *graph.Node)

OnNodeAdded graph event

func (*OnDemandClient) OnNodeDeleted

func (o *OnDemandClient) OnNodeDeleted(n *graph.Node)

OnNodeDeleted graph event

func (*OnDemandClient) OnNodeUpdated

func (o *OnDemandClient) OnNodeUpdated(n *graph.Node, ops []graph.PartiallyUpdatedOp)

OnNodeUpdated graph event

func (*OnDemandClient) OnStartAsMaster

func (o *OnDemandClient) OnStartAsMaster()

OnStartAsMaster event

func (*OnDemandClient) OnStartAsSlave

func (o *OnDemandClient) OnStartAsSlave()

OnStartAsSlave event

func (*OnDemandClient) OnStructMessage

func (o *OnDemandClient) OnStructMessage(c ws.Speaker, m *ws.StructMessage)

OnStructMessage event, valid message type: StartReply or StopReply message

func (*OnDemandClient) OnSwitchToMaster

func (o *OnDemandClient) OnSwitchToMaster()

OnSwitchToMaster event

func (*OnDemandClient) OnSwitchToSlave

func (o *OnDemandClient) OnSwitchToSlave()

OnSwitchToSlave event

func (*OnDemandClient) Start

func (o *OnDemandClient) Start()

Start the task

func (*OnDemandClient) Stop

func (o *OnDemandClient) Stop()

Stop the task

type OnDemandClientHandler

type OnDemandClientHandler interface {
	ResourceName() string
	GetNodeResources(resource rest.Resource) []OnDemandNodeResource
	CheckState(n *graph.Node, resource rest.Resource) bool
	DecodeMessage(msg json.RawMessage) (rest.Resource, error)
	EncodeMessage(nodeID graph.Identifier, resource rest.Resource) (json.RawMessage, error)
}

OnDemandClientHandler is the interface to be implemented by ondemand clients

type OnDemandNodeResource

type OnDemandNodeResource struct {
	Node     *graph.Node
	Resource rest.Resource
}

OnDemandNodeResource describes an association between a graph node and its corresponding on-demand resource

Jump to

Keyboard shortcuts

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