global

package
v0.0.0-...-d831435 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log *logging.Logger

Log is the logger used throughout the node's process.

View Source
var TimeoutChannel chan bool = make(chan bool)

TimeoutChannel is the channel used for kicking off leader election when a node has not received a leader heartbeat in a while.

Functions

func GenerateTimeout

func GenerateTimeout(average uint32, jitter uint32) uint32

GenerateTimeout returns a timeout value between average - jitter and average + jitter.

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel sets the log level based on the config.yaml log_level value.

func SetUpLogger

func SetUpLogger()

SetUpLogger sets up the logger Log.

Types

type ConfigMap

type ConfigMap struct {
	LogLevel              string              `yaml:"log_level"`
	ElectionTimeout       uint32              `yaml:"election_timeout"`
	ElectionTimeoutJitter uint32              `yaml:"election_timeout_jitter"`
	LeaderHeartbeatPeriod uint32              `yaml:"leader_heartbeat_period"`
	NodeId                string              `yaml:"node_id"`
	Nodes                 map[string]NodeHost `yaml:"node_hosts"`
}

ConfigMap contains all the configurations loaded from the config file.

var Config ConfigMap

Config contains the loaded configurations.

func LoadConfig

func LoadConfig() ConfigMap

LoadConfig loads the config map from config.yaml into Config.

type NodeHost

type NodeHost struct {
	Url     string `yaml:"url"`
	ApiPort uint32 `yaml:"api_port"`
	RpcPort uint32 `yaml:"rpc_port"`
}

NodeHost represents a host node in the Raft cluster.

Jump to

Keyboard shortcuts

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