Documentation
¶
Index ¶
- Constants
- func NewExampleStateMachine(clusterID uint64, nodeID uint64) sm.IStateMachine
- type ExampleStateMachine
- func (s *ExampleStateMachine) Close() error
- func (s *ExampleStateMachine) Lookup(query interface{}) (interface{}, error)
- func (s *ExampleStateMachine) RecoverFromSnapshot(r io.Reader, files []sm.SnapshotFile, done <-chan struct{}) error
- func (s *ExampleStateMachine) SaveSnapshot(w io.Writer, fc sm.ISnapshotFileCollection, done <-chan struct{}) error
- func (s *ExampleStateMachine) Update(data []byte) (sm.Result, error)
- type Node
- func (n *Node) AddObserver(address string, node int) error
- func (n *Node) GetMembers() (*dragonboat.Membership, error)
- func (n *Node) Leader() (uint64, bool, error)
- func (n *Node) NodeID() string
- func (n *Node) Propose(msg string) error
- func (n *Node) Read(query string) (string, error)
- func (n *Node) Start() error
- func (n *Node) Start1() error
- func (n *Node) Stop()
Constants ¶
View Source
const ( // ClusterID identifier of cluster. Use only one cluster. ClusterID uint64 = 123 )
Variables ¶
This section is empty.
Functions ¶
func NewExampleStateMachine ¶
func NewExampleStateMachine(clusterID uint64, nodeID uint64) sm.IStateMachine
Types ¶
type ExampleStateMachine ¶
func (*ExampleStateMachine) Close ¶
func (s *ExampleStateMachine) Close() error
func (*ExampleStateMachine) Lookup ¶
func (s *ExampleStateMachine) Lookup(query interface{}) (interface{}, error)
func (*ExampleStateMachine) RecoverFromSnapshot ¶
func (s *ExampleStateMachine) RecoverFromSnapshot( r io.Reader, files []sm.SnapshotFile, done <-chan struct{}, ) error
RecoverFromSnapshot recovers the state using the provided snapshot.
func (*ExampleStateMachine) SaveSnapshot ¶
func (s *ExampleStateMachine) SaveSnapshot( w io.Writer, fc sm.ISnapshotFileCollection, done <-chan struct{}, ) error
Click to show internal directories.
Click to hide internal directories.