Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStopped = errors.New("network stopped")
Functions ¶
func NewAvalancheGoGenesis ¶
func NewAvalancheGoGenesis( networkID uint32, xChainBalances []AddrAndBalance, cChainBalances []AddrAndBalance, genesisVdrs []ids.ShortID, ) ([]byte, error)
Return a genesis JSON where: The nodes in [genesisVdrs] are validators. The C-Chain and X-Chain balances are given by [cChainBalances] and [xChainBalances]. Note that many of the genesis fields (i.e. reward addresses) are randomly generated or hard-coded.
Types ¶
type AddrAndBalance ¶
AddrAndBalance holds both an address and its balance
type Backend ¶
type Backend byte
Backend is the type of network runner to use
func (Backend) MarshalJSON ¶
func (*Backend) UnmarshalJSON ¶
type Config ¶
type Config struct { // Must not be empty Genesis string `json:"genesis"` // May have length 0 // (i.e. network may have no nodes on creation.) NodeConfigs []node.Config `json:"nodeConfigs"` // Log level for the whole network LogLevel string `json:"logLevel"` // Name for the network Name string `json:"name"` // Backend specifies the backend for the network Backend Backend `json:"backend"` // Flags that will be passed to each node in this network. // It can be empty. // Config flags may also be passed in a node's config struct // or config file. // The precedence of flags handling is, from highest to lowest: // 1. Flags defined in a node's node.Config // 2. Flags defined in a network's network.Config // 3. Flags defined in a node's config file // For example, if a network.Config has flag W set to X, // and a node within that network has flag W set to Y, // and the node's config file has flag W set to Z, // then the node will be started with flag W set to Y. Flags map[string]interface{} `json:"flags"` }
Config that defines a network when it is created.
type Network ¶
type Network interface { // Returns a chan that is closed when // all the nodes in the network are healthy. // If an error is sent on this channel, at least 1 // node didn't become healthy before the timeout. // If an error isn't sent on the channel before it // closes, all the nodes are healthy. // A stopped network is considered unhealthy. // Timeout is given by the context parameter. Healthy(context.Context) chan error // Stop all the nodes. // Returns ErrStopped if Stop() was previously called. Stop(context.Context) error // Start a new node with the given config. // Returns ErrStopped if Stop() was previously called. AddNode(node.Config) (node.Node, error) // Stop the node with this name. // Returns ErrStopped if Stop() was previously called. RemoveNode(name string) error // Return the node with this name. // Returns ErrStopped if Stop() was previously called. GetNode(name string) (node.Node, error) // Return all the nodes in this network. // Node name --> Node. // Returns ErrStopped if Stop() was previously called. GetAllNodes() (map[string]node.Node, error) // Returns the names of all nodes in this network. // Returns ErrStopped if Stop() was previously called. GetNodeNames() ([]string, error) }
Network is an abstraction of an Avalanche network
Click to show internal directories.
Click to hide internal directories.