dragonboat

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStateMachine

func NewStateMachine(shardID uint64, replicaID uint64) sm.IStateMachine

NewStateMachine creates and return a new StateMachine object.

Types

type StateMachine

type StateMachine struct {
	ShardID   uint64
	ReplicaID uint64
	Count     uint64
}

StateMachine is the IStateMachine implementation used in the example for handling all inputs not ends with "?". See https://github.com/lni/dragonboat/blob/master/statemachine/rsm.go for more details of the IStateMachine interface.

func (*StateMachine) Close

func (s *StateMachine) Close() error

Close closes the IStateMachine instance. There is nothing for us to cleanup or release as this is a pure in memory data store. Note that the Close method is not guaranteed to be called as node can crash at any time.

func (*StateMachine) Lookup

func (s *StateMachine) Lookup(query interface{}) (interface{}, error)

Lookup performs local lookup on the StateMachine instance. In this example, we always return the Count value as a little endian binary encoded byte slice.

func (*StateMachine) RecoverFromSnapshot

func (s *StateMachine) RecoverFromSnapshot(r io.Reader,
	files []sm.SnapshotFile, done <-chan struct{}) error

RecoverFromSnapshot recovers the state using the provided snapshot.

func (*StateMachine) SaveSnapshot

func (s *StateMachine) SaveSnapshot(w io.Writer,
	fc sm.ISnapshotFileCollection, done <-chan struct{}) error

SaveSnapshot saves the current IStateMachine state into a snapshot using the specified io.Writer object.

func (*StateMachine) Update

func (s *StateMachine) Update(e sm.Entry) (sm.Result, error)

Update updates the object using the specified committed raft entry.

Jump to

Keyboard shortcuts

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