controlcommands

package
v0.13.93 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: GPL-3.0 Imports: 9 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 = 1024

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     uuid.Array
	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 {
	GetName() string
	GetId() uuid.Array
	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              uuid.Array           `json:"id"`
	ResponseTimeout time.Duration        `json:"timeout"`
	Arguments       PropertyMap          `json:"arguments"`
	TargetList      []MesosCommandTarget `json:"targetList"`
	// contains filtered or unexported fields
}

func NewMesosCommand

func NewMesosCommand(name string, receivers []MesosCommandTarget, argMap PropertyMapsMap) *MesosCommandBase

func (*MesosCommandBase) GetId

func (m *MesosCommandBase) GetId() uuid.Array

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) GetResponses

func (*MesosCommandMultiResponse) IsMultiResponse

func (m *MesosCommandMultiResponse) IsMultiResponse() bool

type MesosCommandResponse

type MesosCommandResponse interface {
	GetCommandName() string
	GetCommandId() uuid.Array
	IsMultiResponse() bool
	Err() error
}

type MesosCommandResponseBase

type MesosCommandResponseBase struct {
	CommandName string     `json:"name"`
	CommandId   uuid.Array `json:"id"`
	ErrorString string     `json:"error"`
	MessageType string     `json:"_messageType"`
}

func NewMesosCommandResponse

func NewMesosCommandResponse(mesosCommand MesosCommand, err error) *MesosCommandResponseBase

func (*MesosCommandResponseBase) Err

func (*MesosCommandResponseBase) GetCommandId

func (m *MesosCommandResponseBase) GetCommandId() uuid.Array

func (*MesosCommandResponseBase) GetCommandName

func (m *MesosCommandResponseBase) GetCommandName() string

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 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(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 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