Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { NodeID string `toml:"node_id"` ListenAddr string `toml:"listen_addr"` DataDir string `toml:"data_dir"` CompactionEnabled bool `toml:"compaction_enabled"` Peers []Peer `toml:"peers"` }
Config defines a node's configuration needed for Raft consensus bootstrapping and cluster management.
func LoadConfigFromFile ¶
LoadConfigFromFile attempts to load a configuration from file. It returns an error upon failure of reading or parsing the file.
type Logger ¶
type Logger interface { Info(msg string, args ...interface{}) Debug(msg string, args ...interface{}) Error(msg string, args ...interface{}) With(args ...interface{}) Logger }
Logger defines a logging interface a Raft node expects to use.
func NewRaftLogger ¶
type StateMachine ¶
StateMachine defines an interface that any finite state machine used in Raft must implement. The state machine can be completely agnostic to the mechanics of Raft. It consumes commands from Raft log entries and returns any interface value resulting in success or a potential error.
Click to show internal directories.
Click to hide internal directories.