controlcommands

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package controlcommands defines the Command interface, plus several types including MesosCommand, MesosCommandResponse and related. It contains what's needed to represent the serializable requests and responses that are then transferred over the Mesos transport.

Index

Constants

View Source
const QUEUE_SIZE = 16384 // upper limit of command queue size

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Request  MesosCommand
	Response MesosCommandResponse
	Done     chan empty
	Error    error
}

Call represents an active request, pending response

func NewCall

func NewCall(cmd MesosCommand) *Call

type CallId

type CallId struct {
	Id     xid.ID
	Target MesosCommandTarget
}

type Command

type Command interface {
	Name() string
	Args() map[string]interface{}
	IsMultiCmd() bool
	IsMutator() bool
}

type CommandQueue

type CommandQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCommandQueue

func NewCommandQueue(s *Servent) *CommandQueue

func (*CommandQueue) Enqueue

func (m *CommandQueue) Enqueue(cmd MesosCommand, callback chan<- MesosCommandResponse) error

func (*CommandQueue) Start

func (m *CommandQueue) Start()

func (*CommandQueue) Stop

func (m *CommandQueue) Stop()

type MesosCommand

type MesosCommand interface {
	common.Labeler
	GetName() string
	GetId() xid.ID
	GetEnvironmentId() uid.ID
	IsMultiCmd() bool
	MakeSingleTarget(target MesosCommandTarget) MesosCommand
	IsMutator() bool
	GetResponseTimeout() time.Duration
	// contains filtered or unexported methods
}

type MesosCommandBase

type MesosCommandBase struct {
	Name            string               `json:"name"`
	Id              xid.ID               `json:"id"`
	EnvironmentId   uid.ID               `json:"environmentId"`
	ResponseTimeout time.Duration        `json:"timeout"`
	Arguments       PropertyMap          `json:"arguments"`
	TargetList      []MesosCommandTarget `json:"targetList"`
	Labels          map[string]string    `json:"labels"`
	// contains filtered or unexported fields
}

func NewMesosCommand

func NewMesosCommand(name string, envId uid.ID, receivers []MesosCommandTarget, argMap PropertyMapsMap) *MesosCommandBase

func (*MesosCommandBase) GetEnvironmentId added in v0.48.0

func (m *MesosCommandBase) GetEnvironmentId() uid.ID

func (*MesosCommandBase) GetId

func (m *MesosCommandBase) GetId() xid.ID

func (*MesosCommandBase) GetLabels added in v0.49.0

func (m *MesosCommandBase) GetLabels() map[string]string

func (*MesosCommandBase) GetName

func (m *MesosCommandBase) GetName() string

func (*MesosCommandBase) GetResponseTimeout

func (m *MesosCommandBase) GetResponseTimeout() time.Duration

func (*MesosCommandBase) IsMultiCmd

func (m *MesosCommandBase) IsMultiCmd() bool

func (*MesosCommandBase) IsMutator

func (m *MesosCommandBase) IsMutator() bool

func (*MesosCommandBase) MakeSingleTarget

func (m *MesosCommandBase) MakeSingleTarget(receiver MesosCommandTarget) (cmd MesosCommand)

type MesosCommandMultiResponse

type MesosCommandMultiResponse struct {
	MesosCommandResponseBase
	// contains filtered or unexported fields
}

func (*MesosCommandMultiResponse) Err

func (*MesosCommandMultiResponse) Errors added in v0.26.80

func (*MesosCommandMultiResponse) GetResponseSenders added in v0.26.80

func (m *MesosCommandMultiResponse) GetResponseSenders() []MesosCommandTarget

func (*MesosCommandMultiResponse) GetResponses

func (*MesosCommandMultiResponse) IsMultiResponse

func (m *MesosCommandMultiResponse) IsMultiResponse() bool

type MesosCommandResponse

type MesosCommandResponse interface {
	GetCommandName() string
	GetCommandId() xid.ID
	GetEnvironmentId() uid.ID
	GetResponseSenders() []MesosCommandTarget
	IsMultiResponse() bool
	Err() error
	Errors() map[MesosCommandTarget]error
}

type MesosCommandResponseBase

type MesosCommandResponseBase struct {
	CommandName     string               `json:"name"`
	CommandId       xid.ID               `json:"id"`
	EnvironmentId   uid.ID               `json:"environmentId"`
	ErrorString     string               `json:"error"`
	MessageType     string               `json:"_messageType"`
	ResponseSenders []MesosCommandTarget `json:"-"`
}

func NewMesosCommandResponse

func NewMesosCommandResponse(mesosCommand MesosCommand, err error) *MesosCommandResponseBase

func (*MesosCommandResponseBase) Err

func (*MesosCommandResponseBase) Errors added in v0.26.80

dummy implementation for single-origin responses which defaults to Err()

func (*MesosCommandResponseBase) GetCommandId

func (m *MesosCommandResponseBase) GetCommandId() xid.ID

func (*MesosCommandResponseBase) GetCommandName

func (m *MesosCommandResponseBase) GetCommandName() string

func (*MesosCommandResponseBase) GetEnvironmentId added in v0.48.0

func (m *MesosCommandResponseBase) GetEnvironmentId() uid.ID

func (*MesosCommandResponseBase) GetResponseSenders added in v0.26.80

func (m *MesosCommandResponseBase) GetResponseSenders() []MesosCommandTarget

func (*MesosCommandResponseBase) IsMultiResponse

func (m *MesosCommandResponseBase) IsMultiResponse() bool

type MesosCommandResponse_Transition

type MesosCommandResponse_Transition struct {
	MesosCommandResponseBase

	CurrentState string `json:"state"`
	TaskId       string `json:"taskId"`
}

func NewMesosCommandResponse_Transition

func NewMesosCommandResponse_Transition(mesosCommand *MesosCommand_Transition, err error, currentState string, taskId string) *MesosCommandResponse_Transition

type MesosCommandResponse_TriggerHook added in v0.16.0

type MesosCommandResponse_TriggerHook struct {
	MesosCommandResponseBase
	TaskId string `json:"taskId"`
}

func NewMesosCommandResponse_TriggerHook added in v0.16.0

func NewMesosCommandResponse_TriggerHook(mesosCommand *MesosCommand_TriggerHook, err error, taskId string) *MesosCommandResponse_TriggerHook

type MesosCommandTarget

type MesosCommandTarget struct {
	AgentId    mesos.AgentID
	ExecutorId mesos.ExecutorID
	TaskId     mesos.TaskID
}

type MesosCommand_Transition

type MesosCommand_Transition struct {
	MesosCommandBase

	Source      string `json:"source"`
	Event       string `json:"event"`
	Destination string `json:"destination"`
}

func NewMesosCommand_Transition

func NewMesosCommand_Transition(envId uid.ID, receivers []MesosCommandTarget, source string, event string, destination string, arguments PropertyMapsMap) *MesosCommand_Transition

func (*MesosCommand_Transition) MakeSingleTarget

func (m *MesosCommand_Transition) MakeSingleTarget(target MesosCommandTarget) (cmd MesosCommand)

type MesosCommand_TriggerHook added in v0.16.0

type MesosCommand_TriggerHook struct {
	MesosCommandBase
}

func NewMesosCommand_TriggerHook added in v0.16.0

func NewMesosCommand_TriggerHook(envId uid.ID, receivers []MesosCommandTarget) *MesosCommand_TriggerHook

func (*MesosCommand_TriggerHook) MakeSingleTarget added in v0.16.0

func (m *MesosCommand_TriggerHook) MakeSingleTarget(target MesosCommandTarget) (cmd MesosCommand)

type PropertyMap

type PropertyMap map[string]string

type PropertyMapsMap

type PropertyMapsMap map[MesosCommandTarget]PropertyMap

type SendCommandFunc

type SendCommandFunc func(command MesosCommand, receiver MesosCommandTarget) error

type Servent

type Servent struct {
	SendFunc SendCommandFunc
	// contains filtered or unexported fields
}

func NewServent

func NewServent(commandFunc SendCommandFunc) *Servent

func (*Servent) ProcessResponse

func (s *Servent) ProcessResponse(res MesosCommandResponse, sender MesosCommandTarget)

func (*Servent) RunCommand

func (s *Servent) RunCommand(cmd MesosCommand, receiver MesosCommandTarget) (MesosCommandResponse, error)

Jump to

Keyboard shortcuts

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