Documentation
¶
Overview ¶
Package application provides application context and configuration management.
Index ¶
- Constants
- type Downloader
- type LastActions
- type Lux
- func (app *Lux) AddDefaultBlockchainRPCsToSidecar(blockchainName string, network models.Network, nodeURIs []string) (bool, error)
- func (app *Lux) BlockchainConfigExists(blockchainName string) bool
- func (app *Lux) CaptureYesNo(prompt string) (bool, error)
- func (app *Lux) ChainConfigExists(subnetName string) bool
- func (app *Lux) ClustersConfigExists() bool
- func (app *Lux) ConfigFileExists() bool
- func (app *Lux) CopyGenesisFile(inputFilename string, subnetName string) error
- func (app *Lux) CopyKeyFile(inputFilename string, keyName string) error
- func (app *Lux) CopyVMBinary(inputFilename string, subnetName string) error
- func (app *Lux) CreateElasticChainConfig(subnetName string, es *models.ElasticChainConfig) error
- func (app *Lux) CreateSidecar(sc *models.Sidecar) error
- func (app *Lux) GenesisExists(subnetName string) bool
- func (app *Lux) GetAnsibleInventoryDirPath(clusterName string) string
- func (app *Lux) GetBaseDir() string
- func (app *Lux) GetBasePath() string
- func (app *Lux) GetBlockchainNamesOnNetwork(network models.Network, onlySOV bool) ([]string, error)
- func (app *Lux) GetChainConfigDir() string
- func (app *Lux) GetChainConfigPath(subnetName string) string
- func (app *Lux) GetChainsDir() string
- func (app *Lux) GetClusterConfig(clusterName string) (map[string]interface{}, error)
- func (app *Lux) GetClusterNetwork(clusterName string) (models.Network, error)
- func (app *Lux) GetConfigPath() string
- func (app *Lux) GetCurrentPluginsDir() string
- func (app *Lux) GetCustomVMDir() string
- func (app *Lux) GetCustomVMPath(subnetName string) string
- func (app *Lux) GetDevDir() string
- func (app *Lux) GetDownloader() Downloader
- func (app *Lux) GetEVMBinDir() string
- func (app *Lux) GetElasticChainConfigPath(subnetName string) string
- func (app *Lux) GetGenesisPath(subnetName string) string
- func (app *Lux) GetKey(keyName string) (string, error)
- func (app *Lux) GetKeyDir() string
- func (app *Lux) GetKeyPath(keyName string) string
- func (app *Lux) GetLPMBaseDir() string
- func (app *Lux) GetLPMLog() string
- func (app *Lux) GetLPMPluginDir() string
- func (app *Lux) GetLPMVMPath(vmid string) string
- func (app *Lux) GetLocalClusterDir(clusterName string) string
- func (app *Lux) GetLocalClustersDir() string
- func (app *Lux) GetLocalRelayerConfigPath() string
- func (app *Lux) GetLocalRelayerLogPath(network models.Network) string
- func (app *Lux) GetLocalRelayerRunPath(network models.Network) string
- func (app *Lux) GetLocalRelayerStorageDir(network models.Network) string
- func (app *Lux) GetLogDir() string
- func (app *Lux) GetLuxBinDir() string
- func (*Lux) GetLuxCompatibilityURL() string
- func (app *Lux) GetLuxdNodeConfigPath(subnetName string) string
- func (app *Lux) GetLuxdSubnetConfigPath(subnetName string) string
- func (app *Lux) GetLuxgoBinDir() string
- func (app *Lux) GetMonitoringInventoryDir(clusterName string) string
- func (app *Lux) GetNetDir() string
- func (app *Lux) GetNetworkFromSidecarNetworkName(name string) (models.Network, error)
- func (app *Lux) GetNetworkPluginsDir(networkType string) string
- func (app *Lux) GetNodesDir() string
- func (app *Lux) GetPerNodeBlockchainConfig(subnetName string) map[string]interface{}
- func (app *Lux) GetPluginsDir() string
- func (app *Lux) GetReposDir() string
- func (app *Lux) GetRunDir() string
- func (app *Lux) GetRunFile() string
- func (app *Lux) GetSidecarNames() ([]string, error)
- func (app *Lux) GetSidecarPath(subnetName string) string
- func (app *Lux) GetSnapshotPath(snapshotName string) string
- func (app *Lux) GetSnapshotsDir() string
- func (app *Lux) GetSubnetDir() string
- func (*Lux) GetTmpPluginDir() string
- func (app *Lux) GetTokenName(subnetName string) string
- func (app *Lux) GetUpgradeBytesFilePath(subnetName string) string
- func (app *Lux) GetUpgradeBytesFilepath(subnetName string) string
- func (app *Lux) GetVersion() string
- func (app *Lux) IsLocalNetworkRunning() bool
- func (app *Lux) IsPathProtected(path string) bool
- func (app *Lux) KeyExists(keyName string) bool
- func (app *Lux) ListClusterNames() ([]string, error)
- func (app *Lux) LoadClusterNodeConfig(clusterName string, nodeID string) (map[string]interface{}, error)
- func (app *Lux) LoadClustersConfig() (map[string]interface{}, error)
- func (app *Lux) LoadConfig() (types.Config, error)
- func (app *Lux) LoadElasticChainConfig(subnetName string) (models.ElasticChainConfig, error)
- func (app *Lux) LoadEvmGenesis(subnetName string) (core.Genesis, error)
- func (app *Lux) LoadRawChainConfig(subnetName string) ([]byte, error)
- func (app *Lux) LoadRawGenesis(subnetName string) ([]byte, error)
- func (app *Lux) LoadRawLuxdSubnetConfig(subnetName string) ([]byte, error)
- func (app *Lux) LoadRawNetworkUpgrades(subnetName string) ([]byte, error)
- func (app *Lux) LoadSidecar(subnetName string) (models.Sidecar, error)
- func (app *Lux) LuxdNodeConfigExists(subnetName string) bool
- func (app *Lux) LuxdSubnetConfigExists(subnetName string) bool
- func (app *Lux) NetworkUpgradeExists(subnetName string) bool
- func (app *Lux) ProtectedDirectories() []string
- func (app *Lux) ReadLastActionsFile() (*LastActions, error)
- func (app *Lux) ReadLockUpgradeFile(subnetName string) ([]byte, error)
- func (app *Lux) ReadUpgradeFile(subnetName string) ([]byte, error)
- func (app *Lux) ResetPluginsDir() error
- func (app *Lux) SafeRemoveAll(path string) error
- func (app *Lux) Setup(baseDir string, log luxlog.Logger, conf *config.Config, prompt Prompter, ...)
- func (app *Lux) SidecarExists(subnetName string) bool
- func (app *Lux) SubnetConfigExists(subnetName string) bool
- func (app *Lux) UpdateSidecar(sc *models.Sidecar) error
- func (app *Lux) UpdateSidecarElasticChain(sc *models.Sidecar, network models.Network, subnetID ids.ID, assetID ids.ID, ...) error
- func (app *Lux) UpdateSidecarElasticChainPartialTx(sc *models.Sidecar, network models.Network, txName string, txID ids.ID) error
- func (app *Lux) UpdateSidecarNetworks(sc *models.Sidecar, network models.Network, subnetID ids.ID, ...) error
- func (app *Lux) UpdateSidecarPermissionlessValidator(sc *models.Sidecar, network models.Network, nodeID string, txID ids.ID) error
- func (app *Lux) WriteConfigFile(data []byte) error
- func (app *Lux) WriteGenesisFile(subnetName string, genesisBytes []byte) error
- func (app *Lux) WriteLastActionsFile(acts *LastActions)
- func (app *Lux) WriteLockUpgradeFile(subnetName string, bytes []byte) error
- func (app *Lux) WriteSidecarFile(sc *models.Sidecar) error
- func (app *Lux) WriteUpgradeFile(subnetName string, bytes []byte) error
- type Prompter
Constants ¶
const (
WriteReadReadPerms = 0o644
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader interface {
Download(url string) ([]byte, error)
DownloadWithTee(url string, filePath string) ([]byte, error)
GetLatestReleaseVersion(releaseURL string) (string, error)
GetLatestPreReleaseVersion(releaseURL string) (string, error)
GetAllReleasesForRepo(org, repo string) ([]string, error)
}
Downloader is a generic interface for performing highly testable downloads. All methods here involve external http requests. To write tests using these functions, provide a mocked version of this interface to your application object.
func NewDownloader ¶
func NewDownloader() Downloader
type Lux ¶
type Lux struct {
Log luxlog.Logger
Conf *config.Config
Prompt Prompter
Lpm *lpm.Client
LpmDir string
Apm *lpm.Client // APM is similar to LPM
ApmDir func() string
Downloader Downloader
Cmd interface{} // Current command being executed (cobra.Command)
// contains filtered or unexported fields
}
func (*Lux) AddDefaultBlockchainRPCsToSidecar ¶
func (app *Lux) AddDefaultBlockchainRPCsToSidecar( blockchainName string, network models.Network, nodeURIs []string, ) (bool, error)
AddDefaultBlockchainRPCsToSidecar adds default RPC endpoints to sidecar
func (*Lux) BlockchainConfigExists ¶
BlockchainConfigExists checks if blockchain config exists This checks for the sidecar.json file which is always created by `blockchain create`
func (*Lux) CaptureYesNo ¶
CaptureYesNo delegates to the internal prompt
func (*Lux) ChainConfigExists ¶
ChainConfigExists checks if chain config exists
func (*Lux) ClustersConfigExists ¶
ClustersConfigExists checks if clusters config exists
func (*Lux) ConfigFileExists ¶
func (*Lux) CopyGenesisFile ¶
func (*Lux) CopyVMBinary ¶
func (*Lux) CreateElasticChainConfig ¶ added in v1.3.8
func (app *Lux) CreateElasticChainConfig(subnetName string, es *models.ElasticChainConfig) error
func (*Lux) GenesisExists ¶
func (*Lux) GetAnsibleInventoryDirPath ¶
GetAnsibleInventoryDirPath returns the ansible inventory directory path
func (*Lux) GetBaseDir ¶
func (*Lux) GetBasePath ¶
GetBasePath returns the base directory path for the CLI
func (*Lux) GetBlockchainNamesOnNetwork ¶
GetBlockchainNamesOnNetwork returns blockchain names deployed on a network
func (*Lux) GetChainConfigDir ¶ added in v1.16.38
GetChainConfigDir returns the chain config directory for luxd's --chain-config-dir This is the same as GetChainsDir - chain configs live alongside chain definitions
func (*Lux) GetChainConfigPath ¶
GetChainConfigPath returns the chain config path for a subnet
func (*Lux) GetChainsDir ¶ added in v1.3.8
func (*Lux) GetClusterConfig ¶
GetClusterConfig returns cluster configuration
func (*Lux) GetClusterNetwork ¶
GetClusterNetwork returns the network for a given cluster
func (*Lux) GetConfigPath ¶
GetConfigPath returns the SDK config file path (~/.lux/sdk.json) Note: CLI should override this to return ~/.lux/cli.json
func (*Lux) GetCurrentPluginsDir ¶ added in v1.3.8
GetCurrentPluginsDir returns the directory for active plugin symlinks Plugins are linked at ~/.lux/plugins/current/<vmid> DEPRECATED: Use GetNetworkPluginsDir for network-isolated plugins
func (*Lux) GetCustomVMDir ¶
func (*Lux) GetCustomVMPath ¶
func (*Lux) GetDevDir ¶ added in v1.16.38
GetDevDir returns the dev mode data directory (~/.lux/dev/)
func (*Lux) GetDownloader ¶
func (app *Lux) GetDownloader() Downloader
func (*Lux) GetEVMBinDir ¶
func (*Lux) GetElasticChainConfigPath ¶ added in v1.3.8
func (*Lux) GetGenesisPath ¶
func (*Lux) GetKeyPath ¶
func (*Lux) GetLPMBaseDir ¶
func (*Lux) GetLPMPluginDir ¶
func (*Lux) GetLPMVMPath ¶
func (*Lux) GetLocalClusterDir ¶
GetLocalClusterDir returns the directory for a specific local cluster
func (*Lux) GetLocalClustersDir ¶
GetLocalClustersDir returns the directory for local clusters
func (*Lux) GetLocalRelayerConfigPath ¶
GetLocalRelayerConfigPath returns the path for local relayer config
func (*Lux) GetLocalRelayerLogPath ¶
GetLocalRelayerLogPath returns the path to the relayer log file
func (*Lux) GetLocalRelayerRunPath ¶
GetLocalRelayerRunPath returns the path to the relayer run file
func (*Lux) GetLocalRelayerStorageDir ¶
GetLocalRelayerStorageDir returns the path to the relayer storage directory
func (*Lux) GetLuxBinDir ¶
func (*Lux) GetLuxCompatibilityURL ¶
func (*Lux) GetLuxdNodeConfigPath ¶
GetLuxdNodeConfigPath returns the node config path for a subnet
func (*Lux) GetLuxdSubnetConfigPath ¶
GetLuxdSubnetConfigPath returns the luxd subnet config path for a subnet
func (*Lux) GetLuxgoBinDir ¶
func (*Lux) GetMonitoringInventoryDir ¶
GetMonitoringInventoryDir returns the monitoring inventory directory path
func (*Lux) GetNetworkFromSidecarNetworkName ¶
GetNetworkFromSidecarNetworkName returns the network from sidecar network name
func (*Lux) GetNetworkPluginsDir ¶ added in v1.3.8
GetNetworkPluginsDir returns the network-specific plugin directory Each network (mainnet, testnet, devnet, custom) has isolated plugins to prevent interference between different networks. Returns ~/.lux/plugins/{mainnet,testnet,devnet,custom}/
func (*Lux) GetNodesDir ¶
GetNodesDir returns the nodes directory path
func (*Lux) GetPerNodeBlockchainConfig ¶
GetPerNodeBlockchainConfig returns per-node blockchain config
func (*Lux) GetPluginsDir ¶
func (*Lux) GetReposDir ¶
func (*Lux) GetRunFile ¶
func (*Lux) GetSidecarNames ¶
func (*Lux) GetSidecarPath ¶
func (*Lux) GetSnapshotPath ¶
GetSnapshotPath returns the path to a snapshot
func (*Lux) GetSnapshotsDir ¶
func (*Lux) GetSubnetDir ¶
GetSubnetDir is deprecated, use GetChainsDir instead
func (*Lux) GetTmpPluginDir ¶
func (*Lux) GetTokenName ¶
func (*Lux) GetUpgradeBytesFilePath ¶
func (*Lux) GetUpgradeBytesFilepath ¶
func (*Lux) GetVersion ¶
func (*Lux) IsLocalNetworkRunning ¶
func (*Lux) IsPathProtected ¶ added in v1.16.38
IsPathProtected checks if a path is protected or would delete a protected directory
func (*Lux) ListClusterNames ¶
ListClusterNames returns a list of cluster names
func (*Lux) LoadClusterNodeConfig ¶
func (app *Lux) LoadClusterNodeConfig(clusterName string, nodeID string) (map[string]interface{}, error)
LoadClusterNodeConfig loads node configuration for a cluster
func (*Lux) LoadClustersConfig ¶
LoadClustersConfig loads the clusters configuration
func (*Lux) LoadElasticChainConfig ¶ added in v1.3.8
func (app *Lux) LoadElasticChainConfig(subnetName string) (models.ElasticChainConfig, error)
func (*Lux) LoadEvmGenesis ¶
func (*Lux) LoadRawChainConfig ¶
LoadRawChainConfig loads raw chain config
func (*Lux) LoadRawLuxdSubnetConfig ¶
LoadRawLuxdSubnetConfig loads raw subnet config
func (*Lux) LoadRawNetworkUpgrades ¶
LoadRawNetworkUpgrades loads raw network upgrades
func (*Lux) LuxdNodeConfigExists ¶
LuxdNodeConfigExists checks if luxd node config exists
func (*Lux) LuxdSubnetConfigExists ¶
LuxdSubnetConfigExists checks if subnet config exists
func (*Lux) NetworkUpgradeExists ¶
NetworkUpgradeExists checks if network upgrade file exists
func (*Lux) ProtectedDirectories ¶ added in v1.16.38
ProtectedDirectories returns the list of directories that should NEVER be deleted These contain user-created chain configurations that are NOT ephemeral
func (*Lux) ReadLastActionsFile ¶
func (app *Lux) ReadLastActionsFile() (*LastActions, error)
func (*Lux) ReadLockUpgradeFile ¶
func (*Lux) ResetPluginsDir ¶
ResetPluginsDir resets the plugins directory and creates the current/ subdirectory
func (*Lux) SafeRemoveAll ¶ added in v1.16.38
SafeRemoveAll wraps os.RemoveAll with safety checks to prevent accidental deletion of protected directories. Returns an error if the path would delete a protected directory.
func (*Lux) SidecarExists ¶
func (*Lux) SubnetConfigExists ¶
func (*Lux) UpdateSidecarElasticChain ¶ added in v1.3.8
func (*Lux) UpdateSidecarElasticChainPartialTx ¶ added in v1.3.8
func (*Lux) UpdateSidecarNetworks ¶
func (*Lux) UpdateSidecarPermissionlessValidator ¶
func (*Lux) WriteConfigFile ¶
func (*Lux) WriteGenesisFile ¶
func (*Lux) WriteLastActionsFile ¶
func (app *Lux) WriteLastActionsFile(acts *LastActions)