bus

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 32 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAcquireContractTimeout = errors.New("acquiring the lock timed out")

ErrAcquireContractTimeout is returned when the context passed in to contractLocks.Acquire is closed before the lock can be acquired.

Functions

func New

New returns a new Bus.

Types

type AutopilotStore

type AutopilotStore interface {
	Autopilots(ctx context.Context) ([]api.Autopilot, error)
	Autopilot(ctx context.Context, id string) (api.Autopilot, error)
	UpdateAutopilot(ctx context.Context, ap api.Autopilot) error
}

An AutopilotStore stores autopilots.

type ChainManager

type ChainManager interface {
	AcceptBlock(context.Context, types.Block) error
	LastBlockTime() time.Time
	Synced(ctx context.Context) bool
	TipState(ctx context.Context) consensus.State
}

A ChainManager manages blockchain state.

type Client

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

A Client provides methods for interacting with a renterd API server.

func NewClient

func NewClient(addr, password string) *Client

NewClient returns a client that communicates with a renterd store server listening on the specified address.

func (*Client) AbortMultipartUpload added in v0.6.0

func (c *Client) AbortMultipartUpload(ctx context.Context, bucket, path string, uploadID string) (err error)

func (*Client) AcceptBlock

func (c *Client) AcceptBlock(ctx context.Context, b types.Block) (err error)

AcceptBlock submits a block to the consensus manager.

func (*Client) Account

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

Account requests the bus's /accounts/:host endpoint.

func (*Client) Accounts

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

Accounts returns the ephemeral accounts known to the bus.

func (*Client) AcquireContract

func (c *Client) AcquireContract(ctx context.Context, fcid types.FileContractID, priority int, d time.Duration) (lockID uint64, err error)

AcquireContract acquires a contract for a given amount of time unless released manually before that time.

func (*Client) AddBalance

func (c *Client) AddBalance(ctx context.Context, id rhpv3.Account, hk types.PublicKey, amount *big.Int) (err error)

AddBalance adds the given amount to an account's balance.

func (*Client) AddContract

func (c *Client) AddContract(ctx context.Context, contract rhpv2.ContractRevision, totalCost types.Currency, startHeight uint64) (added api.ContractMetadata, err error)

AddContract adds the provided contract to the metadata store.

func (*Client) AddMultipartPart added in v0.6.0

func (c *Client) AddMultipartPart(ctx context.Context, bucket, path, contractSet, eTag, uploadID string, partNumber int, slices []object.SlabSlice, partialSlab []object.PartialSlab, usedContracts map[types.PublicKey]types.FileContractID) (err error)

func (*Client) AddObject

func (c *Client) AddObject(ctx context.Context, bucket, path, contractSet, eTag, mimeType string, o object.Object, usedContracts map[types.PublicKey]types.FileContractID) (err error)

AddObject stores the provided object under the given path.

func (*Client) AddPartialSlab

func (c *Client) AddPartialSlab(ctx context.Context, data []byte, minShards, totalShards uint8, contractSet string) (slabs []object.PartialSlab, slabBufferMaxSizeSoftReached bool, err error)

func (*Client) AddRenewedContract

func (c *Client) AddRenewedContract(ctx context.Context, contract rhpv2.ContractRevision, totalCost types.Currency, startHeight uint64, renewedFrom types.FileContractID) (renewed api.ContractMetadata, err error)

AddRenewedContract adds the provided contract to the metadata store.

func (*Client) AddUploadingSector

func (c *Client) AddUploadingSector(ctx context.Context, uID api.UploadID, id types.FileContractID, root types.Hash256) (err error)

AddUploadingSector adds the given sector to the upload with given id.

func (*Client) Alerts

func (c *Client) Alerts() (alerts []alerts.Alert, err error)

Alerts fetches the active alerts from the bus.

func (*Client) AncestorContracts

func (c *Client) AncestorContracts(ctx context.Context, fcid types.FileContractID, minStartHeight uint64) (contracts []api.ArchivedContract, err error)

AncestorContracts returns any ancestors of a given contract.

func (*Client) ArchiveContracts

func (c *Client) ArchiveContracts(ctx context.Context, toArchive map[types.FileContractID]string) (err error)

ArchiveContracts archives the contracts with the given IDs and archival reason.

func (*Client) Autopilot

func (c *Client) Autopilot(ctx context.Context, id string) (autopilot api.Autopilot, err error)

Autopilot returns the autopilot with the given ID.

func (*Client) Autopilots

func (c *Client) Autopilots(ctx context.Context) (autopilots []api.Autopilot, err error)

Autopilots returns all autopilots in the autopilots store.

func (*Client) BroadcastAction

func (c *Client) BroadcastAction(ctx context.Context, action webhooks.Event) error

BroadcastAction broadcasts an action that triggers a webhook.

func (*Client) BroadcastTransaction

func (c *Client) BroadcastTransaction(ctx context.Context, txns []types.Transaction) error

BroadcastTransaction broadcasts the transaction set to the network.

func (*Client) Bucket added in v0.6.0

func (c *Client) Bucket(ctx context.Context, name string) (resp api.Bucket, err error)

Bucket returns information about a specific bucket.

func (*Client) CompleteMultipartUpload added in v0.6.0

func (c *Client) CompleteMultipartUpload(ctx context.Context, bucket, path, uploadID string, parts []api.MultipartCompletedPart) (resp api.MultipartCompleteResponse, err error)

func (*Client) ConsensusNetwork

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

ConsensusNetwork returns information about the consensus network.

func (*Client) ConsensusState

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

ConsensusState returns the current block height and whether the node is synced.

func (*Client) Contract

func (c *Client) Contract(ctx context.Context, id types.FileContractID) (contract api.ContractMetadata, err error)

Contract returns the contract with the given ID.

func (*Client) ContractRoots

func (c *Client) ContractRoots(ctx context.Context, fcid types.FileContractID) (roots, uploading []types.Hash256, err error)

ContractRoots returns the sector roots, as well as the ones that are still uploading, for the contract with given id.

func (*Client) ContractSetContracts

func (c *Client) ContractSetContracts(ctx context.Context, set string) (contracts []api.ContractMetadata, err error)

ContractSetContracts returns the contracts for the given set from the metadata store.

func (*Client) ContractSetSettings

func (c *Client) ContractSetSettings(ctx context.Context) (gs api.ContractSetSetting, err error)

ContractSetSettings returns the contract set settings.

func (*Client) ContractSets

func (c *Client) ContractSets(ctx context.Context) (sets []string, err error)

ContractSets returns the contract sets of the bus.

func (*Client) ContractSize

func (c *Client) ContractSize(ctx context.Context, fcid types.FileContractID) (size api.ContractSize, err error)

ContractSize returns the contract's size.

func (*Client) Contracts

func (c *Client) Contracts(ctx context.Context) (contracts []api.ContractMetadata, err error)

Contracts returns all contracts in the metadata store.

func (*Client) CopyObject added in v0.6.0

func (c *Client) CopyObject(ctx context.Context, srcBucket, dstBucket, srcPath, dstPath string, opts api.CopyObjectOptions) (om api.ObjectMetadata, err error)

CopyObject copies the object from the source bucket and path to the destination bucket and path.

func (*Client) CreateBucket added in v0.6.0

func (c *Client) CreateBucket(ctx context.Context, name string, policy api.BucketPolicy) error

CreateBucket creates a new bucket.

func (*Client) CreateMultipartUpload added in v0.6.0

func (c *Client) CreateMultipartUpload(ctx context.Context, bucket, path string, opts api.CreateMultipartOptions) (resp api.MultipartCreateResponse, err error)

func (*Client) DeleteAllContracts

func (c *Client) DeleteAllContracts(ctx context.Context) (err error)

DeleteAllContracts deletes all contracts from the bus.

func (*Client) DeleteBucket added in v0.6.0

func (c *Client) DeleteBucket(ctx context.Context, name string) error

DeleteBucket deletes an existing bucket. Fails if the bucket isn't empty.

func (*Client) DeleteContract

func (c *Client) DeleteContract(ctx context.Context, id types.FileContractID) (err error)

DeleteContract deletes the contract with the given ID.

func (*Client) DeleteContractSet

func (c *Client) DeleteContractSet(ctx context.Context, set string) (err error)

DeleteContractSet removes the contract set from the bus.

func (*Client) DeleteContracts

func (c *Client) DeleteContracts(ctx context.Context, ids []types.FileContractID) error

DeleteContracts deletes the contracts with the given IDs.

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, bucket, path string, batch bool) (err error)

DeleteObject either deletes the object at the given path or if batch=true deletes all objects that start with the given path.

func (*Client) DeleteSetting

func (c *Client) DeleteSetting(ctx context.Context, key string) error

DeleteSetting will delete the setting with given key.

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, url, module, event string) error

DeleteWebhook deletes the webhook with the given ID.

func (*Client) DismissAlerts

func (c *Client) DismissAlerts(ctx context.Context, ids ...types.Hash256) error

DismissAlerts dimisses the alerts with the given IDs.

func (*Client) FetchPartialSlab

func (c *Client) FetchPartialSlab(ctx context.Context, key object.EncryptionKey, offset, length uint32) ([]byte, error)

func (*Client) FileContractTax

func (c *Client) FileContractTax(ctx context.Context, payout types.Currency) (tax types.Currency, err error)

FileContractTax asks the bus for the siafund fee that has to be paid for a contract with a given payout.

func (*Client) FinishUpload

func (c *Client) FinishUpload(ctx context.Context, uID api.UploadID) (err error)

FinishUpload marks the given upload as finished.

func (*Client) GougingParams

func (c *Client) GougingParams(ctx context.Context) (gp api.GougingParams, err error)

GougingParams returns parameters used for performing gouging checks.

func (*Client) GougingSettings

func (c *Client) GougingSettings(ctx context.Context) (gs api.GougingSettings, err error)

GougingSettings returns the gouging settings.

func (*Client) Host

func (c *Client) Host(ctx context.Context, hostKey types.PublicKey) (h hostdb.HostInfo, err error)

Host returns information about a particular host known to the server.

func (*Client) HostAllowlist

func (c *Client) HostAllowlist(ctx context.Context) (allowlist []types.PublicKey, err error)

HostAllowlist returns the allowlist.

func (*Client) HostBlocklist

func (c *Client) HostBlocklist(ctx context.Context) (blocklist []string, err error)

HostBlocklist returns a host blocklist.

func (*Client) Hosts

func (c *Client) Hosts(ctx context.Context, offset, limit int) (hosts []hostdb.Host, err error)

Hosts returns 'limit' hosts at given 'offset'.

func (*Client) HostsForScanning

func (c *Client) HostsForScanning(ctx context.Context, maxLastScan time.Time, offset, limit int) (hosts []hostdb.HostAddress, err error)

HostsForScanning returns 'limit' host addresses at given 'offset' which haven't been scanned after lastScan.

func (*Client) KeepaliveContract

func (c *Client) KeepaliveContract(ctx context.Context, fcid types.FileContractID, lockID uint64, d time.Duration) (err error)

KeepaliveContract extends the duration on an already acquired lock on a contract.

func (*Client) ListBuckets added in v0.6.0

func (c *Client) ListBuckets(ctx context.Context) (buckets []api.Bucket, err error)

ListBuckets lists all available buckets.

func (*Client) ListObjects added in v0.6.0

func (c *Client) ListObjects(ctx context.Context, bucket, prefix, marker string, limit int) (resp api.ObjectsListResponse, err error)

ListOBjects lists objects in the given bucket.

func (*Client) LockAccount

func (c *Client) LockAccount(ctx context.Context, id rhpv3.Account, hostKey types.PublicKey, exclusive bool, duration time.Duration) (account api.Account, lockID uint64, err error)

func (*Client) MarkPackedSlabsUploaded

func (c *Client) MarkPackedSlabsUploaded(ctx context.Context, slabs []api.UploadedPackedSlab, usedContracts map[types.PublicKey]types.FileContractID) (err error)

func (*Client) MultipartUpload added in v0.6.0

func (c *Client) MultipartUpload(ctx context.Context, uploadID string) (resp api.MultipartUpload, err error)

func (*Client) MultipartUploadParts added in v0.6.0

func (c *Client) MultipartUploadParts(ctx context.Context, bucket, object string, uploadID string, marker int, limit int64) (resp api.MultipartListPartsResponse, err error)

func (*Client) MultipartUploads added in v0.6.0

func (c *Client) MultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker string, maxUploads int) (resp api.MultipartListUploadsResponse, err error)

func (*Client) Object

func (c *Client) Object(ctx context.Context, path string, opts ...api.ObjectsOption) (res api.ObjectsResponse, err error)

func (*Client) ObjectsBySlabKey

func (c *Client) ObjectsBySlabKey(ctx context.Context, bucket string, key object.EncryptionKey) (objects []api.ObjectMetadata, err error)

ObjectsBySlabKey returns all objects that reference a given slab.

func (*Client) ObjectsStats

func (c *Client) ObjectsStats() (osr api.ObjectsStatsResponse, err error)

ObjectsStats returns information about the number of objects and their size.

func (*Client) PackedSlabsForUpload

func (c *Client) PackedSlabsForUpload(ctx context.Context, lockingDuration time.Duration, minShards, totalShards uint8, set string, limit int) (slabs []api.PackedSlab, err error)

func (*Client) PrunableData

func (c *Client) PrunableData(ctx context.Context) (prunableData api.ContractsPrunableDataResponse, err error)

PrunableData returns an overview of all contract sizes, the total size and the amount of data that can be pruned.

func (*Client) RecommendedFee

func (c *Client) RecommendedFee(ctx context.Context) (fee types.Currency, err error)

RecommendedFee returns the recommended fee for a txn.

func (*Client) RecordContractSpending

func (c *Client) RecordContractSpending(ctx context.Context, records []api.ContractSpendingRecord) (err error)

RecordContractSpending records contract spending metrics for contracts.

func (*Client) RecordHostScans

func (c *Client) RecordHostScans(ctx context.Context, scans []hostdb.HostScan) (err error)

RecordHostInteraction records an interaction for the supplied host.

func (*Client) RecordPriceTables

func (c *Client) RecordPriceTables(ctx context.Context, priceTableUpdates []hostdb.PriceTableUpdate) (err error)

RecordHostInteraction records an interaction for the supplied host.

func (*Client) RedundancySettings

func (c *Client) RedundancySettings(ctx context.Context) (rs api.RedundancySettings, err error)

RedundancySettings returns the redundancy settings.

func (*Client) RefreshHealth

func (c *Client) RefreshHealth(ctx context.Context) error

RecomputeHealth recomputes the cached health of all slabs.

func (*Client) RegisterAlert

func (c *Client) RegisterAlert(ctx context.Context, alert alerts.Alert) error

RegisterAlert dimisses the alerts with the given IDs.

func (*Client) RegisterWebhook

func (c *Client) RegisterWebhook(ctx context.Context, url, module, event string) error

RegisterWebhook registers a new webhook for the given URL.

func (*Client) ReleaseContract

func (c *Client) ReleaseContract(ctx context.Context, fcid types.FileContractID, lockID uint64) (err error)

ReleaseContract releases a contract that was previously acquired using AcquireContract.

func (*Client) RemoveOfflineHosts

func (c *Client) RemoveOfflineHosts(ctx context.Context, minRecentScanFailures uint64, maxDowntime time.Duration) (removed uint64, err error)

RemoveOfflineHosts removes all hosts that have been offline for longer than the given max downtime.

func (*Client) RenameObject

func (c *Client) RenameObject(ctx context.Context, bucket, from, to string) (err error)

RenameObject renames a single object.

func (*Client) RenameObjects

func (c *Client) RenameObjects(ctx context.Context, bucket, from, to string) (err error)

RenameObjects renames all objects with the prefix 'from' to the prefix 'to'.

func (*Client) RenewedContract

func (c *Client) RenewedContract(ctx context.Context, renewedFrom types.FileContractID) (contract api.ContractMetadata, err error)

RenewedContract returns the renewed contract for the given ID.

func (*Client) ResetDrift

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

ResetDrift resets the drift of an account to zero.

func (*Client) S3AuthenticationSettings added in v0.6.0

func (c *Client) S3AuthenticationSettings(ctx context.Context) (as api.S3AuthenticationSettings, err error)

GougingSettings returns the gouging settings.

func (*Client) ScheduleSync

func (c *Client) ScheduleSync(ctx context.Context, id rhpv3.Account, hk types.PublicKey) (err error)

ScheduleSync sets the requiresSync flag of an account.

func (*Client) SearchHosts

func (c *Client) SearchHosts(ctx context.Context, filterMode string, addressContains string, keyIn []types.PublicKey, offset, limit int) (hosts []hostdb.Host, err error)

SearchHosts returns all hosts that match certain search criteria.

func (*Client) SearchObjects

func (c *Client) SearchObjects(ctx context.Context, bucket, key string, offset, limit int) (entries []api.ObjectMetadata, err error)

SearchObjects returns all objects that contains a sub-string in their key.

func (*Client) SendSiacoins

func (c *Client) SendSiacoins(ctx context.Context, scos []types.SiacoinOutput) (err error)

SendSiacoins is a helper method that sends siacoins to the given outputs.

func (*Client) SetBalance

func (c *Client) SetBalance(ctx context.Context, id rhpv3.Account, hk types.PublicKey, amount *big.Int) (err error)

SetBalance sets the given account's balance to a certain amount.

func (*Client) SetContractSet

func (c *Client) SetContractSet(ctx context.Context, set string, contracts []types.FileContractID) (err error)

SetContractSet adds the given contracts to the given set.

func (*Client) Setting

func (c *Client) Setting(ctx context.Context, key string, value interface{}) (err error)

Setting returns the value for the setting with given key.

func (*Client) Settings

func (c *Client) Settings(ctx context.Context) (settings []string, err error)

Settings returns the keys of all settings in the store.

func (*Client) Slab

func (c *Client) Slab(ctx context.Context, key object.EncryptionKey) (slab object.Slab, err error)

Slab returns the slab with the given key from the bus.

func (*Client) SlabBuffers

func (c *Client) SlabBuffers() (buffers []api.SlabBuffer, err error)

SlabBuffers returns information about the number of objects and their size.

func (*Client) SlabsForMigration

func (c *Client) SlabsForMigration(ctx context.Context, healthCutoff float64, set string, limit int) (slabs []api.UnhealthySlab, err error)

SlabsForMigration returns up to 'limit' slabs which require migration. A slab needs to be migrated if it has sectors on contracts that are not part of the given 'set'.

func (*Client) State

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

State returns the current state of the bus.

func (*Client) SyncerAddress

func (c *Client) SyncerAddress(ctx context.Context) (addr string, err error)

SyncerAddress returns the address the syncer is listening on.

func (*Client) SyncerConnect

func (c *Client) SyncerConnect(ctx context.Context, addr string) (err error)

SyncerConnect adds the address as a peer of the syncer.

func (*Client) SyncerPeers

func (c *Client) SyncerPeers(ctx context.Context) (resp []string, err error)

SyncerPeers returns the current peers of the syncer.

func (*Client) TrackUpload

func (c *Client) TrackUpload(ctx context.Context, uID api.UploadID) (err error)

TrackUpload tracks the upload with given id in the bus.

func (*Client) TransactionPool

func (c *Client) TransactionPool(ctx context.Context) (txns []types.Transaction, err error)

TransactionPool returns the transactions currently in the pool.

func (*Client) UnlockAccount

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

func (*Client) UpdateAutopilot

func (c *Client) UpdateAutopilot(ctx context.Context, autopilot api.Autopilot) (err error)

UpdateAutopilot updates the given autopilot in the store.

func (*Client) UpdateBucketPolicy added in v0.6.0

func (c *Client) UpdateBucketPolicy(ctx context.Context, bucket string, policy api.BucketPolicy) error

UpdateBucketPolicy updates the policy of an existing bucket.

func (*Client) UpdateHostAllowlist

func (c *Client) UpdateHostAllowlist(ctx context.Context, add, remove []types.PublicKey, clear bool) (err error)

UpdateHostAllowlist updates the host allowlist, adding and removing the given entries.

func (*Client) UpdateHostBlocklist

func (c *Client) UpdateHostBlocklist(ctx context.Context, add, remove []string, clear bool) (err error)

UpdateHostBlocklist updates the host blocklist, adding and removing the given entries.

func (*Client) UpdateSetting

func (c *Client) UpdateSetting(ctx context.Context, key string, value interface{}) error

UpdateSetting will update the given setting under the given key.

func (*Client) UpdateSlab

func (c *Client) UpdateSlab(ctx context.Context, slab object.Slab, contractSet string, usedContracts map[types.PublicKey]types.FileContractID) (err error)

UpdateSlab updates the given slab in the database.

func (*Client) UploadPackingSettings

func (c *Client) UploadPackingSettings(ctx context.Context) (ups api.UploadPackingSettings, err error)

UploadPackingSettings returns the upload packing settings.

func (*Client) UploadParams

func (c *Client) UploadParams(ctx context.Context) (up api.UploadParams, err error)

UploadParams returns parameters used for uploading slabs.

func (*Client) Wallet

func (c *Client) Wallet(ctx context.Context) (resp api.WalletResponse, err error)

Wallet calls the /wallet endpoint on the bus.

func (*Client) WalletAddress

func (c *Client) WalletAddress(ctx context.Context) (resp types.Address, err error)

WalletAddress returns an address controlled by the wallet.

func (*Client) WalletBalance

func (c *Client) WalletBalance(ctx context.Context) (bal types.Currency, err error)

WalletBalance returns the current wallet balance.

func (*Client) WalletDiscard

func (c *Client) WalletDiscard(ctx context.Context, txn types.Transaction) error

WalletDiscard discards the provided txn, make its inputs usable again. This should only be called on transactions that will never be broadcast.

func (*Client) WalletFund

func (c *Client) WalletFund(ctx context.Context, txn *types.Transaction, amount types.Currency) ([]types.Hash256, []types.Transaction, error)

WalletFund funds txn using inputs controlled by the wallet.

func (*Client) WalletOutputs

func (c *Client) WalletOutputs(ctx context.Context) (resp []wallet.SiacoinElement, err error)

WalletOutputs returns the set of unspent outputs controlled by the wallet.

func (*Client) WalletPending

func (c *Client) WalletPending(ctx context.Context) (resp []types.Transaction, err error)

WalletPending returns the txpool transactions that are relevant to the wallet.

func (*Client) WalletPrepareForm

func (c *Client) WalletPrepareForm(ctx context.Context, renterAddress types.Address, renterKey types.PublicKey, renterFunds, hostCollateral types.Currency, hostKey types.PublicKey, hostSettings rhpv2.HostSettings, endHeight uint64) (txns []types.Transaction, err error)

WalletPrepareForm funds and signs a contract transaction.

func (*Client) WalletPrepareRenew

func (c *Client) WalletPrepareRenew(ctx context.Context, revision types.FileContractRevision, hostAddress, renterAddress types.Address, renterKey types.PrivateKey, renterFunds, newCollateral types.Currency, hostKey types.PublicKey, pt rhpv3.HostPriceTable, endHeight, windowSize uint64) (api.WalletPrepareRenewResponse, error)

WalletPrepareRenew funds and signs a contract renewal transaction.

func (*Client) WalletRedistribute

func (c *Client) WalletRedistribute(ctx context.Context, outputs int, amount types.Currency) (id types.TransactionID, err error)

WalletRedistribute broadcasts a transaction that redistributes the money in the wallet in the desired number of outputs of given amount. If the transaction was successfully broadcasted it will return the transaction ID.

func (*Client) WalletSign

func (c *Client) WalletSign(ctx context.Context, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) error

WalletSign signs txn using the wallet's private key.

func (*Client) WalletTransactions

func (c *Client) WalletTransactions(ctx context.Context, opts ...api.WalletTransactionsOption) (resp []wallet.Transaction, err error)

WalletTransactions returns all transactions relevant to the wallet.

func (*Client) Webhooks

func (c *Client) Webhooks(ctx context.Context) (resp api.WebHookResponse, err error)

Webhooks returns all webhooks currently registered.

type EphemeralAccountStore

type EphemeralAccountStore interface {
	Accounts(context.Context) ([]api.Account, error)
	SaveAccounts(context.Context, []api.Account) error
	SetUncleanShutdown() error
}

EphemeralAccountStore persists information about accounts. Since accounts are rapidly updated and can be recovered, they are only loaded upon startup and persisted upon shutdown.

type HostDB

type HostDB interface {
	Host(ctx context.Context, hostKey types.PublicKey) (hostdb.HostInfo, error)
	Hosts(ctx context.Context, offset, limit int) ([]hostdb.Host, error)
	SearchHosts(ctx context.Context, filterMode, addressContains string, keyIn []types.PublicKey, offset, limit int) ([]hostdb.Host, error)
	HostsForScanning(ctx context.Context, maxLastScan time.Time, offset, limit int) ([]hostdb.HostAddress, error)
	RecordHostScans(ctx context.Context, scans []hostdb.HostScan) error
	RecordPriceTables(ctx context.Context, priceTableUpdate []hostdb.PriceTableUpdate) error
	RemoveOfflineHosts(ctx context.Context, minRecentScanFailures uint64, maxDowntime time.Duration) (uint64, error)

	HostAllowlist(ctx context.Context) ([]types.PublicKey, error)
	HostBlocklist(ctx context.Context) ([]string, error)
	UpdateHostAllowlistEntries(ctx context.Context, add, remove []types.PublicKey, clear bool) error
	UpdateHostBlocklistEntries(ctx context.Context, add, remove []string, clear bool) error
}

A HostDB stores information about hosts.

type MetadataStore

type MetadataStore interface {
	AddContract(ctx context.Context, c rhpv2.ContractRevision, totalCost types.Currency, startHeight uint64) (api.ContractMetadata, error)
	AddRenewedContract(ctx context.Context, c rhpv2.ContractRevision, totalCost types.Currency, startHeight uint64, renewedFrom types.FileContractID) (api.ContractMetadata, error)
	AncestorContracts(ctx context.Context, fcid types.FileContractID, minStartHeight uint64) ([]api.ArchivedContract, error)
	ArchiveContract(ctx context.Context, id types.FileContractID, reason string) error
	ArchiveContracts(ctx context.Context, toArchive map[types.FileContractID]string) error
	ArchiveAllContracts(ctx context.Context, reason string) error
	Contract(ctx context.Context, id types.FileContractID) (api.ContractMetadata, error)
	Contracts(ctx context.Context) ([]api.ContractMetadata, error)
	ContractSetContracts(ctx context.Context, set string) ([]api.ContractMetadata, error)
	ContractSets(ctx context.Context) ([]string, error)
	RecordContractSpending(ctx context.Context, records []api.ContractSpendingRecord) error
	RemoveContractSet(ctx context.Context, name string) error
	RenewedContract(ctx context.Context, renewedFrom types.FileContractID) (api.ContractMetadata, error)
	SetContractSet(ctx context.Context, set string, contracts []types.FileContractID) error

	ContractRoots(ctx context.Context, id types.FileContractID) ([]types.Hash256, error)
	ContractSizes(ctx context.Context) (map[types.FileContractID]api.ContractSize, error)
	ContractSize(ctx context.Context, id types.FileContractID) (api.ContractSize, error)

	Bucket(_ context.Context, bucket string) (api.Bucket, error)
	CreateBucket(_ context.Context, bucket string, policy api.BucketPolicy) error
	DeleteBucket(_ context.Context, bucket string) error
	ListBuckets(_ context.Context) ([]api.Bucket, error)
	UpdateBucketPolicy(ctx context.Context, bucket string, policy api.BucketPolicy) error

	ListObjects(ctx context.Context, bucket, prefix, marker string, limit int) (api.ObjectsListResponse, error)
	Object(ctx context.Context, bucket, path string) (api.Object, error)
	ObjectEntries(ctx context.Context, bucket, path, prefix, marker string, offset, limit int) ([]api.ObjectMetadata, bool, error)
	ObjectsBySlabKey(ctx context.Context, bucket string, slabKey object.EncryptionKey) ([]api.ObjectMetadata, error)
	SearchObjects(ctx context.Context, bucket, substring string, offset, limit int) ([]api.ObjectMetadata, error)
	CopyObject(ctx context.Context, srcBucket, dstBucket, srcPath, dstPath, mimeType string) (api.ObjectMetadata, error)
	UpdateObject(ctx context.Context, bucket, path, contractSet, ETag, mimeType string, o object.Object, usedContracts map[types.PublicKey]types.FileContractID) error
	RemoveObject(ctx context.Context, bucket, path string) error
	RemoveObjects(ctx context.Context, bucket, prefix string) error
	RenameObject(ctx context.Context, bucket, from, to string) error
	RenameObjects(ctx context.Context, bucket, from, to string) error

	AbortMultipartUpload(ctx context.Context, bucket, path string, uploadID string) (err error)
	AddMultipartPart(ctx context.Context, bucket, path, contractSet, eTag, uploadID string, partNumber int, slices []object.SlabSlice, partialSlab []object.PartialSlab, usedContracts map[types.PublicKey]types.FileContractID) (err error)
	CompleteMultipartUpload(ctx context.Context, bucket, path, uploadID string, parts []api.MultipartCompletedPart) (_ api.MultipartCompleteResponse, err error)
	CreateMultipartUpload(ctx context.Context, bucket, path string, ec object.EncryptionKey, mimeType string) (api.MultipartCreateResponse, error)
	MultipartUpload(ctx context.Context, uploadID string) (resp api.MultipartUpload, _ error)
	MultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker string, maxUploads int) (resp api.MultipartListUploadsResponse, _ error)
	MultipartUploadParts(ctx context.Context, bucket, object string, uploadID string, marker int, limit int64) (resp api.MultipartListPartsResponse, _ error)

	MarkPackedSlabsUploaded(ctx context.Context, slabs []api.UploadedPackedSlab, usedContracts map[types.PublicKey]types.FileContractID) error
	PackedSlabsForUpload(ctx context.Context, lockingDuration time.Duration, minShards, totalShards uint8, set string, limit int) ([]api.PackedSlab, error)
	SlabBuffers(ctx context.Context) ([]api.SlabBuffer, error)

	ObjectsStats(ctx context.Context) (api.ObjectsStatsResponse, error)

	AddPartialSlab(ctx context.Context, data []byte, minShards, totalShards uint8, contractSet string) (slabs []object.PartialSlab, bufferSize int64, err error)
	FetchPartialSlab(ctx context.Context, key object.EncryptionKey, offset, length uint32) ([]byte, error)
	Slab(ctx context.Context, key object.EncryptionKey) (object.Slab, error)
	RefreshHealth(ctx context.Context) error
	UnhealthySlabs(ctx context.Context, healthCutoff float64, set string, limit int) ([]api.UnhealthySlab, error)
	UpdateSlab(ctx context.Context, s object.Slab, contractSet string, usedContracts map[types.PublicKey]types.FileContractID) error
}

A MetadataStore stores information about contracts and objects.

type SettingStore

type SettingStore interface {
	DeleteSetting(ctx context.Context, key string) error
	Setting(ctx context.Context, key string) (string, error)
	Settings(ctx context.Context) ([]string, error)
	UpdateSetting(ctx context.Context, key, value string) error
}

A SettingStore stores settings.

type Syncer

type Syncer interface {
	SyncerAddress(ctx context.Context) (string, error)
	Peers() []string
	Connect(addr string) error
	BroadcastTransaction(txn types.Transaction, dependsOn []types.Transaction)
}

A Syncer can connect to other peers and synchronize the blockchain.

type TransactionPool

type TransactionPool interface {
	RecommendedFee() types.Currency
	Transactions() []types.Transaction
	AddTransactionSet(txns []types.Transaction) error
	UnconfirmedParents(txn types.Transaction) ([]types.Transaction, error)
}

A TransactionPool can validate and relay unconfirmed transactions.

type Wallet

type Wallet interface {
	Address() types.Address
	Balance() (spendable, confirmed, unconfirmed types.Currency, _ error)
	FundTransaction(cs consensus.State, txn *types.Transaction, amount types.Currency, pool []types.Transaction) ([]types.Hash256, error)
	Height() uint64
	Redistribute(cs consensus.State, outputs int, amount, feePerByte types.Currency, pool []types.Transaction) (types.Transaction, []types.Hash256, error)
	ReleaseInputs(txn types.Transaction)
	SignTransaction(cs consensus.State, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) error
	Transactions(before, since time.Time, offset, limit int) ([]wallet.Transaction, error)
	UnspentOutputs() ([]wallet.SiacoinElement, error)
}

A Wallet can spend and receive siacoins.

Jump to

Keyboard shortcuts

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