Documentation ¶
Index ¶
- Constants
- func ErrAssertMachineCtx(err error) error
- func ErrInititalizeK8sMachine(err error) error
- func ErrInvalidTransition(from, to StateType) error
- func ErrInvalidTransitionEvent(from StateType, event EventType) error
- func ErrInvalidType(err error) error
- type Action
- type ConnectionToStateMachineInstanceTracker
- type DefaultConnectAction
- func (da *DefaultConnectAction) Execute(ctx context.Context, machineCtx interface{}, data interface{}) (EventType, *events.Event, error)
- func (da *DefaultConnectAction) ExecuteOnEntry(ctx context.Context, machineCtx interface{}, data interface{}) (EventType, *events.Event, error)
- func (da *DefaultConnectAction) ExecuteOnExit(ctx context.Context, machineCtx interface{}, data interface{}) (EventType, *events.Event, error)
- type EventType
- type Events
- type Payload
- type State
- type StateMachine
- type StateType
- type States
Constants ¶
View Source
const ( ErrInvalidTransitionCode = "1541" ErrInvalidTransitionEventCode = "1542" ErrInititalizeK8sMachineCode = "1543" ErrAssetMachineCtxCode = "1544" ErrInvalidTypeCode = "1551" )
View Source
const ( Discovery EventType = "discovery" Register EventType = "register" Connect EventType = "connect" Disconnect EventType = "disconnect" Ignore EventType = "ignore" NotFound EventType = "not found" Delete EventType = "delete" NoOp EventType = "noop" DISCOVERED StateType = "discovered" REGISTERED StateType = "registered" CONNECTED StateType = "connected" IGNORED StateType = "ignored" MAINTENANCE StateType = "maintenance" DISCONNECTED StateType = "disconnected" DELETED StateType = "deleted" NOTFOUND StateType = "not found" Init EventType = "initialize" )
Variables ¶
This section is empty.
Functions ¶
func ErrAssertMachineCtx ¶
func ErrInvalidTransition ¶
func ErrInvalidType ¶ added in v0.7.7
Types ¶
type Action ¶
type Action interface { // Used as guards/prerequisites checks and actions to be performed when the machine enters a given state. ExecuteOnEntry(context context.Context, machinectx interface{}, data interface{}) (EventType, *events.Event, error) Execute(context context.Context, machinectx interface{}, data interface{}) (EventType, *events.Event, error) // Used for cleanup actions to perform when the machine exits a given state ExecuteOnExit(context context.Context, machinectx interface{}, data interface{}) (EventType, *events.Event, error) }
Action to be executed in a given state.
type ConnectionToStateMachineInstanceTracker ¶ added in v0.7.7
type ConnectionToStateMachineInstanceTracker struct { ConnectToInstanceMap map[uuid.UUID]*StateMachine // contains filtered or unexported fields }
func (*ConnectionToStateMachineInstanceTracker) Add ¶ added in v0.7.7
func (smt *ConnectionToStateMachineInstanceTracker) Add(id uuid.UUID, inst *StateMachine)
func (*ConnectionToStateMachineInstanceTracker) Get ¶ added in v0.7.7
func (smt *ConnectionToStateMachineInstanceTracker) Get(id uuid.UUID) (*StateMachine, bool)
func (*ConnectionToStateMachineInstanceTracker) Remove ¶ added in v0.7.7
func (smt *ConnectionToStateMachineInstanceTracker) Remove(id uuid.UUID)
type DefaultConnectAction ¶ added in v0.7.7
type DefaultConnectAction struct{}
func (*DefaultConnectAction) ExecuteOnEntry ¶ added in v0.7.7
func (*DefaultConnectAction) ExecuteOnExit ¶ added in v0.7.7
type Payload ¶ added in v0.7.7
type Payload struct { Connection connections.Connection Credential models.Credential }
type State ¶
func Discovered ¶ added in v0.6.182
func Discovered() State
func Registered ¶ added in v0.6.182
func Registered() State
func (*State) RegisterAction ¶ added in v0.7.7
type StateMachine ¶
type StateMachine struct { // ID to trace the events originated from the machine, also used in logs ID uuid.UUID // Given name for the machine, used in logs to track issues Name string // Configuration of states managed by the machine States States // Represent the previous state of the machine PreviousState StateType // The current state of the machine CurrentState StateType // The initial state at which machine gets initialized InitialState StateType // Machine specific parameters/context. // Provided at initialization of the machine. Context interface{} Log logger.Handler Provider models.Provider // contains filtered or unexported fields }
func (*StateMachine) ResetState ¶
func (sm *StateMachine) ResetState()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.