Versions in this module Expand all Collapse all v0 v0.1.0 Jan 15, 2024 Changes in this version + type Observer interface + Notify func(state bool) + type Options struct + type OptionsFn func(opt Options) + func WithBufferSize(len int) OptionsFn + func WithElectionTimeout(min, max int) OptionsFn + func WithHeartbeatTimeout(timeout int) OptionsFn + func WithTimeout(timeout int) OptionsFn + type RaftNode struct + CommitChan chan log.LogEntry + RPCServer server.Server + func New(peers map[uint]string, id int32, port uint16, storage storage.Store, ...) (*RaftNode, error) + func (r *RaftNode) CopyPeers() map[uint]string + func (r *RaftNode) GetCurrentTerm() uint64 + func (r *RaftNode) GetID() int32 + func (r *RaftNode) GetLastApplied() uint64 + func (r *RaftNode) GetLeaderID() int32 + func (r *RaftNode) GetLog() []log.LogEntry + func (r *RaftNode) GetLogByIndex(index uint64) log.LogEntry + func (r *RaftNode) GetPeers() map[uint]string + func (r *RaftNode) GetState() (uint64, bool) + func (r *RaftNode) GetVotedFor() int32 + func (r *RaftNode) IsLeader() bool + func (r *RaftNode) IsStopped() bool + func (r *RaftNode) Run(ctx context.Context, secure bool) error + func (r *RaftNode) SetCurrentTerm(term uint64) + func (r *RaftNode) SetLastApplied(index uint64) + func (r *RaftNode) SetLog(log []log.LogEntry) + func (r *RaftNode) SetVotedFor(id int32) + func (r *RaftNode) Stop() error