config

package
v0.0.0-...-0eca64e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultDataDir = defaultHomeDir()
)

Functions

This section is empty.

Types

type BabbleConfig

type BabbleConfig struct {

	// Directory containing priv_key.pem and peers.json files
	DataDir string `mapstructure:"datadir"`

	// Address of Babble node (where it talks to other Babble nodes)
	BindAddr string `mapstructure:"listen"`

	// Babble HTTP API address
	ServiceAddr string `mapstructure:"service-listen"`

	// Gossip heartbeat
	Heartbeat time.Duration `mapstructure:"heartbeat"`

	// TCP timeout
	TCPTimeout time.Duration `mapstructure:"timeout"`

	// Max number of items in caches
	CacheSize int `mapstructure:"cache-size"`

	// Max number of Event in SyncResponse
	SyncLimit int `mapstructure:"sync-limit"`

	// Max number of connections in net pool
	MaxPool int `mapstructure:"max-pool"`

	// Database type; badger or inmeum
	Store bool `mapstructure:"store"`
}

BabbleConfig contains the configuration of a Babble node

func DefaultBabbleConfig

func DefaultBabbleConfig() *BabbleConfig

DefaultBabbleConfig returns the default configuration for a Babble node

func (*BabbleConfig) SetDataDir

func (c *BabbleConfig) SetDataDir(datadir string)

SetDataDir updates the babble configuration directories if they were set to to default values.

func (*BabbleConfig) ToRealBabbleConfig

func (c *BabbleConfig) ToRealBabbleConfig(logger *logrus.Logger) *_babble.BabbleConfig

ToRealBabbleConfig converts an evm-lite/src/config.BabbleConfig to a babble/src/babble.BabbleConfig as used by Babble

type BaseConfig

type BaseConfig struct {

	// Top-level directory of evm-babble data
	DataDir string `mapstructure:"datadir"`

	// Debug, info, warn, error, fatal, panic
	LogLevel string `mapstructure:"log"`
}

BaseConfig contains the top level configuration for an EVM-Babble node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns the default top-level configuration for EVM-Babble

type Config

type Config struct {

	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`

	// Options for EVM and State
	Eth *EthConfig `mapstructure:"eth"`

	// Options for Babble consensus
	Babble *BabbleConfig `mapstructure:"babble"`

	// Options for Raft consensus
	Raft *RaftConfig `mapstructure:"raft"`

	// Options for Tendermint consensus
	Tendermint *TmConfig `mapstructure:"tendermint"`
}

Config contains de configuration for an EVM-Lite node

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for an EVM-Lite node

func (*Config) SetDataDir

func (c *Config) SetDataDir(datadir string)

SetDataDir updates the root data directory as well as the various lower config for eth and consensus

type EthConfig

type EthConfig struct {

	// Genesis file
	Genesis string `mapstructure:"genesis"`

	// Location of ethereum account keys
	Keystore string `mapstructure:"keystore"`

	// File containing passwords to unlock ethereum accounts
	PwdFile string `mapstructure:"pwd"`

	// File containing the levelDB database
	DbFile string `mapstructure:"db"`

	// Address of HTTP API Service
	EthAPIAddr string `mapstructure:"listen"`

	// Megabytes of memory allocated to internal caching (min 16MB / database forced)
	Cache int `mapstructure:"cache"`
}

EthConfig contains the configuration relative to the accounts, EVM, trie/db, and service API

func DefaultEthConfig

func DefaultEthConfig() *EthConfig

DefaultEthConfig return the default configuration for Eth services

func (*EthConfig) SetDataDir

func (c *EthConfig) SetDataDir(datadir string)

SetDataDir updates the eth configuration directories if they were set to default values.

type RaftConfig

type RaftConfig struct {

	// ProtocolVersion allows a Raft server to inter-operate with older
	// Raft servers running an older version of the code. This is used to
	// version the wire protocol as well as Raft-specific log entries that
	// the server uses when _speaking_ to other servers. There is currently
	// no auto-negotiation of versions so all servers must be manually
	// configured with compatible versions. See ProtocolVersionMin and
	// ProtocolVersionMax for the versions of the protocol that this server
	// can _understand_.
	ProtocolVersion _raft.ProtocolVersion `mapstructure:"protocol_version"`

	// HeartbeatTimeout specifies the time in follower state without
	// a leader before we attempt an election.
	HeartbeatTimeout time.Duration `mapstructure:"heartbeat"`

	// ElectionTimeout specifies the time in candidate state without
	// a leader before we attempt an election.
	ElectionTimeout time.Duration `mapstructure:"election_timeout"`

	// CommitTimeout controls the time without an Apply() operation
	// before we heartbeat to ensure a timely commit. Due to random
	// staggering, may be delayed as much as 2x this value.
	CommitTimeout time.Duration `mapstructure:"commit_timeout"`

	// MaxAppendEntries controls the maximum number of append entries
	// to send at once. We want to strike a balance between efficiency
	// and avoiding waste if the follower is going to reject because of
	// an inconsistent log.
	MaxAppendEntries int `mapstructure:"max_append_entries"`

	// If we are a member of a cluster, and RemovePeer is invoked for the
	// local node, then we forget all peers and transition into the follower state.
	// If ShutdownOnRemove is is set, we additional shutdown Raft. Otherwise,
	// we can become a leader of a cluster containing only this node.
	ShutdownOnRemove bool `mapstructure:"shutdown_on_remove"`

	// TrailingLogs controls how many logs we leave after a snapshot. This is
	// used so that we can quickly replay logs on a follower instead of being
	// forced to send an entire snapshot.
	TrailingLogs uint64 `mapstructure:"trailing_logs"`

	// SnapshotInterval controls how often we check if we should perform a snapshot.
	// We randomly stagger between this value and 2x this value to avoid the entire
	// cluster from performing a snapshot at once.
	SnapshotInterval time.Duration `mapstructure:"snapshot_interval"`

	// SnapshotThreshold controls how many outstanding logs there must be before
	// we perform a snapshot. This is to prevent excessive snapshots when we can
	// just replay a small set of logs.
	SnapshotThreshold uint64 `mapstructure:"snapshot_threshold"`

	// LeaderLeaseTimeout is used to control how long the "lease" lasts
	// for being the leader without being able to contact a quorum
	// of nodes. If we reach this interval without contact, we will
	// step down as leader.
	LeaderLeaseTimeout time.Duration `mapstructure:"leader_lease_timeout"`

	// StartAsLeader forces Raft to start in the leader state. This should
	// never be used except for testing purposes, as it can cause a split-brain.
	StartAsLeader bool `mapstructure:"start_as_leader"`

	// The unique ID for this server across all time. When running with
	// ProtocolVersion < 3, you must set this to be the same as the network
	// address of your transport.
	LocalID _raft.ServerID `mapstructure:"server-id"`

	RaftDir     string `mapstructure:"dir"`
	SnapshotDir string `mapstructure:"snapshot-dir"`
	NodeAddr    string `mapstructure:"node-addr"`
}

RaftConfig contains the configuration of a Raft node

func DefaultRaftConfig

func DefaultRaftConfig() *RaftConfig

DefaultRaftConfig returns the default configuration for a Raft node

func (*RaftConfig) SetDataDir

func (c *RaftConfig) SetDataDir(datadir string)

SetDataDir updates the raft configuration directories if they were set to default values

type TmConfig

type TmConfig struct {
	DataDir    string `mapstructure:"datadir"`
	RealConfig *tmConfig.Config
}

func DefaultTmConfig

func DefaultTmConfig() *TmConfig

DefaultTmConfig returns the default configuration for a Babble node

func (*TmConfig) SetDataDir

func (c *TmConfig) SetDataDir(datadir string)

SetDataDir updates the tendermint configuration directories if they were set to to default values.

func (*TmConfig) ToRealTmConfig

func (c *TmConfig) ToRealTmConfig() *tmConfig.Config

ToRealTmConfig converts the config to real Tendermint config

Jump to

Keyboard shortcuts

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