client

package
v1.1.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client provides methods for interacting with a worker.

func New

func New(addr, password string) *Client

New returns a new worker client.

func (*Client) Account

func (c *Client) Account(ctx context.Context, hostKey types.PublicKey) (account rhpv3.Account, err error)

Account returns the account id for a given host.

func (*Client) Accounts added in v1.1.0

func (c *Client) Accounts(ctx context.Context) (accounts []api.Account, err error)

Accounts returns all accounts.

func (*Client) Contracts

func (c *Client) Contracts(ctx context.Context, hostTimeout time.Duration) (resp api.ContractsResponse, err error)

Contracts returns all contracts from the worker. These contracts decorate a bus contract with the contract's latest revision.

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, bucket, path string, opts api.DeleteObjectOptions) (err error)

DeleteObject deletes the object at the given path.

func (*Client) DownloadObject

func (c *Client) DownloadObject(ctx context.Context, w io.Writer, bucket, path string, opts api.DownloadObjectOptions) (err error)

DownloadObject downloads the object at the given path.

func (*Client) DownloadStats

func (c *Client) DownloadStats() (resp api.DownloadStatsResponse, err error)

DownloadStats returns download statistics.

func (*Client) GetObject

func (c *Client) GetObject(ctx context.Context, bucket, path string, opts api.DownloadObjectOptions) (*api.GetObjectResponse, error)

GetObject returns the object at given path alongside its metadata.

func (*Client) HeadObject added in v1.0.6

func (c *Client) HeadObject(ctx context.Context, bucket, path string, opts api.HeadObjectOptions) (*api.HeadObjectResponse, error)

HeadObject returns the metadata of the object at the given path.

func (*Client) ID

func (c *Client) ID(ctx context.Context) (id string, err error)

ID returns the id of the worker.

func (*Client) Memory

func (c *Client) Memory(ctx context.Context) (resp api.MemoryResponse, err error)

Memory requests the /memory endpoint.

func (*Client) MigrateSlab

func (c *Client) MigrateSlab(ctx context.Context, slab object.Slab, set string) (res api.MigrateSlabResponse, err error)

MigrateSlab migrates the specified slab.

func (*Client) NotifyEvent added in v1.1.0

func (c *Client) NotifyEvent(ctx context.Context, e webhooks.Event) (err error)

NotifyEvent notifies the worker of an event.

func (*Client) ObjectEntries

func (c *Client) ObjectEntries(ctx context.Context, bucket, path string, opts api.GetObjectOptions) (entries []api.ObjectMetadata, err error)

ObjectEntries returns the entries at the given path, which must end in /.

func (*Client) RHPPriceTable

func (c *Client) RHPPriceTable(ctx context.Context, hostKey types.PublicKey, siamuxAddr string, timeout time.Duration) (pt api.HostPriceTable, err error)

RHPPriceTable fetches a price table for a host.

func (*Client) RHPScan

func (c *Client) RHPScan(ctx context.Context, hostKey types.PublicKey, hostIP string, timeout time.Duration) (resp api.RHPScanResponse, err error)

RHPScan scans a host, returning its current settings.

func (*Client) ResetDrift added in v1.1.0

func (c *Client) ResetDrift(ctx context.Context, id rhpv3.Account) (err error)

ResetDrift resets the drift of an account to zero.

func (*Client) State

func (c *Client) State() (state api.WorkerStateResponse, err error)

State returns the current state of the worker.

func (*Client) UploadMultipartUploadPart

func (c *Client) UploadMultipartUploadPart(ctx context.Context, r io.Reader, bucket, path, uploadID string, partNumber int, opts api.UploadMultipartUploadPartOptions) (*api.UploadMultipartUploadPartResponse, error)

UploadMultipartUploadPart uploads part of the data for a multipart upload.

func (*Client) UploadObject

func (c *Client) UploadObject(ctx context.Context, r io.Reader, bucket, path string, opts api.UploadObjectOptions) (*api.UploadObjectResponse, error)

UploadObject uploads the data in r, creating an object at the given path.

func (*Client) UploadStats

func (c *Client) UploadStats() (resp api.UploadStatsResponse, err error)

UploadStats returns the upload stats.

Jump to

Keyboard shortcuts

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