Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidMultiConfig indicates a configuration mode of "multi" but no // other nodes included in the configuration ErrInvalidMultiConfig = errors.New( "Multi-node configuration must include more than one node") // ErrSelfNotInConfig indicates a configuration that does not include this // node--double-check the config file and make sure that one entry matches // the preferred outbound IP address and chosen RaftPort for this server ErrSelfNotInConfig = errors.New( "This node must be included in the configration") // ErrInvalidNSnapshots indicates that a number less than 1 was specified // for retaining snapshots ErrInvalidNSnapshots = errors.New( "Number of snapshots to retain must be greater than 0") )
Functions ¶
func GetLogLevel ¶
GetLogLevel fetches the log level set at the env var: LEIF_LOG_LEVEL
func GetOutboundIP ¶
GetOutboundIP returns ip of preferred interface this machine
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { Mode ClusterMode NodeIds []string }
type ClusterMode ¶
type ClusterMode string
ClusterMode is one of "single" or "multi" for describing distribution mode
const ( SingleNode ClusterMode = "single" MultiNode = "multi" )
Single is a cluster of one node, which only trivially involves Raft Multi is a cluster of more than one node, requiring full Raft coordination
type ServerConfig ¶
type ServerConfig struct { Host string DataDir string SnapshotThreshold int64 RetainNSnapshots int RaftPort string RaftAddr string ClientPort string ClientAddr string Mode ClusterMode NodeIds []string }
A ServerConfig contains the configuration values needed for other parts of the server (see `BuildConfig`)
func BuildServerConfig ¶
func BuildServerConfig() *ServerConfig
BuildConfig performs all operations needed to parse configuration options from environment variables, pre-compute other static configuration values from those options, and perform tasks that ensure that the configuration is locally valid (such as checking that the IP and RaftPort for this machine are included in the cluster configuration)