client

package
v0.2.1-dev Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstallerURL string = "https://github.com/nodeset-org/hyperdrive/releases/download/%s/install.sh"

	SettingsFile       string = "user-settings.yml"
	BackupSettingsFile string = "user-settings-backup.yml"
)

Config

Variables

This section is empty.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(path string) (*config.HyperdriveConfig, error)

Loads a config without updating it if it exists

func SaveConfig

func SaveConfig(cfg *config.HyperdriveConfig, directory, filename string) error

Saves a config and removes the upgrade flag file

func SyncRatioToPercent

func SyncRatioToPercent(in float64) float64

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 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, noDeps bool, version, path string) error

Install Hyperdrive

func (*HyperdriveClient) LoadBackupConfig

func (c *HyperdriveClient) LoadBackupConfig() (*config.HyperdriveConfig, error)

Load the backup config

func (*HyperdriveClient) LoadConfig

func (c *HyperdriveClient) LoadConfig() (*config.HyperdriveConfig, bool, error)

Load the config Returns the Hyperdrive 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 *config.HyperdriveConfig) 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 *config.HyperdriveConfig) error

Load the Grafana config template, do a template variable substitution, and save it

func (*HyperdriveClient) UpdatePrometheusConfiguration

func (c *HyperdriveClient) UpdatePrometheusConfiguration(config *config.HyperdriveConfig) 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
}

Hyperdrive 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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