Documentation
¶
Index ¶
- Variables
- type BuildConfig
- type DeployedNetwork
- func (cfg DeployedNetwork) BuildNetworkFromTemplate(buildCfg BuildConfig, rootDir string) (err error)
- func (cfg DeployedNetwork) GenerateCloudTemplate(templates HostTemplates, targetFolder string) (err error)
- func (cfg *DeployedNetwork) SetUseExistingGenesisFiles(useExisting bool) bool
- func (cfg DeployedNetwork) Validate(buildCfg BuildConfig, rootDir string) (err error)
- func (cfg DeployedNetwork) ValidateTopology(templates HostTemplates) error
- type DeployedNetworkConfig
- func (cfg DeployedNetworkConfig) ResolveDeployedNetworkConfig(genesisDataFile string, topologyFile string) (resolved DeployedNetwork, err error)
- func (cfg DeployedNetworkConfig) SaveToDisk(rootDir string) (err error)
- func (cfg DeployedNetworkConfig) TryGetHostConfig(hostName string) (config HostConfig, found bool)
- type HostConfig
- type HostTemplates
- type NodeConfig
- type NodeWalletData
Constants ¶
This section is empty.
Variables ¶
var ErrDeployedNetworkInsufficientHosts = fmt.Errorf("target network requires more hosts than the topology provides")
ErrDeployedNetworkInsufficientHosts is returned by Validate if our target network requires more hosts than the topology provides
var ErrDeployedNetworkNameCantIncludeWildcard = fmt.Errorf("network name cannont include wild-cards")
ErrDeployedNetworkNameCantIncludeWildcard is returned by Validate if network name contains '*'
var ErrDeployedNetworkRootDirExists = fmt.Errorf("unable to generate deployed network files into existing directory")
ErrDeployedNetworkRootDirExists is returned by Validate if we're given a target folder that already exists
var ErrDeployedNetworkTokenError = fmt.Errorf("config file contains unrecognized token")
ErrDeployedNetworkTokenError is returned by InitDeployedNetworkConfig if the config file contains {{ or }} after token replacement
Functions ¶
This section is empty.
Types ¶
type BuildConfig ¶
type BuildConfig struct {
NetworkName string
NetworkPort string
NetworkPort2 string
NetworkPort3 string
NetworkPort4 string
APIEndpoint string
APIEndpoint2 string
APIEndpoint3 string
APIEndpoint4 string
APIToken string
EnableTelemetry bool
TelemetryURI string
MetricsURI string
RunAsService bool
CrontabSchedule string
EnableAlgoh bool
DashboardEndpoint string
}
BuildConfig is the configuration input for `netgoal build`, for actually processing templates
func LoadBuildConfig ¶
func LoadBuildConfig(file string) (cfg BuildConfig, err error)
LoadBuildConfig loads a BuildConfig structure from a json file
type DeployedNetwork ¶
type DeployedNetwork struct {
GenesisData gen.GenesisData
Topology topology
Hosts []HostConfig
// contains filtered or unexported fields
}
DeployedNetwork represents the complete configuration specification for a deployed network
func (DeployedNetwork) BuildNetworkFromTemplate ¶
func (cfg DeployedNetwork) BuildNetworkFromTemplate(buildCfg BuildConfig, rootDir string) (err error)
BuildNetworkFromTemplate uses the specified template to deploy a new private network under the specified root directory.
func (DeployedNetwork) GenerateCloudTemplate ¶
func (cfg DeployedNetwork) GenerateCloudTemplate(templates HostTemplates, targetFolder string) (err error)
GenerateCloudTemplate generates the Cloud Topology Template file that will be processed by the cloud provisioning toolchain.
func (*DeployedNetwork) SetUseExistingGenesisFiles ¶
func (cfg *DeployedNetwork) SetUseExistingGenesisFiles(useExisting bool) bool
SetUseExistingGenesisFiles sets the override flag indicating we should use existing genesis files instead of generating new ones. This is useful for permanent networks like devnet and testnet. Returns the previous value.
func (DeployedNetwork) Validate ¶
func (cfg DeployedNetwork) Validate(buildCfg BuildConfig, rootDir string) (err error)
Validate uses the specified template to deploy a new private network under the specified root directory.
func (DeployedNetwork) ValidateTopology ¶
func (cfg DeployedNetwork) ValidateTopology(templates HostTemplates) error
ValidateTopology reconciles the requested topology and the provided host templates and ensures all referenced host types are valid.
type DeployedNetworkConfig ¶
type DeployedNetworkConfig struct {
Hosts []HostConfig
}
DeployedNetworkConfig represents the complete configuration specification for a deployed network
func InitDeployedNetworkConfig ¶
func InitDeployedNetworkConfig(file string, buildConfig BuildConfig) (cfg DeployedNetworkConfig, err error)
InitDeployedNetworkConfig loads the DeployedNetworkConfig from a file
func LoadDeployedNetworkConfigFromDir ¶
func LoadDeployedNetworkConfigFromDir(rootDir string) (cfg DeployedNetworkConfig, err error)
LoadDeployedNetworkConfigFromDir loads a DeployedNetworkConfig from a directory
func (DeployedNetworkConfig) ResolveDeployedNetworkConfig ¶
func (cfg DeployedNetworkConfig) ResolveDeployedNetworkConfig(genesisDataFile string, topologyFile string) (resolved DeployedNetwork, err error)
ResolveDeployedNetworkConfig resolves the DeployedNetworkConfig and returns a DeployedNetwork with GenesisData and Topology structures instantiated.
func (DeployedNetworkConfig) SaveToDisk ¶
func (cfg DeployedNetworkConfig) SaveToDisk(rootDir string) (err error)
SaveToDisk allows writing the expanded template to disk - before we convert to DeployedNetworkConfig)
func (DeployedNetworkConfig) TryGetHostConfig ¶
func (cfg DeployedNetworkConfig) TryGetHostConfig(hostName string) (config HostConfig, found bool)
TryGetHostConfig tries to find and return the HostConfig for the specified hostName
type HostConfig ¶
type HostConfig struct {
Name string
Nodes []NodeConfig
}
HostConfig represents the configuration of a single deployed Host
type HostTemplates ¶
type HostTemplates struct {
Hosts map[string]cloudHost
}
HostTemplates contains a mapping (from name to cloudHost definition)
func LoadHostTemplates ¶
func LoadHostTemplates(templateFile string) (templates HostTemplates, err error)
LoadHostTemplates returns a HostTemplates object populated from the definitions in templateFile
type NodeConfig ¶
type NodeConfig struct {
Name string `json:",omitempty"`
Wallets []NodeWalletData
NetAddress string `json:",omitempty"`
APIEndpoint string `json:",omitempty"`
APIToken string `json:",omitempty"`
EnableTelemetry bool // Needs to also be configured host-wide (assign logging host name)
TelemetryURI string `json:",omitempty"` // Needs to be HostConfig
EnableMetrics bool // Needs to also be configured host-wide (register DNS entry)
MetricsURI string `json:",omitempty"`
EnableService bool
CronTabSchedule string `json:",omitempty"`
EnableBlockStats bool
DashboardEndpoint string `json:",omitempty"`
DeadlockOverride int `json:",omitempty"` // -1 = Disable deadlock detection, 0 = Use Default for build, 1 = Enable
ConfigJSONOverride string `json:",omitempty"` // Raw json to merge into config.json after other modifications are complete
// NodeNameMatchRegex is tested against Name in generated configs and if matched the rest of the configs in this record are applied as a template
NodeNameMatchRegex string `json:",omitempty"`
// FractionApply if > 0.0 is used as a probability of applying to generated nodes to use these values as a template
FractionApply float64 `json:",omitempty"`
// AltConfigs have other values for NodeNameMatchRegex or FractionApply. Typically the root NodeConfig is the default template and AltConfig contains variations that match some regex or are applied randomly to some fraction.
// This should not be used recursively, but only one deep, a root and a list of alt configs.
AltConfigs []NodeConfig `json:",omitempty"`
}
NodeConfig represents the configuration settings to apply to a single node running on a host
func (NodeConfig) IsRelay ¶
func (nc NodeConfig) IsRelay() bool
IsRelay returns true if the node is configured to be a relay
type NodeWalletData ¶
NodeWalletData represents a single wallet instance on a node