Documentation
¶
Index ¶
- type Commit
- type KVStore
- type RaftNode
- func (rc *RaftNode) Done() <-chan struct{}
- func (rc *RaftNode) ForceSnapshot() error
- func (rc *RaftNode) GetWALSize() (int64, error)
- func (rc *RaftNode) IsIDRemoved(_ uint64) bool
- func (rc *RaftNode) OnLeadershipChange(isLeader bool)
- func (rc *RaftNode) Process(ctx context.Context, m raftpb.Message) error
- func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (rc *RaftNode) ReportUnreachable(id uint64)
- func (rc *RaftNode) TransferLeadership(ctx context.Context, nodeID uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVStore ¶ added in v0.0.57
type KVStore struct {
DataC chan KV.KV
Restore []*KV.KV
ConfChangeC chan raftpb.ConfChange
Node *node.Node
CommittedKeys sync.Map
// contains filtered or unexported fields
}
a key-value store backed by raft
func NewKVStore ¶ added in v0.0.57
func (*KVStore) GetSnapshot ¶ added in v0.0.57
type RaftNode ¶ added in v0.0.57
type RaftNode struct {
Peers *node.Nodes // raft peer URLs
IsLeader atomic.Bool
TLSConfig *tls.Config
// contains filtered or unexported fields
}
func NewRaftNode ¶ added in v0.0.57
func NewRaftNode(keys *keys.Keys, TLSConfig *tls.Config, id uint64, peers *node.Nodes, join bool, replay bool, getSnapshot func() ([]byte, error), channels *channels.Cluster) (*RaftNode, <-chan *Commit, <-chan error, <-chan *snap.Snapshotter)
newRaftNode initiates a raft instance and returns a committed log entry channel and error channel. Proposals for log updates are sent over the provided the proposal channel. All log entries are replayed over the commit channel, followed by a nil message (to indicate the channel is current), then new log entries. To shutdown, close proposeC and read errorC.
func (*RaftNode) ForceSnapshot ¶ added in v0.1.56
func (*RaftNode) GetWALSize ¶ added in v0.1.56
func (*RaftNode) IsIDRemoved ¶ added in v0.0.57
func (*RaftNode) OnLeadershipChange ¶ added in v0.1.56
func (*RaftNode) ReportSnapshot ¶ added in v0.0.57
func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (*RaftNode) ReportUnreachable ¶ added in v0.0.57
Click to show internal directories.
Click to hide internal directories.