node

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MainNode = Node{}

MainNode is the reference for node callbacks

Functions

This section is empty.

Types

type Config

type Config struct {
	// protocol to use for opening the network interface
	Nat nat.Router

	// ID of the network this node should connect to
	NetworkID uint32

	// Transaction fee configuration
	AvaTxFee uint64

	// Assertions configuration
	EnableAssertions bool

	// Crypto configuration
	EnableCrypto bool

	// Database to use for the node
	DB database.Database

	// Staking configuration
	StakingIP       utils.IPDesc
	EnableStaking   bool
	StakingKeyFile  string
	StakingCertFile string

	// Bootstrapping configuration
	BootstrapPeers []*Peer

	// HTTP configuration
	HTTPPort      uint16
	EnableHTTPS   bool
	HTTPSKeyFile  string
	HTTPSCertFile string

	// Enable/Disable APIs
	AdminAPIEnabled    bool
	KeystoreAPIEnabled bool
	MetricsAPIEnabled  bool

	// Logging configuration
	LoggingConfig logging.Config

	// Plugin directory
	PluginDir string

	// Consensus configuration
	ConsensusParams avalanche.Parameters

	// Throughput configuration
	ThroughputPort          uint16
	ThroughputServerEnabled bool

	// IPCEnabled configuration
	IPCEnabled bool

	// Router that is used to handle incoming consensus messages
	ConsensusRouter router.Router
}

Config contains all of the configurations of an Ava node.

type Node

type Node struct {
	Log        logging.Logger
	LogFactory logging.Factory
	HTTPLog    logging.Logger

	// This node's unique ID used when communicating with other nodes
	// (in consensus, for example)
	ID ids.ShortID

	// Storage for this node
	DB database.Database

	// dispatcher for events as they happen in consensus
	DecisionDispatcher  *triggers.EventDispatcher
	ConsensusDispatcher *triggers.EventDispatcher

	// Event loop manager
	EC salticidae.EventContext
	// Network that manages validator peers
	PeerNet salticidae.PeerNetwork
	// Network that manages clients
	ClientNet salticidae.MsgNetwork // TODO: Remove

	// API that handles new connections
	ValidatorAPI *networking.Handshake
	// API that handles voting messages
	ConsensusAPI *networking.Voting

	// APIs that handle client messages
	// TODO: Remove
	Issuer     *xputtest.Issuer
	CClientAPI *xputtest.CClient

	// Handles HTTP API calls
	APIServer api.Server

	// This node's configuration
	Config *Config
	// contains filtered or unexported fields
}

Node is an instance of an Ava node.

func (*Node) Dispatch

func (n *Node) Dispatch()

Dispatch starts the node's servers. Returns when the node exits.

func (*Node) Initialize

func (n *Node) Initialize(Config *Config, logger logging.Logger, logFactory logging.Factory) error

Initialize this node

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown this node

func (*Node) StartConsensusServer

func (n *Node) StartConsensusServer() error

StartConsensusServer starts the P2P server this node uses to communicate with other nodes

type Peer

type Peer struct {
	// IP of the peer
	IP utils.IPDesc
	// ID of the peer that can be verified during a handshake
	ID ids.ShortID
}

Peer contains the specification of an Ava node that can be communicated with.

Jump to

Keyboard shortcuts

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