Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ClientStates contains all the states for the Client machine. ClientStates = ssC // ClientGroups contains all the state groups for the Client machine. ClientGroups = sgC )
var ( // WorkerStates contains all the states for the Worker machine. WorkerStates = ssW // WorkerGroups contains all the state groups for the Worker machine. WorkerGroups = sgW )
var ( // SupervisorStates contains all the states for the Supervisor machine. SupervisorStates = ssS // SupervisorGroups contains all the state groups for the Supervisor machine. SupervisorGroups = sgS )
var (
// BootstrapStates contains all the states for the Bootstrap machine.
BootstrapStates = cos
)
var BootstrapStruct = StructMerge( ssrpc.WorkerStruct, am.Struct{ cos.WorkerAddr: {}, })
BootstrapStruct represents all relations and properties of BootstrapStatesDef.
var ClientStruct = StructMerge( states.BasicStruct, ssrpc.ConsumerStruct, am.Struct{ ssC.ErrWorker: {Require: S{Exception}}, ssC.ErrSupervisor: {Require: S{Exception}}, ssC.SuperDisconnected: {}, ssC.SuperConnecting: {}, ssC.SuperConnected: {}, ssC.SuperDisconnecting: {}, ssC.SuperReady: {}, ssC.WorkerDisconnected: {}, ssC.WorkerConnecting: {}, ssC.WorkerConnected: {}, ssC.WorkerDisconnecting: {}, ssC.WorkerReady: {Remove: S{ssC.WorkerRequested}}, ssC.WorkerRequested: {Require: S{ssC.SuperReady}}, ssC.Ready: { Auto: true, Require: S{ssC.WorkerReady}, }, })
ClientStruct represents all relations and properties of ClientStates.
var Exception = am.Exception
Exception is a type alias for the exception state.
var SAdd = am.SAdd
SAdd is a func alias for merging lists of states.
var StateAdd = am.StateAdd
StateAdd is a func alias for adding to an existing state definition.
var StateSet = am.StateSet
StateSet is a func alias for replacing parts of an existing state definition.
var StructMerge = am.StructMerge
StructMerge is a func alias for extending an existing state structure.
var SupervisorStruct = StructMerge( ssrpc.WorkerStruct, am.Struct{ ssS.ErrWorker: { Require: S{ssS.Exception}, Add: S{ssS.NormalizingPool, ssS.Heartbeat}, }, ssS.ErrPool: { Require: S{ssS.Exception}, Remove: S{ssS.PoolNormalized}, Add: S{ssS.NormalizingPool}, }, ssS.ClientConnected: {Multi: true}, ssS.ClientDisconnected: {Multi: true}, ssS.SuperConnected: {Multi: true}, ssS.SuperDisconnected: {Multi: true}, ssS.LocalRpcReady: {Require: S{ssS.Start}}, ssS.PublicRpcReady: {Require: S{ssS.Start}}, ssS.WorkerReady: { Multi: true, Require: S{ssS.Start}, Add: S{ssS.PoolReady}, }, ssS.WorkerGone: { Multi: true, Require: S{ssS.Start}, Remove: S{ssS.PoolReady}, }, ssS.Start: {Add: S{ssS.PoolStarting}}, ssS.Ready: {Require: S{ ssS.LocalRpcReady, ssS.PublicRpcReady, ssS.PoolReady}}, ssS.Heartbeat: {Require: S{ssS.Start}}, ssW.SendPayload: {Add: S{ssW.ErrSendPayload, ssW.Exception}}, ssS.PoolStarting: { Remove: sgS.PoolStatus, Add: S{ssS.NormalizingPool}, }, ssS.PoolReady: { Require: S{ssS.Start}, Remove: sgS.PoolStatus, Add: S{ssS.Heartbeat}, }, ssS.NormalizingPool: { Require: S{ssS.Start}, Remove: sgS.PoolNormalized, After: S{ssS.ErrWorker}, }, ssS.PoolNormalized: { Require: S{ssS.Start}, Remove: sgS.PoolNormalized, Add: S{ssS.Heartbeat}, }, ssS.WorkersAvailable: {Require: S{ssS.PoolReady}}, ssS.ForkWorker: { Multi: true, Require: S{ssS.Start}, }, ssS.ForkingWorker: { Multi: true, Require: S{ssS.Start}, }, ssS.WorkerConnected: { Multi: true, Require: S{ssS.Start}, }, ssS.WorkerForked: { Multi: true, Require: S{ssS.Start}, Add: S{ssS.Heartbeat}, }, ssS.KillWorker: {Multi: true}, ssS.KillingWorker: {Multi: true}, ssS.WorkerKilled: { Multi: true, Add: S{ssS.NormalizingPool, ssS.Heartbeat}, }, ssS.ProvideWorker: { Multi: true, Require: S{ssS.WorkersAvailable}, }, ssS.WorkerIssues: { Multi: true, }, ssS.ClientSendPayload: {Multi: true}, ssS.SuperSendPayload: {Multi: true}, })
SupervisorStruct represents all relations and properties of SupervisorStates.
var WorkerStruct = StructMerge( ssrpc.WorkerStruct, am.Struct{ ssW.ErrWork: {Require: S{Exception}}, ssW.ErrWorkTimeout: {Require: S{Exception}}, ssW.ErrClient: {Require: S{Exception}}, ssW.ErrSupervisor: {Require: S{Exception}}, ssW.LocalRpcReady: {Require: S{ssW.Start}}, ssW.PublicRpcReady: {Require: S{ssW.Start}}, ssW.SuperConnected: {Require: S{ssW.Start}}, ssW.ClientConnected: {Require: S{ssW.Start}}, ssW.Ready: {Require: S{ssW.LocalRpcReady}}, ssW.RpcReady: { Auto: true, Require: S{ssW.LocalRpcReady, ssW.PublicRpcReady}, }, ssW.ServeClient: {Require: S{ssW.PublicRpcReady}}, ssW.ClientSendPayload: { Require: S{ssW.PublicRpcReady}, }, ssW.SuperSendPayload: { Require: S{ssW.LocalRpcReady}, }, ssW.SendPayload: {Add: S{ssW.ErrSendPayload, ssW.Exception}}, ssW.Idle: { Auto: true, Require: S{ssW.Ready}, Remove: sgW.WorkStatus, }, ssW.WorkRequested: { Require: S{ssW.Ready}, Remove: sgW.WorkStatus, }, ssW.Working: { Require: S{ssW.Ready}, Remove: sgW.WorkStatus, }, ssW.WorkReady: { Require: S{ssW.Ready}, Remove: sgW.WorkStatus, }, })
WorkerStruct represents all relations and properties of WorkerStates.
Functions ¶
This section is empty.
Types ¶
type BootstrapStatesDef ¶
type BootstrapStatesDef struct { // WorkerAddr - The awaited worker passed its connection details. WorkerAddr string // inherit from WorkerStatesDef *ssrpc.WorkerStatesDef }
BootstrapStatesDef contains all the states of the Bootstrap state machine. The target state is WorkerAddr, activated by an aRPC client.
type ClientGroupsDef ¶
type ClientGroupsDef struct {
*states.ConnectedGroupsDef
}
ClientGroupsDef contains all the state groups of the Client state machine.
type ClientStatesDef ¶
type ClientStatesDef struct { *am.StatesBase Exception string ErrWorker string ErrSupervisor string WorkerDisconnected string WorkerConnecting string WorkerConnected string WorkerDisconnecting string WorkerReady string // Ready - Client is connected to a worker and ready to delegate work and // receive payloads. Ready string SuperDisconnected string SuperConnecting string SuperConnected string SuperDisconnecting string // SuperReady - Client is fully connected to the Supervisor. SuperReady string // WorkerRequested - Client has requested a Worker from the Supervisor. WorkerRequested string // inherit from BasicStatesDef *states.BasicStatesDef // inherit from ConsumerStatesDef *ssrpc.ConsumerStatesDef }
ClientStatesDef contains all the states of the Client state machine.
type SupervisorGroupsDef ¶
type SupervisorGroupsDef struct { *states.ConnectedGroupsDef // PoolStatus are pool's possible statuses, 1 active at a time. PoolStatus S // Errors list all possible errors of Supervisor. Errors S // PoolNormalized async PoolNormalized S }
SupervisorGroupsDef contains all the state groups of the Supervisor state machine.
type SupervisorStatesDef ¶
type SupervisorStatesDef struct { *am.StatesBase ErrWorker string ErrPool string LocalRpcReady string PublicRpcReady string // Ready - Supervisor is ready to accept new clients. Ready string // Heartbeat checks the health of the worker pool and network connections. Heartbeat string // PoolStarting - Supervisor is starting workers to meet the pool definition. PoolStarting string // NormalizingPool - Supervisor is re-spawning some workers. NormalizingPool string // PoolNormalized - Supervisor has normalized the pool. Check PoolReady for // the result. PoolNormalized string // PoolReady - Minimum amount of workers are ready. PoolReady string // TODO all warm warkers ready // PoolWarm string // WorkersAvailable - There are some idle workers in the pool. WorkersAvailable string // ForkWorker - Supervisor starts forking a new worker by creating a new aRPC // server. ForkWorker string // ForkingWorker - Supervisor is forking a new worker. ForkingWorker string // WorkerForked - New worker connected to bootstrap. WorkerConnected string // WorkerForked - Supervisor has successfully forked a new worker. WorkerForked string KillWorker string KillingWorker string WorkerKilled string // WorkerReady - One of the workers become ready. WorkerReady string // WorkerGone - One of the workers has disconnected. WorkerGone string // ClientConnected - At least 1 client is connected to the supervisor. ClientConnected string // ClientDisconnected - 1 Client has disconnected from the supervisor. ClientDisconnected string // ProvideWorker - Client requests a new worker. ProvideWorker string // WorkerIssues - Client complains about the worker. WorkerIssues string // ClientSendPayload - payload delivered to the RPC server with for clients // as mutation args. ClientSendPayload string SuperConnected string SuperDisconnected string // SuperSendPayload - payload delivered to the RPC server for supervisors // as mutation args. SuperSendPayload string // inherit from WorkerStatesDef *ssrpc.WorkerStatesDef }
SupervisorStatesDef contains all the states of the Supervisor state machine.
type WorkerGroupsDef ¶
type WorkerGroupsDef struct { // WorkStatus represents work-related states, 1 active at a time. This group // has to be bound by the implementation, e.g. using Add relation from custom // work states. WorkStatus S }
WorkerGroupsDef contains all the state groups of the Worker state machine.
type WorkerStatesDef ¶
type WorkerStatesDef struct { *am.StatesBase ErrWork string ErrWorkTimeout string ErrClient string ErrSupervisor string // Ready - Worker is able to perform work. Ready string // LocalRpcReady - Supervisor RPC server is ready for connections. LocalRpcReady string // PublicRpcReady - Client RPC server is ready for connections. PublicRpcReady string // RpcReady - both RPC servers are ready. RpcReady string // SuperConnected - Worker is connected to the Supervisor. SuperConnected string // ServeClient - Worker is requested to accept a connection from client // am.A["id"]. ServeClient string // ClientConnected - Worker is connected to a client. ClientConnected string ClientSendPayload string SuperSendPayload string Idle string WorkRequested string Working string WorkReady string // inherit from WorkerStatesDef *ssrpc.WorkerStatesDef }
WorkerStatesDef contains all the states of the Worker state machine.