Documentation
¶
Overview ¶
Package node is the main entry point, where the Node struct, which represents a full node, is defined.
Adding new p2p.Reactor(s)
To add a new p2p.Reactor, use the CustomReactors option:
node, err := NewNode(
config,
privVal,
nodeKey,
clientCreator,
genesisDocProvider,
dbProvider,
metricsProvider,
logger,
CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}),
)
Replacing existing p2p.Reactor(s)
To replace the built-in p2p.Reactor, use the CustomReactors option:
node, err := NewNode(
config,
privVal,
nodeKey,
clientCreator,
genesisDocProvider,
dbProvider,
metricsProvider,
logger,
CustomReactors(map[string]p2p.Reactor{"BLOCKSYNC": customBlocksyncReactor}),
)
The list of existing reactors can be found in CustomReactors documentation.
Index ¶
- type MetricsProvider
- type Node
- func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error)
- func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, ...) (*Node, error)
- func NewNodeWithContext(ctx context.Context, config *cfg.Config, privValidator types.PrivValidator, ...) (*Node, error)
- func (n *Node) Config() *cfg.Config
- func (n *Node) ConfigureRPC() (*rpccore.Environment, error)
- func (n *Node) IsListening() bool
- func (n *Node) Listeners() []string
- func (n *Node) NodeInfo() p2p.NodeInfo
- func (n *Node) OnStart() error
- func (n *Node) OnStop()
- func (n *Node) PrivValidator() types.PrivValidator
- func (n *Node) ProxyApp() proxy.AppConns
- func (n *Node) Switch() *p2p.Switch
- type Option
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsProvider ¶
MetricsProvider returns a consensus, p2p and mempool Metrics.
func DefaultMetricsProvider ¶
func DefaultMetricsProvider(config *cfg.InstrumentationConfig) MetricsProvider
DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.
type Node ¶
type Node struct {
service.BaseService
// contains filtered or unexported fields
}
Node is the highest level interface to a full PellDVS node. It includes all configuration information and running services.
func DefaultNewNode ¶
DefaultNewNode returns a PellDVS node with default settings for the It implements NodeProvider.
func NewNode ¶
func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, clientCreator proxy.ClientCreator, dbProvider cfg.DBProvider, aggregator aggtypes.Aggregator, dvsReader reader.DVSReader, metricsProvider MetricsProvider, logger log.Logger, options ...Option, ) (*Node, error)
NewNode returns a new, ready to go, PellDVS Node.
func NewNodeWithContext ¶
func NewNodeWithContext(ctx context.Context, config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, clientCreator proxy.ClientCreator, requestIndexDBProvider cfg.DBProvider, aggregator aggtypes.Aggregator, dvsReader reader.DVSReader, metricsProvider MetricsProvider, logger log.Logger, options ...Option, ) (*Node, error)
NewNodeWithContext is cancellable version of NewNode.
func (*Node) ConfigureRPC ¶
func (n *Node) ConfigureRPC() (*rpccore.Environment, error)
ConfigureRPC makes sure RPC has all the objects it needs to operate.
func (*Node) IsListening ¶
func (*Node) PrivValidator ¶
func (n *Node) PrivValidator() types.PrivValidator
PrivValidator returns the Node's PrivValidator. XXX: for convenience only!
type Option ¶
type Option func(*Node)
Option sets a parameter for the node.
func CustomReactors ¶
CustomReactors allows you to add custom reactors (name -> p2p.Reactor) to the node's Switch.
WARNING: using any name from the below list of the existing reactors will result in replacing it with the custom one.
- MEMPOOL
- BLOCKSYNC
- CONSENSUS
- EVIDENCE
- PEX
- STATESYNC