Versions in this module Expand all Collapse all v1 v1.2.3 Dec 10, 2022 Changes in this version + const DefaultRaftTimeout + type Fsm struct + func NewFsm() *Fsm + func (f *Fsm) Apply(l *raft.Log) interface{} + func (f *Fsm) DelByNode(node string) int + func (f *Fsm) Restore(ir io.ReadCloser) error + func (f *Fsm) Search(key string) []string + func (f *Fsm) Snapshot() (raft.FSMSnapshot, error) + type KVStore struct + Data map[string][]string + func NewKVStore() KVStore + func (d *KVStore) Del(key, value string) + func (d *KVStore) DelByValue(value string) int + func (d *KVStore) Get(key string) []string + func (d *KVStore) Persist(sink raft.SnapshotSink) error + func (d *KVStore) Release() + func (d *KVStore) Set(key, value string) + type Node struct + func NewRaftNode(raftAddr, raftId, raftDir string) (*Node, error) + func (n *Node) Apply(cmd []byte, timeout time.Duration) error + func (n *Node) DelByNode(node string) int + func (n *Node) GetLeader() (addr, id string) + func (n *Node) IsLeader() bool + func (n *Node) Join(nodeID, addr string) error + func (n *Node) Leave(nodeID string) error + func (n *Node) Search(key string) []string + func (n *Node) SetListener(listener func(op, key, value string)) + func (n *Node) Shutdown() error + func (n *Node) Snapshot() error + func (n *Node) Status() ([]byte, error) + func (n *Node) WaitForApplied(timeout time.Duration) error + func (n *Node) WaitForAppliedIndex(idx uint64, timeout time.Duration) error + func (n *Node) WaitForLeader(timeout time.Duration) (string, error)