processor

package
v0.0.0-...-a3e98d7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotExist error = errors.New("client does not exist")
View Source
var ErrStopped = errors.Errorf("stopped")

Functions

func IntializeWALForNewNode

func IntializeWALForNewNode(
	wal WAL,
	runtimeParms *state.EventInitialParameters,
	initialNetworkState *msgs.NetworkState,
	initialCheckpointValue []byte,
) (*statemachine.EventList, error)

func ProcessAppActions

func ProcessAppActions(app App, actions *statemachine.ActionList) (*statemachine.EventList, error)

func ProcessHashActions

func ProcessHashActions(hasher Hasher, actions *statemachine.ActionList) (*statemachine.EventList, error)

func ProcessNetActions

func ProcessNetActions(selfID uint64, link Link, actions *statemachine.ActionList) (*statemachine.EventList, error)

func ProcessReqStoreEvents

func ProcessReqStoreEvents(reqStore RequestStore, events *statemachine.EventList) (*statemachine.EventList, error)

func ProcessWALActions

func ProcessWALActions(wal WAL, actions *statemachine.ActionList) (*statemachine.ActionList, error)

func RecoverWALForExistingNode

func RecoverWALForExistingNode(wal WAL, runtimeParms *state.EventInitialParameters) (*statemachine.EventList, error)

Types

type App

type App interface {
	Apply(*msgs.QEntry) error
	Snap(networkConfig *msgs.NetworkState_Config, clientsState []*msgs.NetworkState_Client) ([]byte, []*msgs.Reconfiguration, error)
	TransferTo(seqNo uint64, snap []byte) (*msgs.NetworkState, error)
}

type Client

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

TODO, client needs to be updated based on the state applied events, to give it a low watermark minimally and to clean up the reqNoMap

func (*Client) NextReqNo

func (c *Client) NextReqNo() (uint64, error)

func (*Client) Propose

func (c *Client) Propose(reqNo uint64, data []byte) (*statemachine.EventList, error)

type Clients

type Clients struct {
	Hasher       Hasher
	RequestStore RequestStore
	// contains filtered or unexported fields
}

func (*Clients) Client

func (cs *Clients) Client(clientID uint64) *Client

func (*Clients) ProcessClientActions

func (c *Clients) ProcessClientActions(actions *statemachine.ActionList) (*statemachine.EventList, error)

type EventInterceptor

type EventInterceptor interface {
	// Intercept is invoked prior to passing each state event to
	// the state machine.  If Intercept returns an error, the
	// state machine halts.
	Intercept(s *state.Event) error
}

EventInterceptor provides a way for a consumer to gain insight into the internal operation of the state machine. And is usually not interesting outside of debugging or testing scenarios. Note, this is applied inside the serializer, so any blocking will prevent the event from arriving at the state machine until it returns.

type Hasher

type Hasher interface {
	New() hash.Hash
}
type Link interface {
	Send(dest uint64, msg *msgs.Msg)
}

type Replica

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

func (*Replica) Step

func (r *Replica) Step(msg *msgs.Msg) (*statemachine.EventList, error)

type Replicas

type Replicas struct {
	Clients *Clients
	// contains filtered or unexported fields
}

func (*Replicas) Replica

func (rs *Replicas) Replica(id uint64) *Replica

type RequestStore

type RequestStore interface {
	GetAllocation(clientID, reqNo uint64) ([]byte, error)
	PutAllocation(clientID, reqNo uint64, digest []byte) error
	GetRequest(requestAck *msgs.RequestAck) ([]byte, error)
	PutRequest(requestAck *msgs.RequestAck, data []byte) error
	Sync() error
}

type WAL

type WAL interface {
	Write(index uint64, entry *msgs.Persistent) error
	Truncate(index uint64) error
	Sync() error
	LoadAll(forEach func(index uint64, p *msgs.Persistent)) error
}

type WorkItems

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

func NewWorkItems

func NewWorkItems() *WorkItems

func (*WorkItems) AddAppResults

func (pi *WorkItems) AddAppResults(events *statemachine.EventList)

func (*WorkItems) AddClientResults

func (pi *WorkItems) AddClientResults(events *statemachine.EventList)

func (*WorkItems) AddHashResults

func (pi *WorkItems) AddHashResults(events *statemachine.EventList)

func (*WorkItems) AddNetResults

func (pi *WorkItems) AddNetResults(events *statemachine.EventList)

func (*WorkItems) AddReqStoreResults

func (pi *WorkItems) AddReqStoreResults(events *statemachine.EventList)

func (*WorkItems) AddStateMachineResults

func (pi *WorkItems) AddStateMachineResults(actions *statemachine.ActionList)

func (*WorkItems) AddWALResults

func (pi *WorkItems) AddWALResults(actions *statemachine.ActionList)

func (*WorkItems) AppActions

func (pi *WorkItems) AppActions() *statemachine.ActionList

func (*WorkItems) ClearAppActions

func (pi *WorkItems) ClearAppActions()

func (*WorkItems) ClearClientActions

func (pi *WorkItems) ClearClientActions()

func (*WorkItems) ClearHashActions

func (pi *WorkItems) ClearHashActions()

func (*WorkItems) ClearNetActions

func (pi *WorkItems) ClearNetActions()

func (*WorkItems) ClearReqStoreEvents

func (pi *WorkItems) ClearReqStoreEvents()

func (*WorkItems) ClearResultEvents

func (pi *WorkItems) ClearResultEvents()

func (*WorkItems) ClearWALActions

func (pi *WorkItems) ClearWALActions()

func (*WorkItems) ClientActions

func (pi *WorkItems) ClientActions() *statemachine.ActionList

func (*WorkItems) HashActions

func (pi *WorkItems) HashActions() *statemachine.ActionList

func (*WorkItems) NetActions

func (pi *WorkItems) NetActions() *statemachine.ActionList

func (*WorkItems) ReqStoreEvents

func (pi *WorkItems) ReqStoreEvents() *statemachine.EventList

func (*WorkItems) ResultEvents

func (pi *WorkItems) ResultEvents() *statemachine.EventList

func (*WorkItems) WALActions

func (pi *WorkItems) WALActions() *statemachine.ActionList

Jump to

Keyboard shortcuts

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