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 NetMach machine. WorkerStates = ssW // WorkerGroups contains all the state groups for the NetMach 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 BootstrapSchema = SchemaMerge( ssam.BasicSchema, ssrpc.StateSourceSchema, am.Schema{ cos.WorkerAddr: {}, })
BootstrapSchema represents all relations and properties of BootstrapStatesDef.
var (
// BootstrapStates contains all the states for the Bootstrap machine.
BootstrapStates = cos
)
var ClientSchema = SchemaMerge( states.BasicSchema, ssrpc.ConsumerSchema, am.Schema{ 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}, }, })
ClientSchema represents all relations and properties of ClientStates.
var SupervisorSchema = SchemaMerge( ssam.BasicSchema, ssrpc.StateSourceSchema, am.Schema{ 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.ListWorkers: { Multi: true, Require: S{ssS.Start}, }, ssS.SetWorker: { Multi: true, Require: S{ssS.Start}, }, 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}, })
SupervisorSchema represents all relations and properties of SupervisorStates.
var WorkerSchema = SchemaMerge( ssam.BasicSchema, ssrpc.StateSourceSchema, am.Schema{ 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, }, })
WorkerSchema represents all relations and properties of WorkerStates.
Functions ¶
This section is empty.
Types ¶
type BootstrapStatesDef ¶
type BootstrapStatesDef struct {
*am.StatesBase
// WorkerAddr - The awaited worker passed its connection details.
WorkerAddr string
// inherit from BasicStatesDef
*ssam.BasicStatesDef
// inherit from StateSourceStatesDef
*ssrpc.StateSourceStatesDef
}
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 NetMach 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 {
*ssam.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
// ListWorkers is a getter returning a list of workers via a channel, with
// filters.
ListWorkers string
// SetWorker is a setter for a worker, which can also delete worker entries.
SetWorker 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 BasicStatesDef
*ssam.BasicStatesDef
// inherit from StateSourceStatesDef
*ssrpc.StateSourceStatesDef
}
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 NetMach state machine.
type WorkerStatesDef ¶
type WorkerStatesDef struct {
*am.StatesBase
ErrWork string
ErrWorkTimeout string
ErrClient string
ErrSupervisor string
// Ready - NetMach 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 - NetMach is connected to the Supervisor.
SuperConnected string
// ServeClient - NetMach is requested to accept a connection from client
// am.A["id"].
ServeClient string
// ClientConnected - NetMach is connected to a client.
ClientConnected string
// Send payload to the client
ClientSendPayload string
// Send payload to the supervisor
SuperSendPayload string
Idle string
WorkRequested string
Working string
WorkReady string
// inherit from BasicStatesDef
*ssam.BasicStatesDef
// inherit from StateSourceStatesDef
*ssrpc.StateSourceStatesDef
}
WorkerStatesDef contains all the states of the NetMach state machine.