client

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 15 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) 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) 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) RHPBroadcast

func (c *Client) RHPBroadcast(ctx context.Context, contractID types.FileContractID) (err error)

RHPBroadcast broadcasts the latest revision for a contract.

func (*Client) RHPContractRoots

func (c *Client) RHPContractRoots(ctx context.Context, contractID types.FileContractID) (roots []types.Hash256, err error)

RHPContractRoots fetches the roots of the contract with given id.

func (*Client) RHPForm

func (c *Client) RHPForm(ctx context.Context, endHeight uint64, hostKey types.PublicKey, hostIP string, renterAddress types.Address, renterFunds types.Currency, hostCollateral types.Currency) (rhpv2.ContractRevision, []types.Transaction, error)

RHPForm forms a contract with a host.

func (*Client) RHPFund

func (c *Client) RHPFund(ctx context.Context, contractID types.FileContractID, hostKey types.PublicKey, hostIP, siamuxAddr string, balance types.Currency) (err error)

RHPFund funds an ephemeral account using the supplied contract.

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) RHPPruneContract

func (c *Client) RHPPruneContract(ctx context.Context, contractID types.FileContractID, timeout time.Duration) (pruned, remaining uint64, err error)

RHPPruneContract prunes deleted sectors from the contract with given id.

func (*Client) RHPRenew

func (c *Client) RHPRenew(ctx context.Context, contractID types.FileContractID, endHeight uint64, hostKey types.PublicKey, siamuxAddr string, hostAddress, renterAddress types.Address, renterFunds, minNewCollateral types.Currency, expectedStorage, windowSize uint64) (resp api.RHPRenewResponse, err error)

RHPRenew renews an existing contract with 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) RHPSync

func (c *Client) RHPSync(ctx context.Context, contractID types.FileContractID, hostKey types.PublicKey, hostIP, siamuxAddr string) (err error)

RHPSync funds an ephemeral account using the supplied contract.

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