config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DelegateType represents the delegate node type
	DelegateType = "delegate"
	// FullNodeType represents the full node type
	FullNodeType = "full_node"
	// LightweightType represents the lightweight type
	LightweightType = "lightweight"
)
View Source
const (
	// DefaultConfigPath is the default config path
	DefaultConfigPath = "./config.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptPrevote

type AcceptPrevote struct {
	// TTL is the time the state machine will wait for the AcceptPrevote state.
	// Once timeout, it will move to the next state.
	TTL time.Duration
}

AcceptPrevote is the RDPoS AcceptPrevote config

type AcceptPropose

type AcceptPropose struct {
	// TTL is the time the state machine will wait for the AcceptPropose state.
	// Once timeout, it will move to the next state.
	TTL time.Duration
}

AcceptPropose is the RDPoS AcceptPropose config

type AcceptVote

type AcceptVote struct {
	// TTL is the time the state machine will wait for the AcceptVote state.
	// Once timeout, it will move to the next state.
	TTL time.Duration
}

AcceptVote is the RDPoS AcceptVote config

type Chain

type Chain struct {
	ChainDBPath string
	TotalSupply uint64
	BlockReward uint64

	// MinerAddr is an address where the block rewards will be sent to.
	MinerAddr string
}

Chain is the config struct for blockchain package

type Config

type Config struct {
	NodeType  string
	Network   Network
	Chain     Chain
	Consensus Consensus
	Delegate  Delegate
	RPC       RPC
}

Config is the root config struct, each package's config should be put as its sub struct

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the config instance from the default config path

func LoadConfigWithPath

func LoadConfigWithPath(path string) (*Config, error)

LoadConfigWithPath loads the config instance and validates fields

func LoadConfigWithPathWithoutValidation

func LoadConfigWithPathWithoutValidation(path string) (*Config, error)

LoadConfigWithPathWithoutValidation loads the config instance but doesn't validate fields

func (*Config) IsDelegate

func (cfg *Config) IsDelegate() bool

IsDelegate returns true if the node type is Delegate

func (*Config) IsFullnode

func (cfg *Config) IsFullnode() bool

IsFullnode returns true if the node type is Fullnode

func (*Config) IsLightweight

func (cfg *Config) IsLightweight() bool

IsLightweight returns true if the node type is Lightweight

type Consensus

type Consensus struct {
	// There are three schemes that are supported:
	// RDPOS -- Randomized Delegated Proof of Stake
	// STANDALONE -- The node creates a block periodically regardless of others (if there is any)
	// NOOP -- The node does not create only block
	Scheme                string
	RDPoS                 RDPoS
	BlockCreationInterval time.Duration
}

Consensus is the config struct for consensus package

type Delegate

type Delegate struct {
	Addrs []string
}

Delegate is the delegate config

type Network

type Network struct {
	Addr                    string
	MsgLogsCleaningInterval time.Duration
	MsgLogRetention         time.Duration
	HealthCheckInterval     time.Duration
	SilentInterval          time.Duration
	PeerMaintainerInterval  time.Duration
	AllowMultiConnsPerIP    bool
	NumPeersLowerBound      uint
	NumPeersUpperBound      uint
	PingInterval            time.Duration
	RateLimitEnabled        bool
	RateLimitPerSec         uint64
	RateLimitWindowSize     time.Duration
	BootstrapNodes          []string
	TLSEnabled              bool
	CACrtPath               string
	PeerCrtPath             string
	PeerKeyPath             string
	KLClientParams          keepalive.ClientParameters
	KLServerParams          keepalive.ServerParameters
	KLPolicy                keepalive.EnforcementPolicy
	MaxMsgSize              int
	PeerDiscovery           bool
	TopologyPath            string
}

Network is the config struct for network package

type ProposerRotation

type ProposerRotation struct {
	// Interval determines how long to propose another round of RDPoS.
	Interval time.Duration
	// Enabled flags whether we periodically rotate the proposer and trigger a new round of RDPoS
	Enabled bool
}

ProposerRotation is the RDPoS ProposerRotation config

type RDPoS

type RDPoS struct {
	ProposerRotation  ProposerRotation
	UnmatchedEventTTL time.Duration
	AcceptPropose     AcceptPropose
	AcceptPrevote     AcceptPrevote
	AcceptVote        AcceptVote
}

RDPoS is the config struct for RDPoS consensus package

type RPC

type RPC struct {
	Port string
}

RPC is the chain service config

type Topology

type Topology struct {
	NeighborList map[string][]string
}

Topology is the neighbor list for each node. This is used for generating the P2P network in a given topology. Note that the list contains the outgoing connections.

func LoadTopology

func LoadTopology(path string) (*Topology, error)

LoadTopology loads the topology struct from the given yaml file

Jump to

Keyboard shortcuts

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