Documentation
¶
Index ¶
- func LoadTemplateFromReader(reader io.Reader, template *NetworkTemplate) error
- func OverrideDevMode(template *NetworkTemplate)
- type Network
- func (n Network) Delete(binDir string) error
- func (n Network) Genesis() gen.GenesisData
- func (n Network) GetGoalClient(binDir, nodeName string) (lg libgoal.Client, err error)
- func (n Network) GetNodeController(binDir, nodeName string) (nc nodecontrol.NodeController, err error)
- func (n Network) GetNodeDir(nodeName string) (string, error)
- func (n Network) GetPeerAddresses(binDir string) []string
- func (n Network) Name() string
- func (n Network) NodeDataDirs() []string
- func (n Network) NodesStatus(binDir string) map[string]NetworkNodeStatus
- func (n Network) PrimaryDataDir() string
- func (n Network) RelayDataDirs() []string
- func (n Network) Save(rootDir string) error
- func (n Network) SetConsensus(binDir string, consensus config.ConsensusProtocols) error
- func (n Network) Start(binDir string, redirectOutput bool) error
- func (n Network) StartNode(binDir, nodeDir string, redirectOutput bool) (err error)
- func (n Network) Stop(binDir string) (err error)
- type NetworkCfg
- type NetworkNodeStatus
- type NetworkTemplate
- type TemplateKMDConfig
- type TemplateOverride
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
func OverrideDevMode ¶
func OverrideDevMode(template *NetworkTemplate)
OverrideDevMode turns on dev mode, regardless of whether the json says so.
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, overrides ...TemplateOverride) (Network, error)
CreateNetworkFromTemplate uses the specified template to deploy a new private network under the specified root directory.
func LoadNetwork ¶
LoadNetwork loads and initializes the Network state representing an existing deployed network.
func (Network) Delete ¶
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 ¶
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 ¶
GetNodeDir returns the node directory that is associated with the given node name.
func (Network) GetPeerAddresses ¶
GetPeerAddresses returns an array of Relay addresses, if any; to be used to start nodes outside of the main 'Start' call.
func (Network) NodeDataDirs ¶
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 ¶
PrimaryDataDir returns the primary data directory for the network
func (Network) RelayDataDirs ¶
RelayDataDirs returns an array of relay data directories (not the nodes)
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
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 // contains filtered or unexported fields }
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
type TemplateKMDConfig ¶
type TemplateKMDConfig struct {
SessionLifetimeSecs uint64
}
TemplateKMDConfig is a subset of the kmd configuration that can be overridden in the network template by using OverrideKmdConfig TemplateOverride opts. The reason why config.KMDConfig cannot be used directly is that it contains DataDir field which is is not known until the template instantiation.
type TemplateOverride ¶
type TemplateOverride func(*NetworkTemplate)
TemplateOverride is a function that modifies the NetworkTemplate after it is read in.
func OverrideConsensusVersion ¶
func OverrideConsensusVersion(ver protocol.ConsensusVersion) TemplateOverride
OverrideConsensusVersion changes the protocol version of a template.
func OverrideKmdConfig ¶
func OverrideKmdConfig(kmdConfig TemplateKMDConfig) TemplateOverride
OverrideKmdConfig changes the KMD config.