statemachine

package
v0.0.0-...-f247ec5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionAllocateRequest

func ActionAllocateRequest(clientID, reqNo uint64) *state.Action

func ActionCheckpoint

func ActionCheckpoint(seqNo uint64, networkConfig *msgs.NetworkState_Config, clientStates []*msgs.NetworkState_Client) *state.Action

func ActionCommit

func ActionCommit(qEntry *msgs.QEntry) *state.Action

func ActionCorrectRequest

func ActionCorrectRequest(ack *msgs.RequestAck) *state.Action

func ActionForwardRequest

func ActionForwardRequest(targets []uint64, requestAck *msgs.RequestAck) *state.Action

func ActionHash

func ActionHash(data [][]byte, origin *state.HashOrigin) *state.Action

func ActionPersist

func ActionPersist(index uint64, p *msgs.Persistent) *state.Action

func ActionSend

func ActionSend(targets []uint64, msg *msgs.Msg) *state.Action

func ActionStateApplied

func ActionStateApplied(seqNo uint64, ns *msgs.NetworkState) *state.Action

func ActionStateTransfer

func ActionStateTransfer(seqNo uint64, value []byte) *state.Action

func ActionTruncate

func ActionTruncate(index uint64) *state.Action

func EventActionsReceived

func EventActionsReceived() *state.Event

func EventCheckpointResult

func EventCheckpointResult(value []byte, pendingReconfigurations []*msgs.Reconfiguration, actionCheckpoint *state.ActionCheckpoint) *state.Event

func EventCompleteInitialization

func EventCompleteInitialization() *state.Event

func EventHashResult

func EventHashResult(digest []byte, origin *state.HashOrigin) *state.Event

func EventInitialize

func EventInitialize(initialParms *state.EventInitialParameters) *state.Event

func EventLoadPersistedEntry

func EventLoadPersistedEntry(index uint64, entry *msgs.Persistent) *state.Event

func EventRequestPersisted

func EventRequestPersisted(ack *msgs.RequestAck) *state.Event

func EventStateTransferComplete

func EventStateTransferComplete(networkState *msgs.NetworkState, actionStateTransfer *state.ActionStateTarget) *state.Event

func EventStateTransferFailed

func EventStateTransferFailed(actionStateTransfer *state.ActionStateTarget) *state.Event

func EventStep

func EventStep(source uint64, msg *msgs.Msg) *state.Event

func EventTickElapsed

func EventTickElapsed() *state.Event

Types

type ActionList

type ActionList struct {
	// contains filtered or unexported fields
}

func (*ActionList) AllocateRequest

func (al *ActionList) AllocateRequest(clientID, reqNo uint64) *ActionList

func (*ActionList) Checkpoint

func (al *ActionList) Checkpoint(seqNo uint64, networkConfig *msgs.NetworkState_Config, clientStates []*msgs.NetworkState_Client) *ActionList

func (*ActionList) Commit

func (al *ActionList) Commit(qEntry *msgs.QEntry) *ActionList

func (*ActionList) CorrectRequest

func (al *ActionList) CorrectRequest(ack *msgs.RequestAck) *ActionList

func (*ActionList) ForwardRequest

func (al *ActionList) ForwardRequest(targets []uint64, requestAck *msgs.RequestAck) *ActionList

func (*ActionList) Hash

func (al *ActionList) Hash(data [][]byte, origin *state.HashOrigin) *ActionList

func (*ActionList) Iterator

func (al *ActionList) Iterator() *ActionListIterator

func (*ActionList) Len

func (al *ActionList) Len() int

func (*ActionList) Persist

func (al *ActionList) Persist(index uint64, p *msgs.Persistent) *ActionList

func (*ActionList) PushBack

func (al *ActionList) PushBack(action *state.Action)

func (*ActionList) PushBackList

func (al *ActionList) PushBackList(actionList *ActionList)

func (*ActionList) Send

func (al *ActionList) Send(targets []uint64, msg *msgs.Msg) *ActionList

func (*ActionList) StateApplied

func (al *ActionList) StateApplied(seqNo uint64, ns *msgs.NetworkState) *ActionList

func (*ActionList) StateTransfer

func (al *ActionList) StateTransfer(seqNo uint64, value []byte) *ActionList

func (*ActionList) Truncate

func (al *ActionList) Truncate(index uint64) *ActionList

type ActionListIterator

type ActionListIterator struct {
	// contains filtered or unexported fields
}

func (*ActionListIterator) Next

func (ali *ActionListIterator) Next() *state.Action

Next will return the next value until the end of the list is encountered. Thereafter, it will return nil.

type EventList

type EventList struct {
	// contains filtered or unexported fields
}

func (*EventList) ActionsReceived

func (el *EventList) ActionsReceived() *EventList

func (*EventList) CheckpointResult

func (el *EventList) CheckpointResult(value []byte, pendingReconfigurations []*msgs.Reconfiguration, actionCheckpoint *state.ActionCheckpoint) *EventList

func (*EventList) CompleteInitialization

func (el *EventList) CompleteInitialization() *EventList

func (*EventList) HashResult

func (el *EventList) HashResult(digest []byte, origin *state.HashOrigin) *EventList

func (*EventList) Initialize

func (el *EventList) Initialize(initialParms *state.EventInitialParameters) *EventList

func (*EventList) Iterator

func (el *EventList) Iterator() *EventListIterator

func (*EventList) Len

func (el *EventList) Len() int

func (*EventList) LoadPersistedEntry

func (el *EventList) LoadPersistedEntry(index uint64, entry *msgs.Persistent) *EventList

func (*EventList) PushBack

func (el *EventList) PushBack(action *state.Event)

func (*EventList) PushBackList

func (el *EventList) PushBackList(actionList *EventList)

func (*EventList) RequestPersisted

func (el *EventList) RequestPersisted(ack *msgs.RequestAck) *EventList

func (*EventList) StateTransferComplete

func (el *EventList) StateTransferComplete(networkState *msgs.NetworkState, actionStateTransfer *state.ActionStateTarget) *EventList

func (*EventList) StateTransferFailed

func (el *EventList) StateTransferFailed(actionStateTransfer *state.ActionStateTarget) *EventList

func (*EventList) Step

func (el *EventList) Step(source uint64, msg *msgs.Msg) *EventList

func (*EventList) TickElapsed

func (el *EventList) TickElapsed() *EventList

type EventListIterator

type EventListIterator struct {
	// contains filtered or unexported fields
}

func (*EventListIterator) Next

func (ali *EventListIterator) Next() *state.Event

Next will return the next value until the end of the list is encountered. Thereafter, it will return nil.

type LogLevel

type LogLevel int
const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
)

type Logger

type Logger interface {
	// Log is invoked with the log level, the log message, and key/value pairs
	// of any relevant log details.  The keys are always strings, while the
	// values are unspecified.
	Log(level LogLevel, text string, args ...interface{})
}

Logger is minimal logging interface designed to be easily adaptable to any logging library.

var (
	// ConsoleDebugLogger implements Logger and writes all log messages to stdout.
	ConsoleDebugLogger Logger = consoleLogger(LevelDebug)

	// ConsoleInfoLogger implements Logger and writes all LevelInfo and above log messages to stdout.
	ConsoleInfoLogger Logger = consoleLogger(LevelInfo)

	// ConsoleWarnLogger implements Logger and writes all LevelWarn and above log messages to stdout.
	ConsoleWarnLogger Logger = consoleLogger(LevelWarn)

	// ConsoleErrorLogger implements Logger and writes all LevelError log messages to stdout.
	ConsoleErrorLogger Logger = consoleLogger(LevelError)
)

type StateMachine

type StateMachine struct {
	Logger Logger
	// contains filtered or unexported fields
}

StateMachine contains a deterministic processor for state events. This structure should almost never be initialized directly but should instead be allocated via StartNode.

func (*StateMachine) ApplyEvent

func (sm *StateMachine) ApplyEvent(stateEvent *state.Event) *ActionList

Public wrapper for StateMachine.applyEvent()

func (*StateMachine) Status

func (sm *StateMachine) Status() (s *status.StateMachine, err error)

Jump to

Keyboard shortcuts

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