config

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 8 Imported by: 2,232

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogLevel

func DefaultLogLevel() string

DefaultLogLevel returns a default log level of "error"

func DefaultPackageLogLevels

func DefaultPackageLogLevels() string

DefaultPackageLogLevels returns a default log level setting so all packages log at "error", while the `state` package logs at "info"

func EnsureRoot

func EnsureRoot(rootDir string)

Types

type BaseConfig

type BaseConfig struct {
	// The root directory for all data.
	// This should be set in viper so it can unmarshal into this struct
	RootDir string `mapstructure:"home"`

	// The ID of the chain to join (should be signed with every transaction and vote)
	ChainID string `mapstructure:"chain_id"`

	// A JSON file containing the initial validator set and other meta data
	Genesis string `mapstructure:"genesis_file"`

	// A JSON file containing the private key to use as a validator in the consensus protocol
	PrivValidator string `mapstructure:"priv_validator_file"`

	// A custom human readable name for this node
	Moniker string `mapstructure:"moniker"`

	// TCP or UNIX socket address of the ABCI application,
	// or the name of an ABCI application compiled in with the Tendermint binary
	ProxyApp string `mapstructure:"proxy_app"`

	// Mechanism to connect to the ABCI application: socket | grpc
	ABCI string `mapstructure:"abci"`

	// Output level for logging
	LogLevel string `mapstructure:"log_level"`

	// TCP or UNIX socket address for the profiling server to listen on
	ProfListenAddress string `mapstructure:"prof_laddr"`

	// If this node is many blocks behind the tip of the chain, FastSync
	// allows them to catchup quickly by downloading blocks in parallel
	// and verifying their commits
	FastSync bool `mapstructure:"fast_sync"`

	// If true, query the ABCI app on connecting to a new peer
	// so the app can decide if we should keep the connection or not
	FilterPeers bool `mapstructure:"filter_peers"` // false

	// What indexer to use for transactions
	TxIndex string `mapstructure:"tx_index"`

	// Database backend: leveldb | memdb
	DBBackend string `mapstructure:"db_backend"`

	// Database directory
	DBPath string `mapstructure:"db_dir"`
}

BaseConfig defines the base configuration for a Tendermint node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns a default base configuration for a Tendermint node

func TestBaseConfig

func TestBaseConfig() BaseConfig

TestBaseConfig returns a base configuration for testing a Tendermint node

func (BaseConfig) DBDir

func (b BaseConfig) DBDir() string

DBDir returns the full path to the database directory

func (BaseConfig) GenesisFile

func (b BaseConfig) GenesisFile() string

GenesisFile returns the full path to the genesis.json file

func (BaseConfig) PrivValidatorFile added in v0.10.0

func (b BaseConfig) PrivValidatorFile() string

PrivValidatorFile returns the full path to the priv_validator.json file

type Config

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

	// Options for services
	RPC       *RPCConfig       `mapstructure:"rpc"`
	P2P       *P2PConfig       `mapstructure:"p2p"`
	Mempool   *MempoolConfig   `mapstructure:"mempool"`
	Consensus *ConsensusConfig `mapstructure:"consensus"`
}

Config defines the top level configuration for a Tendermint node

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration for a Tendermint node

func ResetTestRoot

func ResetTestRoot(testName string) *Config

func TestConfig

func TestConfig() *Config

TestConfig returns a configuration that can be used for testing

func (*Config) SetRoot

func (cfg *Config) SetRoot(root string) *Config

SetRoot sets the RootDir for all Config structs

type ConsensusConfig

type ConsensusConfig struct {
	RootDir  string `mapstructure:"home"`
	WalPath  string `mapstructure:"wal_file"`
	WalLight bool   `mapstructure:"wal_light"`

	// All timeouts are in ms
	TimeoutPropose        int `mapstructure:"timeout_propose"`
	TimeoutProposeDelta   int `mapstructure:"timeout_propose_delta"`
	TimeoutPrevote        int `mapstructure:"timeout_prevote"`
	TimeoutPrevoteDelta   int `mapstructure:"timeout_prevote_delta"`
	TimeoutPrecommit      int `mapstructure:"timeout_precommit"`
	TimeoutPrecommitDelta int `mapstructure:"timeout_precommit_delta"`
	TimeoutCommit         int `mapstructure:"timeout_commit"`

	// Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
	SkipTimeoutCommit bool `mapstructure:"skip_timeout_commit"`

	// BlockSize
	MaxBlockSizeTxs   int `mapstructure:"max_block_size_txs"`
	MaxBlockSizeBytes int `mapstructure:"max_block_size_bytes"`

	// EmptyBlocks mode and possible interval between empty blocks in seconds
	CreateEmptyBlocks         bool `mapstructure:"create_empty_blocks"`
	CreateEmptyBlocksInterval int  `mapstructure:"create_empty_blocks_interval"`

	// TODO: This probably shouldn't be exposed but it makes it
	// easy to write tests for the wal/replay
	BlockPartSize int `mapstructure:"block_part_size"`

	// Reactor sleep duration parameters are in ms
	PeerGossipSleepDuration     int `mapstructure:"peer_gossip_sleep_duration"`
	PeerQueryMaj23SleepDuration int `mapstructure:"peer_query_maj23_sleep_duration"`
	// contains filtered or unexported fields
}

ConsensusConfig defines the confuguration for the Tendermint consensus service, including timeouts and details about the WAL and the block structure.

func DefaultConsensusConfig

func DefaultConsensusConfig() *ConsensusConfig

DefaultConsensusConfig returns a default configuration for the consensus service

func TestConsensusConfig

func TestConsensusConfig() *ConsensusConfig

TestConsensusConfig returns a configuration for testing the consensus service

func (*ConsensusConfig) Commit

func (cfg *ConsensusConfig) Commit(t time.Time) time.Time

Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits for a single block (ie. a commit).

func (*ConsensusConfig) EmptyBlocksInterval added in v0.10.3

func (cfg *ConsensusConfig) EmptyBlocksInterval() time.Duration

EmptyBlocks returns the amount of time to wait before proposing an empty block or starting the propose timer if there are no txs available

func (*ConsensusConfig) PeerGossipSleep added in v0.10.2

func (cfg *ConsensusConfig) PeerGossipSleep() time.Duration

PeerGossipSleep returns the amount of time to sleep if there is nothing to send from the ConsensusReactor

func (*ConsensusConfig) PeerQueryMaj23Sleep added in v0.10.2

func (cfg *ConsensusConfig) PeerQueryMaj23Sleep() time.Duration

PeerQueryMaj23Sleep returns the amount of time to sleep after each VoteSetMaj23Message is sent in the ConsensusReactor

func (*ConsensusConfig) Precommit

func (cfg *ConsensusConfig) Precommit(round int) time.Duration

Precommit returns the amount of time to wait for straggler votes after receiving any +2/3 precommits

func (*ConsensusConfig) Prevote

func (cfg *ConsensusConfig) Prevote(round int) time.Duration

Prevote returns the amount of time to wait for straggler votes after receiving any +2/3 prevotes

func (*ConsensusConfig) Propose

func (cfg *ConsensusConfig) Propose(round int) time.Duration

Propose returns the amount of time to wait for a proposal

func (*ConsensusConfig) SetWalFile

func (c *ConsensusConfig) SetWalFile(walFile string)

SetWalFile sets the path to the write-ahead log file

func (*ConsensusConfig) WaitForTxs

func (cfg *ConsensusConfig) WaitForTxs() bool

WaitForTxs returns true if the consensus should wait for transactions before entering the propose step

func (*ConsensusConfig) WalFile

func (c *ConsensusConfig) WalFile() string

WalFile returns the full path to the write-ahead log file

type MempoolConfig

type MempoolConfig struct {
	RootDir      string `mapstructure:"home"`
	Recheck      bool   `mapstructure:"recheck"`
	RecheckEmpty bool   `mapstructure:"recheck_empty"`
	Broadcast    bool   `mapstructure:"broadcast"`
	WalPath      string `mapstructure:"wal_dir"`
}

MempoolConfig defines the configuration options for the Tendermint mempool

func DefaultMempoolConfig

func DefaultMempoolConfig() *MempoolConfig

DefaultMempoolConfig returns a default configuration for the Tendermint mempool

func (*MempoolConfig) WalDir

func (m *MempoolConfig) WalDir() string

WalDir returns the full path to the mempool's write-ahead log

type P2PConfig

type P2PConfig struct {
	RootDir string `mapstructure:"home"`

	// Address to listen for incoming connections
	ListenAddress string `mapstructure:"laddr"`

	// Comma separated list of seed nodes to connect to
	Seeds string `mapstructure:"seeds"`

	// Skip UPNP port forwarding
	SkipUPNP bool `mapstructure:"skip_upnp"`

	// Path to address book
	AddrBook string `mapstructure:"addr_book_file"`

	// Set true for strict address routability rules
	AddrBookStrict bool `mapstructure:"addr_book_strict"`

	// Set true to enable the peer-exchange reactor
	PexReactor bool `mapstructure:"pex"`

	// Maximum number of peers to connect to
	MaxNumPeers int `mapstructure:"max_num_peers"`

	// Time to wait before flushing messages out on the connection. In ms
	FlushThrottleTimeout int `mapstructure:"flush_throttle_timeout"`
}

P2PConfig defines the configuration options for the Tendermint peer-to-peer networking layer

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

DefaultP2PConfig returns a default configuration for the peer-to-peer layer

func TestP2PConfig

func TestP2PConfig() *P2PConfig

TestP2PConfig returns a configuration for testing the peer-to-peer layer

func (*P2PConfig) AddrBookFile

func (p *P2PConfig) AddrBookFile() string

AddrBookFile returns the full path to the address bool

type RPCConfig

type RPCConfig struct {
	RootDir string `mapstructure:"home"`

	// TCP or UNIX socket address for the RPC server to listen on
	ListenAddress string `mapstructure:"laddr"`

	// TCP or UNIX socket address for the gRPC server to listen on
	// NOTE: This server only supports /broadcast_tx_commit
	GRPCListenAddress string `mapstructure:"grpc_laddr"`

	// Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
	Unsafe bool `mapstructure:"unsafe"`
}

RPCConfig defines the configuration options for the Tendermint RPC server

func DefaultRPCConfig

func DefaultRPCConfig() *RPCConfig

DefaultRPCConfig returns a default configuration for the RPC server

func TestRPCConfig

func TestRPCConfig() *RPCConfig

TestRPCConfig returns a configuration for testing the RPC server

Jump to

Keyboard shortcuts

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