config

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config exposes some static variables loaded through a .yaml file used throughout the Paxos algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	DB_PATH   string `yaml:"db_path"`   // DB_PATH locates the database file.
	PID       int    `yaml:"pid"`       // PID is the identifier of the node, PID is supposed to unique.
	V_DEFAULT string `yaml:"v_default"` // V_DEFAULT defines what is the default value proposed by the node for the accept request when no prior value has been proposed.

	PORT int `yaml:"port"` // PORT defines the TCP port to which the web server will be listening.

	MANUAL_MODE  bool          `yaml:"manual_mode"`  // MANUAL_MODE defines whether the nodes proceed automatically through the phases or wait for user interaction.
	TIMEOUT      time.Duration `yaml:"timeout"`      // TIMEOUT defines the time duration (in seconds) waited by the client before assuming a node is not reachable.
	SEEK_TIMEOUT time.Duration `yaml:"seek_timeout"` // SEEK_TIMEOUT defines the time duration (in seconds) needed before performing new a seek request (used only when MANUAL_MODE = false).

	NODES []string `yaml:"nodes"` // NODES defines the list of the paxos nodes of the system.

	QUORUM int `yaml:"quorum"` // QUORUM defines the number of positive responses needed for the algorithm to proceed. It's computed at execution time, but can be provided explicitly.
}

Conf is a type describing some of the meta variables used by different parts of the algorithm.

var CONF Conf

CONF is the Conf object which holds all the variables

func (*Conf) FillEmptyFields

func (c *Conf) FillEmptyFields()

FillEmptyFields fills in those fields that were left empty in the .yaml file or those which need a run-time computation. These are the only fields which can be left blank, each field that is not initialized by this function has to be filled by the user in the .yaml file.

func (*Conf) LoadConfigFile

func (c *Conf) LoadConfigFile(fn string)

LoadConfigFile loads the config '.yaml' file onto the callee Conf object.

Jump to

Keyboard shortcuts

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