config

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultKeyfile defines the default name of the file containing the
	// validator's private key
	DefaultKeyfile = "priv_key"

	// DefaultBadgerFile defines the default name of the folder containing the
	// Badger database
	DefaultBadgerFile = "badger_db"
)

Variables

This section is empty.

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir ...

func HomeDir

func HomeDir() string

HomeDir ...

func LogLevel

func LogLevel(l string) logrus.Level

LogLevel ...

Types

type Config

type Config struct {
	// DataDir is the top-level directory containing Babble configuration and
	// data
	DataDir string `mapstructure:"datadir"`

	// LogLevel determines the chattiness of the log output.
	LogLevel string `mapstructure:"log"`

	// BindAddr is the local address:port where this node gossips with other
	// nodes. This is an IP address that should be reachable by all other nodes
	// in the cluster. By default, this is "0.0.0.0", meaning Babble will bind
	// to all addresses on the local machine. However, in some cases, there may
	// be a routable address that cannot be bound. Use AdvertiseAddr to enable
	// gossiping a different address to support this. If this address is not
	// routable, the node will be in a constant flapping state as other nodes
	// will treat the non-routability as a failure
	BindAddr string `mapstructure:"listen"`

	// AdvertiseAddr is used to change the address that we advertise to other
	// nodes in the cluster
	AdvertiseAddr string `mapstructure:"advertise"`

	// ServiceAddr is the address:port that serves the user-facing API.
	ServiceAddr string `mapstructure:"service-listen"`

	// HeartbeatTimeout is the frequency of the gossip timer.
	HeartbeatTimeout time.Duration `mapstructure:"heartbeat"`

	// MaxPool controls how many connections are pooled per target in the gossip
	// routines.
	MaxPool int `mapstructure:"max-pool"`

	// TCPTimeout is the timeout of gossip TCP connections.
	TCPTimeout time.Duration `mapstructure:"timeout"`

	// JoinTimeout is the timeout of Join Requests
	JoinTimeout time.Duration `mapstructure:"join_timeout"`

	// SyncLimit defines the max number of hashgraph events to include in a
	// SyncResponse or EagerSyncRequest
	SyncLimit int `mapstructure:"sync-limit"`

	// EnableFastSync determines whether or not to enable the FastSync protocol.
	EnableFastSync bool `mapstructure:"fast-sync"`

	// Store is a flag that determines whether or not to use persistant storage.
	Store bool `mapstructure:"store"`

	// CacheSize is the max number of items in in-memory caches.
	CacheSize int `mapstructure:"cache-size"`

	// Bootstrap determines whether or not to load Babble from an existing
	// database file.
	Bootstrap bool `mapstructure:"bootstrap"`

	// Moniker defines the friendly name of this node
	Moniker string `mapstructure:"moniker"`

	// LoadPeers determines whether or not to attempt loading the peer-set from
	// a local json file.
	LoadPeers bool

	// Proxy is the application proxy that enables Babble to communicate with
	// application.
	Proxy proxy.AppProxy

	// Key is the private key of the validator.
	Key *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

Config contains all the configuration properties of a Babble node.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig retunrns the a config object with default values.

func NewTestConfig

func NewTestConfig(t testing.TB) *Config

NewTestConfig returns a config object with default values and a special logger. the logger forces formatting and colors even when there is no tty attached, which makes for more readable logs. The logger also provides info about the calling function.

func (*Config) BadgerDir

func (c *Config) BadgerDir() string

BadgerDir returs the full path of the folder containing the Babdger database.

func (*Config) Keyfile

func (c *Config) Keyfile() string

Keyfile returns the full path of the file containing the private key.

func (*Config) Logger

func (c *Config) Logger() *logrus.Entry

Logger returns a formatted logrus Entry, with prefix set to "babble".

Jump to

Keyboard shortcuts

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