netdeploy

package
v0.0.0-...-b259709 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplateFromReader

func LoadTemplateFromReader(reader io.Reader, template *NetworkTemplate) error

LoadTemplateFromReader loads and decodes a network template

Types

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network represents an instance of a deployed network

func CreateNetworkFromTemplate

func CreateNetworkFromTemplate(name, rootDir string, templateReader io.Reader, binDir string, importKeys bool, nodeExitCallback nodecontrol.AlgodExitErrorCallback, consensus config.ConsensusProtocols, overrideDevMode bool) (Network, error)

CreateNetworkFromTemplate uses the specified template to deploy a new private network under the specified root directory.

func LoadNetwork

func LoadNetwork(rootDir string) (Network, error)

LoadNetwork loads and initializes the Network state representing an existing deployed network.

func (Network) Delete

func (n Network) Delete(binDir string) error

Delete the network - try stopping it first if we can. No return code - we try to kill them if we can (if we read valid PID file)

func (Network) Genesis

func (n Network) Genesis() gen.GenesisData

Genesis returns the genesis data for this network

func (Network) GetGoalClient

func (n Network) GetGoalClient(binDir, nodeName string) (lg libgoal.Client, err error)

GetGoalClient returns the libgoal.Client for the specified node name

func (Network) GetNodeController

func (n Network) GetNodeController(binDir, nodeName string) (nc nodecontrol.NodeController, err error)

GetNodeController returns the node controller for the specified node name

func (Network) GetNodeDir

func (n Network) GetNodeDir(nodeName string) (string, error)

GetNodeDir returns the node directory that is associated with the given node name.

func (Network) GetPeerAddresses

func (n Network) GetPeerAddresses(binDir string) []string

GetPeerAddresses returns an array of Relay addresses, if any; to be used to start nodes outside of the main 'Start' call.

func (Network) Name

func (n Network) Name() string

Name returns the name of the private network

func (Network) NodeDataDirs

func (n Network) NodeDataDirs() []string

NodeDataDirs returns an array of node data directories (not the relays)

func (Network) NodesStatus

func (n Network) NodesStatus(binDir string) map[string]NetworkNodeStatus

NodesStatus retrieves the status of all nodes in the network and returns the status/error for each

func (Network) PrimaryDataDir

func (n Network) PrimaryDataDir() string

PrimaryDataDir returns the primary data directory for the network

func (Network) RelayDataDirs

func (n Network) RelayDataDirs() []string

RelayDataDirs returns an array of relay data directories (not the nodes)

func (Network) Save

func (n Network) Save(rootDir string) error

Save persists the network state in the root directory (in network.json)

func (Network) SetConsensus

func (n Network) SetConsensus(binDir string, consensus config.ConsensusProtocols) error

SetConsensus applies a new consensus settings which would get deployed before any of the nodes starts

func (Network) Start

func (n Network) Start(binDir string, redirectOutput bool) error

Start the network, ensuring primary relay starts first

func (Network) StartNode

func (n Network) StartNode(binDir, nodeDir string, redirectOutput bool) (err error)

StartNode can be called to start a node after the network has been started. It determines the correct PeerAddresses to use.

func (Network) Stop

func (n Network) Stop(binDir string)

Stop the network, ensuring primary relay stops first No return code - we try to kill them if we can (if we read valid PID file)

type NetworkCfg

type NetworkCfg struct {
	Name string `json:"Name,omitempty"`
	// RelayDirs are directories where relays live (where we check for connection IP:Port)
	// They are stored relative to root dir (e.g. "Primary")
	RelayDirs []string        `json:"RelayDirs,omitempty"`
	Template  NetworkTemplate `json:"Template,omitempty"` // Template file used to create the network
}

NetworkCfg contains the persisted configuration of the deployed network

type NetworkNodeStatus

type NetworkNodeStatus struct {
	Status model.NodeStatusResponse
	Error  error
}

NetworkNodeStatus represents the result from checking the status of a particular node instance

type NetworkTemplate

type NetworkTemplate struct {
	Genesis   gen.GenesisData
	Nodes     []remote.NodeConfigGoal
	Consensus config.ConsensusProtocols
}

NetworkTemplate represents the template used for creating private named networks

func (NetworkTemplate) Validate

func (t NetworkTemplate) Validate() error

Validate a specific network template to ensure it's rational, consistent, and complete

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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