application

package
v1.13.5-lux.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Copyright (C) 2022, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2023, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

View Source
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)
}

This 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 LastActions

type LastActions struct {
	LastSkipCheck time.Time
	LastUpdated   time.Time
}

type Lux

type Lux struct {
	Log luxlog.Logger

	Conf       *config.Config
	Prompt     prompts.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 New

func New() *Lux

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

func (app *Lux) BlockchainConfigExists(blockchainName string) bool

BlockchainConfigExists checks if blockchain config exists

func (*Lux) CaptureYesNo added in v1.8.15

func (app *Lux) CaptureYesNo(prompt string) (bool, error)

CaptureYesNo delegates to the internal prompt

func (*Lux) ChainConfigExists

func (app *Lux) ChainConfigExists(subnetName string) bool

ChainConfigExists checks if chain config exists

func (*Lux) ClustersConfigExists

func (app *Lux) ClustersConfigExists() bool

ClustersConfigExists checks if clusters config exists

func (*Lux) ConfigFileExists

func (app *Lux) ConfigFileExists() bool

func (*Lux) CopyGenesisFile added in v1.7.9

func (app *Lux) CopyGenesisFile(inputFilename string, subnetName string) error

func (*Lux) CopyKeyFile added in v1.7.9

func (app *Lux) CopyKeyFile(inputFilename string, keyName string) error

func (*Lux) CopyVMBinary added in v1.7.9

func (app *Lux) CopyVMBinary(inputFilename string, subnetName string) error

func (*Lux) CreateElasticSubnetConfig added in v1.7.9

func (app *Lux) CreateElasticSubnetConfig(subnetName string, es *models.ElasticSubnetConfig) error

func (*Lux) CreateSidecar added in v1.7.9

func (app *Lux) CreateSidecar(sc *models.Sidecar) error

func (*Lux) GenesisExists added in v1.7.9

func (app *Lux) GenesisExists(subnetName string) bool

func (*Lux) GetAnsibleInventoryDirPath

func (app *Lux) GetAnsibleInventoryDirPath(clusterName string) string

GetAnsibleInventoryDirPath returns the ansible inventory directory path

func (*Lux) GetBaseDir added in v1.7.9

func (app *Lux) GetBaseDir() string

func (*Lux) GetBasePath

func (app *Lux) GetBasePath() string

GetBasePath returns the base directory path for the CLI

func (*Lux) GetBlockchainNamesOnNetwork

func (app *Lux) GetBlockchainNamesOnNetwork(network models.Network, onlySOV bool) ([]string, error)

GetBlockchainNamesOnNetwork returns blockchain names deployed on a network

func (*Lux) GetChainConfigPath

func (app *Lux) GetChainConfigPath(subnetName string) string

GetChainConfigPath returns the chain config path for a subnet

func (*Lux) GetClusterConfig

func (app *Lux) GetClusterConfig(clusterName string) (map[string]interface{}, error)

GetClusterConfig returns cluster configuration

func (*Lux) GetClusterNetwork

func (app *Lux) GetClusterNetwork(clusterName string) (models.Network, error)

GetClusterNetwork returns the network for a given cluster

func (*Lux) GetConfigPath added in v1.7.9

func (app *Lux) GetConfigPath() string

func (*Lux) GetCustomVMDir added in v1.7.9

func (app *Lux) GetCustomVMDir() string

func (*Lux) GetCustomVMPath added in v1.7.9

func (app *Lux) GetCustomVMPath(subnetName string) string

func (*Lux) GetDownloader added in v1.7.9

func (app *Lux) GetDownloader() Downloader

func (*Lux) GetEVMBinDir

func (app *Lux) GetEVMBinDir() string

func (*Lux) GetElasticSubnetConfigPath added in v1.7.9

func (app *Lux) GetElasticSubnetConfigPath(subnetName string) string

func (*Lux) GetGenesisPath added in v1.7.9

func (app *Lux) GetGenesisPath(subnetName string) string

func (*Lux) GetKey

func (app *Lux) GetKey(keyName string) (string, error)

GetKey returns the key for a given name

func (*Lux) GetKeyDir added in v1.7.9

func (app *Lux) GetKeyDir() string

func (*Lux) GetKeyPath added in v1.7.9

func (app *Lux) GetKeyPath(keyName string) string

func (*Lux) GetLPMBaseDir added in v1.7.9

func (app *Lux) GetLPMBaseDir() string

func (*Lux) GetLPMLog added in v1.7.9

func (app *Lux) GetLPMLog() string

func (*Lux) GetLPMPluginDir added in v1.7.9

func (app *Lux) GetLPMPluginDir() string

func (*Lux) GetLPMVMPath added in v1.7.9

func (app *Lux) GetLPMVMPath(vmid string) string

func (*Lux) GetLocalClusterDir

func (app *Lux) GetLocalClusterDir(clusterName string) string

GetLocalClusterDir returns the directory for a specific local cluster

func (*Lux) GetLocalClustersDir

func (app *Lux) GetLocalClustersDir() string

GetLocalClustersDir returns the directory for local clusters

func (*Lux) GetLocalRelayerConfigPath

func (app *Lux) GetLocalRelayerConfigPath() string

GetLocalRelayerConfigPath returns the path for local relayer config

func (*Lux) GetLocalRelayerLogPath

func (app *Lux) GetLocalRelayerLogPath(network models.Network) string

GetLocalRelayerLogPath returns the path to the relayer log file

func (*Lux) GetLocalRelayerRunPath

func (app *Lux) GetLocalRelayerRunPath(network models.Network) string

GetLocalRelayerRunPath returns the path to the relayer run file

func (*Lux) GetLocalRelayerStorageDir

func (app *Lux) GetLocalRelayerStorageDir(network models.Network) string

GetLocalRelayerStorageDir returns the path to the relayer storage directory

func (*Lux) GetLogDir

func (app *Lux) GetLogDir() string

GetLogDir returns the log directory path

func (*Lux) GetLuxBinDir

func (app *Lux) GetLuxBinDir() string

func (*Lux) GetLuxCompatibilityURL

func (*Lux) GetLuxCompatibilityURL() string

func (*Lux) GetLuxdNodeConfigPath

func (app *Lux) GetLuxdNodeConfigPath(subnetName string) string

GetLuxdNodeConfigPath returns the node config path for a subnet

func (*Lux) GetLuxdSubnetConfigPath

func (app *Lux) GetLuxdSubnetConfigPath(subnetName string) string

GetLuxdSubnetConfigPath returns the luxd subnet config path for a subnet

func (*Lux) GetLuxgoBinDir

func (app *Lux) GetLuxgoBinDir() string

func (*Lux) GetMonitoringInventoryDir

func (app *Lux) GetMonitoringInventoryDir(clusterName string) string

GetMonitoringInventoryDir returns the monitoring inventory directory path

func (*Lux) GetNetworkFromSidecarNetworkName

func (app *Lux) GetNetworkFromSidecarNetworkName(name string) (models.Network, error)

GetNetworkFromSidecarNetworkName returns the network from sidecar network name

func (*Lux) GetNodesDir

func (app *Lux) GetNodesDir() string

GetNodesDir returns the nodes directory path

func (*Lux) GetPerNodeBlockchainConfig

func (app *Lux) GetPerNodeBlockchainConfig(subnetName string) map[string]interface{}

GetPerNodeBlockchainConfig returns per-node blockchain config

func (*Lux) GetPluginsDir added in v1.7.9

func (app *Lux) GetPluginsDir() string

func (*Lux) GetReposDir

func (app *Lux) GetReposDir() string

func (*Lux) GetRunDir added in v1.7.9

func (app *Lux) GetRunDir() string

func (*Lux) GetRunFile added in v1.7.9

func (app *Lux) GetRunFile() string

func (*Lux) GetSidecarNames added in v1.7.9

func (app *Lux) GetSidecarNames() ([]string, error)

func (*Lux) GetSidecarPath added in v1.7.9

func (app *Lux) GetSidecarPath(subnetName string) string

func (*Lux) GetSnapshotPath

func (app *Lux) GetSnapshotPath(snapshotName string) string

GetSnapshotPath returns the path to a snapshot

func (*Lux) GetSnapshotsDir added in v1.7.9

func (app *Lux) GetSnapshotsDir() string

func (*Lux) GetSubnetDir added in v1.7.9

func (app *Lux) GetSubnetDir() string

func (*Lux) GetTmpPluginDir added in v1.7.9

func (*Lux) GetTmpPluginDir() string

func (*Lux) GetTokenName added in v1.7.9

func (app *Lux) GetTokenName(subnetName string) string

func (*Lux) GetUpgradeBytesFilePath added in v1.7.9

func (app *Lux) GetUpgradeBytesFilePath(subnetName string) string

func (*Lux) GetUpgradeBytesFilepath

func (app *Lux) GetUpgradeBytesFilepath(subnetName string) string

func (*Lux) GetVersion added in v1.8.15

func (app *Lux) GetVersion() string

func (*Lux) IsLocalNetworkRunning added in v1.7.9

func (app *Lux) IsLocalNetworkRunning() bool

func (*Lux) KeyExists added in v1.7.9

func (app *Lux) KeyExists(keyName string) bool

func (*Lux) ListClusterNames

func (app *Lux) ListClusterNames() ([]string, error)

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

func (app *Lux) LoadClustersConfig() (map[string]interface{}, error)

LoadClustersConfig loads the clusters configuration

func (*Lux) LoadConfig

func (app *Lux) LoadConfig() (types.Config, error)

func (*Lux) LoadElasticSubnetConfig added in v1.7.9

func (app *Lux) LoadElasticSubnetConfig(subnetName string) (models.ElasticSubnetConfig, error)

func (*Lux) LoadEvmGenesis

func (app *Lux) LoadEvmGenesis(subnetName string) (core.Genesis, error)

func (*Lux) LoadRawChainConfig

func (app *Lux) LoadRawChainConfig(subnetName string) ([]byte, error)

LoadRawChainConfig loads raw chain config

func (*Lux) LoadRawGenesis added in v1.7.9

func (app *Lux) LoadRawGenesis(subnetName string) ([]byte, error)

func (*Lux) LoadRawLuxdSubnetConfig

func (app *Lux) LoadRawLuxdSubnetConfig(subnetName string) ([]byte, error)

LoadRawLuxdSubnetConfig loads raw subnet config

func (*Lux) LoadRawNetworkUpgrades

func (app *Lux) LoadRawNetworkUpgrades(subnetName string) ([]byte, error)

LoadRawNetworkUpgrades loads raw network upgrades

func (*Lux) LoadSidecar added in v1.7.9

func (app *Lux) LoadSidecar(subnetName string) (models.Sidecar, error)

func (*Lux) LuxdNodeConfigExists

func (app *Lux) LuxdNodeConfigExists(subnetName string) bool

LuxdNodeConfigExists checks if luxd node config exists

func (*Lux) LuxdSubnetConfigExists

func (app *Lux) LuxdSubnetConfigExists(subnetName string) bool

LuxdSubnetConfigExists checks if subnet config exists

func (*Lux) NetworkUpgradeExists

func (app *Lux) NetworkUpgradeExists(subnetName string) bool

NetworkUpgradeExists checks if network upgrade file exists

func (*Lux) ReadLastActionsFile

func (app *Lux) ReadLastActionsFile() (*LastActions, error)

func (*Lux) ReadLockUpgradeFile added in v1.7.9

func (app *Lux) ReadLockUpgradeFile(subnetName string) ([]byte, error)

func (*Lux) ReadUpgradeFile added in v1.7.9

func (app *Lux) ReadUpgradeFile(subnetName string) ([]byte, error)

func (*Lux) ResetPluginsDir

func (app *Lux) ResetPluginsDir() error

ResetPluginsDir resets the plugins directory

func (*Lux) Setup

func (app *Lux) Setup(baseDir string, log luxlog.Logger, conf *config.Config, prompt prompts.Prompter, downloader Downloader)

func (*Lux) SidecarExists added in v1.7.9

func (app *Lux) SidecarExists(subnetName string) bool

func (*Lux) SubnetConfigExists added in v1.7.9

func (app *Lux) SubnetConfigExists(subnetName string) bool

func (*Lux) UpdateSidecar added in v1.7.9

func (app *Lux) UpdateSidecar(sc *models.Sidecar) error

func (*Lux) UpdateSidecarElasticSubnet added in v1.7.9

func (app *Lux) UpdateSidecarElasticSubnet(
	sc *models.Sidecar,
	network models.Network,
	subnetID ids.ID,
	assetID ids.ID,
	pchainTXID ids.ID,
	tokenName string,
	tokenSymbol string,
) error

func (*Lux) UpdateSidecarElasticSubnetPartialTx added in v1.7.9

func (app *Lux) UpdateSidecarElasticSubnetPartialTx(
	sc *models.Sidecar,
	network models.Network,
	txName string,
	txID ids.ID,
) error

func (*Lux) UpdateSidecarNetworks added in v1.7.9

func (app *Lux) UpdateSidecarNetworks(
	sc *models.Sidecar,
	network models.Network,
	subnetID ids.ID,
	blockchainID ids.ID,
) error

func (*Lux) UpdateSidecarPermissionlessValidator added in v1.7.9

func (app *Lux) UpdateSidecarPermissionlessValidator(
	sc *models.Sidecar,
	network models.Network,
	nodeID string,
	txID ids.ID,
) error

func (*Lux) WriteConfigFile

func (app *Lux) WriteConfigFile(data []byte) error

func (*Lux) WriteGenesisFile added in v1.7.9

func (app *Lux) WriteGenesisFile(subnetName string, genesisBytes []byte) error

func (*Lux) WriteLastActionsFile

func (app *Lux) WriteLastActionsFile(acts *LastActions)

func (*Lux) WriteLockUpgradeFile added in v1.7.9

func (app *Lux) WriteLockUpgradeFile(subnetName string, bytes []byte) error

func (*Lux) WriteSidecarFile added in v1.7.9

func (app *Lux) WriteSidecarFile(sc *models.Sidecar) error

func (*Lux) WriteUpgradeFile added in v1.7.9

func (app *Lux) WriteUpgradeFile(subnetName string, bytes []byte) error

Jump to

Keyboard shortcuts

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