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 of the entries matches the // preferred outbound IP address and chosen RaftPort for this server ErrSelfNotInConfig = errors.New("This node must be included in the configration") )
Functions ¶
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 configuration of one node, which only trivally involves Raft functions Multi is a configuration of more than one nodes, requiring full Raft coordination
type ServerConfig ¶
type ServerConfig struct {
IpAddr net.IP
DataDir string
RaftPort int
RaftAddr string
ClientPort int
ClientAddr string
Mode ClusterMode
NodeIds []string
}
A ServerConfig contains the configuation values needed for other parts of the server (see `BuildConfig`)
func BuildServerConfig ¶
func BuildServerConfig() *ServerConfig
BuildConfig performs all operations needed to parse configuration options, whether commandline flags, config file parsing, or boot-time environment variable checks, precompute other static configration values from those options, and perform tasks that ensure that the configration is locally valid (such as checking that the IP and RaftPort for this machine are included in the cluster configuration)