client

package
v0.1.0-a1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: AGPL-3.0 Imports: 29 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 Client

type Client struct {
	Api     *api.ApiRequester
	Context *context.HyperdriveContext
}

Hyperdrive client

func NewClientFromCtx

func NewClientFromCtx(c *cli.Context) *Client

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 NewClientFromCtx(c).WithStatus() or NewClientFromCtx(c).WithReady()

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volume string) (string, error)

Deletes a container

func (*Client) GetClientVolumeName

func (c *Client) GetClientVolumeName(container string, volumeTarget string) (string, error)

Gets the name of the client volume

func (*Client) GetClientVolumeSource

func (c *Client) GetClientVolumeSource(container string, volumeTarget string) (string, error)

Gets the absolute file path of the client volume

func (*Client) GetDirSizeViaEcMigrator

func (c *Client) 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 (*Client) GetDockerContainerShutdownTime

func (c *Client) GetDockerContainerShutdownTime(container string) (time.Time, error)

Get the time that the given container shut down

func (*Client) GetDockerImage

func (c *Client) GetDockerImage(container string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetDockerStatus

func (c *Client) GetDockerStatus(container string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetServiceVersion

func (c *Client) GetServiceVersion() (string, error)

Get the Hyperdrive service version

func (*Client) GetVolumeSize

func (c *Client) GetVolumeSize(volumeName string) (string, error)

Gets the disk usage of the given volume

func (*Client) InstallService

func (c *Client) InstallService(verbose, noDeps bool, version, path string) error

Install Hyperdrive

func (*Client) LoadBackupConfig

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

Load the backup config

func (*Client) LoadConfig

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

Load the config Returns the RocketPoolConfig and whether or not it was newly generated

func (*Client) PauseService

func (c *Client) PauseService(composeFiles []string) error

Pause the Hyperdrive service

func (*Client) PrintServiceCompose

func (c *Client) PrintServiceCompose(composeFiles []string) error

Print the Hyperdrive service compose config

func (*Client) PrintServiceLogs

func (c *Client) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error

Print the Hyperdrive service logs

func (*Client) PrintServiceStats

func (c *Client) PrintServiceStats(composeFiles []string) error

Print the Hyperdrive service stats

func (*Client) PrintServiceStatus

func (c *Client) PrintServiceStatus(composeFiles []string) error

Print the Hyperdrive service status

func (*Client) PurgeData

func (c *Client) PurgeData(composeFiles []string) error

Deletes the data directory, including the node wallet and all validator keys, and restarts the Docker containers

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(container string) (string, error)

Deletes a container

func (*Client) RestartContainer

func (c *Client) RestartContainer(container string) (string, error)

Restart a container

func (*Client) RunEcMigrator

func (c *Client) RunEcMigrator(container string, volume string, targetDir string, mode string, image string) error

Runs the EC migrator

func (*Client) RunNethermindPruneStarter

func (c *Client) RunNethermindPruneStarter(container string) error

Runs the prune provisioner

func (*Client) RunPruneProvisioner

func (c *Client) RunPruneProvisioner(container string, volume string, image string) error

Runs the prune provisioner

func (*Client) SaveConfig

func (c *Client) SaveConfig(cfg *config.HyperdriveConfig) error

Save the config

func (*Client) StartContainer

func (c *Client) StartContainer(container string) (string, error)

Start a container

func (*Client) StartService

func (c *Client) StartService(composeFiles []string) error

Start the Hyperdrive service

func (*Client) StopContainer

func (c *Client) StopContainer(container string) (string, error)

Shut down a container

func (*Client) StopService

func (c *Client) StopService(composeFiles []string) error

Stop the Hyperdrive service

func (*Client) TerminateService

func (c *Client) TerminateService(composeFiles []string, configPath string) error

Stop Hyperdrive and remove the config folder

func (*Client) UpdateGrafanaDatabaseConfiguration

func (c *Client) UpdateGrafanaDatabaseConfiguration(config *config.HyperdriveConfig) error

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

func (*Client) UpdatePrometheusConfiguration

func (c *Client) UpdatePrometheusConfiguration(config *config.HyperdriveConfig) error

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

func (*Client) WithReady

func (c *Client) WithReady() (*Client, error)

Check the status of a newly created client and ensure the eth clients are synced and ready

func (*Client) WithStatus

func (c *Client) WithStatus() (*Client, 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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