Documentation ¶
Index ¶
- Constants
- func SaveConfig(cfg *GlobalConfig, directory, filename string) error
- func SyncRatioToPercent(in float64) float64
- type GlobalConfig
- func (c *GlobalConfig) ChangeNetwork(newNetwork config.Network)
- func (c *GlobalConfig) CreateCopy() *GlobalConfig
- func (c *GlobalConfig) DeserializeModules() error
- func (c *GlobalConfig) GetAllModuleConfigs() []config.IModuleConfig
- func (c *GlobalConfig) GetChanges(oldConfig *GlobalConfig) ([]*config.ChangedSection, map[config.ContainerID]bool, bool)
- func (c *GlobalConfig) GetEnabledModuleConfigNames() []string
- func (c *GlobalConfig) ModulesDirectory() string
- func (c *GlobalConfig) Serialize() map[string]any
- func (c *GlobalConfig) UpdateDefaults()
- func (c *GlobalConfig) Validate() []string
- func (c *GlobalConfig) ValidatorsDirectory() string
- type HyperdriveClient
- func (c *HyperdriveClient) DeleteVolume(volumeName string) error
- func (c *HyperdriveClient) GetClientVolumeName(containerName, volumeTarget string) (string, error)
- func (c *HyperdriveClient) GetClientVolumeSource(containerName string, volumeTarget string) (string, error)
- func (c *HyperdriveClient) GetDirSizeViaEcMigrator(container string, targetDir string, image string) (uint64, error)
- func (c *HyperdriveClient) GetDocker() (*docker.Client, error)
- func (c *HyperdriveClient) GetDockerContainerShutdownTime(containerName string) (time.Time, error)
- func (c *HyperdriveClient) GetDockerImage(containerName string) (string, error)
- func (c *HyperdriveClient) GetDockerStatus(containerName string) (string, error)
- func (c *HyperdriveClient) GetServiceVersion() (string, error)
- func (c *HyperdriveClient) GetValidatorContainers(projectName string) ([]string, error)
- func (c *HyperdriveClient) GetVolumeSize(volumeName string) (int64, error)
- func (c *HyperdriveClient) InstallService(verbose bool, noDeps bool, version string, path string, useLocalInstaller bool) error
- func (c *HyperdriveClient) LoadBackupConfig() (*GlobalConfig, error)
- func (c *HyperdriveClient) LoadConfig() (*GlobalConfig, bool, error)
- func (c *HyperdriveClient) PauseService(composeFiles []string) error
- func (c *HyperdriveClient) PrintServiceCompose(composeFiles []string) error
- func (c *HyperdriveClient) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error
- func (c *HyperdriveClient) PrintServiceStats(composeFiles []string) error
- func (c *HyperdriveClient) PrintServiceStatus(composeFiles []string) error
- func (c *HyperdriveClient) PurgeData(composeFiles []string) error
- func (c *HyperdriveClient) RemoveContainer(containerName string) error
- func (c *HyperdriveClient) RestartContainer(containerName string) error
- func (c *HyperdriveClient) RunEcMigrator(container string, volume string, targetDir string, mode string, image string) error
- func (c *HyperdriveClient) RunNethermindPruneStarter(container string) error
- func (c *HyperdriveClient) RunPruneProvisioner(container string, volume string, image string) error
- func (c *HyperdriveClient) SaveConfig(cfg *GlobalConfig) error
- func (c *HyperdriveClient) StartContainer(containerName string) error
- func (c *HyperdriveClient) StartService(composeFiles []string) error
- func (c *HyperdriveClient) StopContainer(containerName string) error
- func (c *HyperdriveClient) StopService(composeFiles []string) error
- func (c *HyperdriveClient) TerminateService(composeFiles []string, configPath string) error
- func (c *HyperdriveClient) UpdateGrafanaDatabaseConfiguration(config *GlobalConfig) error
- func (c *HyperdriveClient) UpdatePrometheusConfiguration(config *GlobalConfig) error
- func (c *HyperdriveClient) WithReady() (*HyperdriveClient, error)
- func (c *HyperdriveClient) WithStatus() (*HyperdriveClient, bool, error)
- type StakewiseClient
Constants ¶
const ( InstallerName string = "install.sh" InstallerURL string = "https://github.com/nodeset-org/hyperdrive/releases/download/%s/" + InstallerName SettingsFile string = "user-settings.yml" BackupSettingsFile string = "user-settings-backup.yml" )
Config
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶
func SaveConfig(cfg *GlobalConfig, directory, filename string) error
Saves a config
func SyncRatioToPercent ¶
When printing sync percents, we should avoid printing 100%. This function is only called if we're still syncing, and the `%0.2f` token will round up if we're above 99.99%.
Types ¶
type GlobalConfig ¶ added in v0.2.3
type GlobalConfig struct { Hyperdrive *config.HyperdriveConfig Stakewise *swconfig.StakewiseConfig }
Wrapper for global configuration
func LoadConfigFromFile ¶
func LoadConfigFromFile(path string) (*GlobalConfig, error)
Loads a config without updating it if it exists
func NewGlobalConfig ¶ added in v0.2.3
func NewGlobalConfig(hdCfg *config.HyperdriveConfig) *GlobalConfig
Make a new global config
func (*GlobalConfig) ChangeNetwork ¶ added in v0.2.3
func (c *GlobalConfig) ChangeNetwork(newNetwork config.Network)
Changes the current network, propagating new parameter settings if they are affected
func (*GlobalConfig) CreateCopy ¶ added in v0.2.3
func (c *GlobalConfig) CreateCopy() *GlobalConfig
Creates a copy of the configuration
func (*GlobalConfig) DeserializeModules ¶ added in v0.2.3
func (c *GlobalConfig) DeserializeModules() error
Deserialize the config's modules (assumes the Hyperdrive config itself has already been deserialized)
func (*GlobalConfig) GetAllModuleConfigs ¶ added in v0.2.3
func (c *GlobalConfig) GetAllModuleConfigs() []config.IModuleConfig
Get the configs for all of the modules in the system
func (*GlobalConfig) GetChanges ¶ added in v0.2.3
func (c *GlobalConfig) GetChanges(oldConfig *GlobalConfig) ([]*config.ChangedSection, map[config.ContainerID]bool, bool)
Get all of the settings that have changed between an old config and this config, and get all of the containers that are affected by those changes - also returns whether or not the selected network was changed
func (*GlobalConfig) GetEnabledModuleConfigNames ¶ added in v0.2.3
func (c *GlobalConfig) GetEnabledModuleConfigNames() []string
Get the configs for all of the modules in the system that are enabled
func (*GlobalConfig) ModulesDirectory ¶ added in v0.2.3
func (c *GlobalConfig) ModulesDirectory() string
func (*GlobalConfig) Serialize ¶ added in v0.2.3
func (c *GlobalConfig) Serialize() map[string]any
Serialize the config and all modules
func (*GlobalConfig) UpdateDefaults ¶ added in v0.2.3
func (c *GlobalConfig) UpdateDefaults()
Updates the default parameters based on the current network value
func (*GlobalConfig) Validate ¶ added in v0.2.3
func (c *GlobalConfig) Validate() []string
Checks to see if the current configuration is valid; if not, returns a list of errors
func (*GlobalConfig) ValidatorsDirectory ¶ added in v0.2.3
func (c *GlobalConfig) ValidatorsDirectory() string
type HyperdriveClient ¶
type HyperdriveClient struct { Api *client.ApiClient Context *context.HyperdriveContext // contains filtered or unexported fields }
Hyperdrive client
func NewHyperdriveClientFromCtx ¶
func NewHyperdriveClientFromCtx(c *cli.Context) *HyperdriveClient
Create new Hyperdrive client from CLI context without checking for sync status Only use this function from commands that may work if the Daemon service doesn't exist Most users should call NewHyperdriveClientFromCtx(c).WithStatus() or NewHyperdriveClientFromCtx(c).WithReady()
func (*HyperdriveClient) DeleteVolume ¶
func (c *HyperdriveClient) DeleteVolume(volumeName string) error
Deletes a container
func (*HyperdriveClient) GetClientVolumeName ¶
func (c *HyperdriveClient) GetClientVolumeName(containerName, volumeTarget string) (string, error)
Gets the name of the client volume
func (*HyperdriveClient) GetClientVolumeSource ¶
func (c *HyperdriveClient) GetClientVolumeSource(containerName string, volumeTarget string) (string, error)
Gets the absolute file path of the client volume
func (*HyperdriveClient) GetDirSizeViaEcMigrator ¶
func (c *HyperdriveClient) GetDirSizeViaEcMigrator(container string, targetDir string, image string) (uint64, error)
Gets the size of the target directory via the EC migrator for importing, which should have the same permissions as exporting
func (*HyperdriveClient) GetDocker ¶
func (c *HyperdriveClient) GetDocker() (*docker.Client, error)
Get the Docker client
func (*HyperdriveClient) GetDockerContainerShutdownTime ¶
func (c *HyperdriveClient) GetDockerContainerShutdownTime(containerName string) (time.Time, error)
Get the time that the given container shut down
func (*HyperdriveClient) GetDockerImage ¶
func (c *HyperdriveClient) GetDockerImage(containerName string) (string, error)
Get the current Docker image used by the given container
func (*HyperdriveClient) GetDockerStatus ¶
func (c *HyperdriveClient) GetDockerStatus(containerName string) (string, error)
Get the current Docker image used by the given container
func (*HyperdriveClient) GetServiceVersion ¶
func (c *HyperdriveClient) GetServiceVersion() (string, error)
Get the Hyperdrive service version
func (*HyperdriveClient) GetValidatorContainers ¶
func (c *HyperdriveClient) GetValidatorContainers(projectName string) ([]string, error)
Get the Docker images with the project ID as a prefix that run the VC start script in their command line arguments
func (*HyperdriveClient) GetVolumeSize ¶
func (c *HyperdriveClient) GetVolumeSize(volumeName string) (int64, error)
Gets the disk usage of the given volume
func (*HyperdriveClient) InstallService ¶
func (c *HyperdriveClient) InstallService(verbose bool, noDeps bool, version string, path string, useLocalInstaller bool) error
Install Hyperdrive
func (*HyperdriveClient) LoadBackupConfig ¶
func (c *HyperdriveClient) LoadBackupConfig() (*GlobalConfig, error)
Load the backup config
func (*HyperdriveClient) LoadConfig ¶
func (c *HyperdriveClient) LoadConfig() (*GlobalConfig, bool, error)
Load the config Returns the global config and whether or not it was newly generated
func (*HyperdriveClient) PauseService ¶
func (c *HyperdriveClient) PauseService(composeFiles []string) error
Pause the Hyperdrive service
func (*HyperdriveClient) PrintServiceCompose ¶
func (c *HyperdriveClient) PrintServiceCompose(composeFiles []string) error
Print the Hyperdrive service compose config
func (*HyperdriveClient) PrintServiceLogs ¶
func (c *HyperdriveClient) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error
Print the Hyperdrive service logs
func (*HyperdriveClient) PrintServiceStats ¶
func (c *HyperdriveClient) PrintServiceStats(composeFiles []string) error
Print the Hyperdrive service stats
func (*HyperdriveClient) PrintServiceStatus ¶
func (c *HyperdriveClient) PrintServiceStatus(composeFiles []string) error
Print the Hyperdrive service status
func (*HyperdriveClient) PurgeData ¶
func (c *HyperdriveClient) PurgeData(composeFiles []string) error
Deletes the data directory, including the node wallet and all validator keys, and restarts the Docker containers
func (*HyperdriveClient) RemoveContainer ¶
func (c *HyperdriveClient) RemoveContainer(containerName string) error
Deletes a container
func (*HyperdriveClient) RestartContainer ¶
func (c *HyperdriveClient) RestartContainer(containerName string) error
Restart a container
func (*HyperdriveClient) RunEcMigrator ¶
func (c *HyperdriveClient) RunEcMigrator(container string, volume string, targetDir string, mode string, image string) error
Runs the EC migrator
func (*HyperdriveClient) RunNethermindPruneStarter ¶
func (c *HyperdriveClient) RunNethermindPruneStarter(container string) error
Runs the prune provisioner
func (*HyperdriveClient) RunPruneProvisioner ¶
func (c *HyperdriveClient) RunPruneProvisioner(container string, volume string, image string) error
Runs the prune provisioner
func (*HyperdriveClient) SaveConfig ¶
func (c *HyperdriveClient) SaveConfig(cfg *GlobalConfig) error
Save the config
func (*HyperdriveClient) StartContainer ¶
func (c *HyperdriveClient) StartContainer(containerName string) error
Start a container
func (*HyperdriveClient) StartService ¶
func (c *HyperdriveClient) StartService(composeFiles []string) error
Start the Hyperdrive service
func (*HyperdriveClient) StopContainer ¶
func (c *HyperdriveClient) StopContainer(containerName string) error
Shut down a container
func (*HyperdriveClient) StopService ¶
func (c *HyperdriveClient) StopService(composeFiles []string) error
Stop the Hyperdrive service
func (*HyperdriveClient) TerminateService ¶
func (c *HyperdriveClient) TerminateService(composeFiles []string, configPath string) error
Stop Hyperdrive and remove the config folder
func (*HyperdriveClient) UpdateGrafanaDatabaseConfiguration ¶
func (c *HyperdriveClient) UpdateGrafanaDatabaseConfiguration(config *GlobalConfig) error
Load the Grafana config template, do a template variable substitution, and save it
func (*HyperdriveClient) UpdatePrometheusConfiguration ¶
func (c *HyperdriveClient) UpdatePrometheusConfiguration(config *GlobalConfig) error
Load the Prometheus config template, do a template variable substitution, and save it
func (*HyperdriveClient) WithReady ¶
func (c *HyperdriveClient) WithReady() (*HyperdriveClient, error)
Check the status of a newly created client and ensure the eth clients are synced and ready
func (*HyperdriveClient) WithStatus ¶
func (c *HyperdriveClient) WithStatus() (*HyperdriveClient, bool, error)
Check the status of a newly created client and return it Only use this function from commands that may work without the clients being synced- most users should use WithReady instead
type StakewiseClient ¶
type StakewiseClient struct { Api *swclient.ApiClient Context *context.HyperdriveContext }
Stakewise client
func NewStakewiseClientFromCtx ¶
func NewStakewiseClientFromCtx(c *cli.Context) *StakewiseClient
Create new Stakewise client from CLI context without checking for sync status Only use this function from commands that may work if the Daemon service doesn't exist