configuration

package
v0.2.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func GetLogLevel() zerolog.Level

GetLogLevel fetches the log level set at the env var: LEIF_LOG_LEVEL

func GetOutboundIP

func GetOutboundIP() net.IP

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL