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") )
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 cluster of one node, which only trivally involves Raft functions Multi is a cluster of more than one node, requiring full Raft coordination
type ServerConfig ¶
type ServerConfig struct {
Host string
DataDir string
RaftPort string
RaftAddr string
ClientPort string
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 from environment variables, 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)