Documentation
¶
Index ¶
- Variables
- func New(s Syncer, am *alerts.Manager, hm *webhooks.Manager, cm ChainManager, ...) (*bus, error)
- type AutopilotStore
- type ChainManager
- type Client
- func (c *Client) AbortMultipartUpload(ctx context.Context, bucket, path string, uploadID string) (err error)
- func (c *Client) AcceptBlock(ctx context.Context, b types.Block) (err error)
- func (c *Client) Account(ctx context.Context, id rhpv3.Account, host types.PublicKey) (account api.Account, err error)
- func (c *Client) Accounts(ctx context.Context) (accounts []api.Account, err error)
- func (c *Client) AcquireContract(ctx context.Context, fcid types.FileContractID, priority int, d time.Duration) (lockID uint64, err error)
- func (c *Client) AddBalance(ctx context.Context, id rhpv3.Account, hk types.PublicKey, amount *big.Int) (err error)
- func (c *Client) AddContract(ctx context.Context, contract rhpv2.ContractRevision, totalCost types.Currency, ...) (added api.ContractMetadata, err error)
- func (c *Client) AddMultipartPart(ctx context.Context, bucket, path, contractSet, eTag, uploadID string, ...) (err error)
- func (c *Client) AddObject(ctx context.Context, bucket, path, contractSet, eTag, mimeType string, ...) (err error)
- func (c *Client) AddPartialSlab(ctx context.Context, data []byte, minShards, totalShards uint8, ...) (slabs []object.PartialSlab, slabBufferMaxSizeSoftReached bool, err error)
- func (c *Client) AddRenewedContract(ctx context.Context, contract rhpv2.ContractRevision, totalCost types.Currency, ...) (renewed api.ContractMetadata, err error)
- func (c *Client) AddUploadingSector(ctx context.Context, uID api.UploadID, id types.FileContractID, ...) (err error)
- func (c *Client) Alerts() (alerts []alerts.Alert, err error)
- func (c *Client) AncestorContracts(ctx context.Context, fcid types.FileContractID, minStartHeight uint64) (contracts []api.ArchivedContract, err error)
- func (c *Client) ArchiveContracts(ctx context.Context, toArchive map[types.FileContractID]string) (err error)
- func (c *Client) Autopilot(ctx context.Context, id string) (autopilot api.Autopilot, err error)
- func (c *Client) Autopilots(ctx context.Context) (autopilots []api.Autopilot, err error)
- func (c *Client) BroadcastAction(ctx context.Context, action webhooks.Event) error
- func (c *Client) BroadcastTransaction(ctx context.Context, txns []types.Transaction) error
- func (c *Client) Bucket(ctx context.Context, name string) (resp api.Bucket, err error)
- func (c *Client) CompleteMultipartUpload(ctx context.Context, bucket, path, uploadID string, ...) (resp api.MultipartCompleteResponse, err error)
- func (c *Client) ConsensusNetwork(ctx context.Context) (resp api.ConsensusNetwork, err error)
- func (c *Client) ConsensusState(ctx context.Context) (resp api.ConsensusState, err error)
- func (c *Client) Contract(ctx context.Context, id types.FileContractID) (contract api.ContractMetadata, err error)
- func (c *Client) ContractRoots(ctx context.Context, fcid types.FileContractID) (roots, uploading []types.Hash256, err error)
- func (c *Client) ContractSetContracts(ctx context.Context, set string) (contracts []api.ContractMetadata, err error)
- func (c *Client) ContractSetSettings(ctx context.Context) (gs api.ContractSetSetting, err error)
- func (c *Client) ContractSets(ctx context.Context) (sets []string, err error)
- func (c *Client) ContractSize(ctx context.Context, fcid types.FileContractID) (size api.ContractSize, err error)
- func (c *Client) Contracts(ctx context.Context) (contracts []api.ContractMetadata, err error)
- func (c *Client) CopyObject(ctx context.Context, srcBucket, dstBucket, srcPath, dstPath string, ...) (om api.ObjectMetadata, err error)
- func (c *Client) CreateBucket(ctx context.Context, name string, policy api.BucketPolicy) error
- func (c *Client) CreateMultipartUpload(ctx context.Context, bucket, path string, opts api.CreateMultipartOptions) (resp api.MultipartCreateResponse, err error)
- func (c *Client) DeleteAllContracts(ctx context.Context) (err error)
- func (c *Client) DeleteBucket(ctx context.Context, name string) error
- func (c *Client) DeleteContract(ctx context.Context, id types.FileContractID) (err error)
- func (c *Client) DeleteContractSet(ctx context.Context, set string) (err error)
- func (c *Client) DeleteContracts(ctx context.Context, ids []types.FileContractID) error
- func (c *Client) DeleteObject(ctx context.Context, bucket, path string, batch bool) (err error)
- func (c *Client) DeleteSetting(ctx context.Context, key string) error
- func (c *Client) DeleteWebhook(ctx context.Context, url, module, event string) error
- func (c *Client) DismissAlerts(ctx context.Context, ids ...types.Hash256) error
- func (c *Client) FetchPartialSlab(ctx context.Context, key object.EncryptionKey, offset, length uint32) ([]byte, error)
- func (c *Client) FileContractTax(ctx context.Context, payout types.Currency) (tax types.Currency, err error)
- func (c *Client) FinishUpload(ctx context.Context, uID api.UploadID) (err error)
- func (c *Client) GougingParams(ctx context.Context) (gp api.GougingParams, err error)
- func (c *Client) GougingSettings(ctx context.Context) (gs api.GougingSettings, err error)
- func (c *Client) Host(ctx context.Context, hostKey types.PublicKey) (h hostdb.HostInfo, err error)
- func (c *Client) HostAllowlist(ctx context.Context) (allowlist []types.PublicKey, err error)
- func (c *Client) HostBlocklist(ctx context.Context) (blocklist []string, err error)
- func (c *Client) Hosts(ctx context.Context, offset, limit int) (hosts []hostdb.Host, err error)
- func (c *Client) HostsForScanning(ctx context.Context, maxLastScan time.Time, offset, limit int) (hosts []hostdb.HostAddress, err error)
- func (c *Client) KeepaliveContract(ctx context.Context, fcid types.FileContractID, lockID uint64, d time.Duration) (err error)
- func (c *Client) ListBuckets(ctx context.Context) (buckets []api.Bucket, err error)
- func (c *Client) ListObjects(ctx context.Context, bucket, prefix, marker string, limit int) (resp api.ObjectsListResponse, err error)
- func (c *Client) LockAccount(ctx context.Context, id rhpv3.Account, hostKey types.PublicKey, exclusive bool, ...) (account api.Account, lockID uint64, err error)
- func (c *Client) MarkPackedSlabsUploaded(ctx context.Context, slabs []api.UploadedPackedSlab, ...) (err error)
- func (c *Client) MultipartUpload(ctx context.Context, uploadID string) (resp api.MultipartUpload, err error)
- func (c *Client) MultipartUploadParts(ctx context.Context, bucket, object string, uploadID string, marker int, ...) (resp api.MultipartListPartsResponse, err error)
- func (c *Client) MultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker string, ...) (resp api.MultipartListUploadsResponse, err error)
- func (c *Client) Object(ctx context.Context, path string, opts ...api.ObjectsOption) (res api.ObjectsResponse, err error)
- func (c *Client) ObjectsBySlabKey(ctx context.Context, bucket string, key object.EncryptionKey) (objects []api.ObjectMetadata, err error)
- func (c *Client) ObjectsStats() (osr api.ObjectsStatsResponse, err error)
- func (c *Client) PackedSlabsForUpload(ctx context.Context, lockingDuration time.Duration, ...) (slabs []api.PackedSlab, err error)
- func (c *Client) PrunableData(ctx context.Context) (prunableData api.ContractsPrunableDataResponse, err error)
- func (c *Client) RecommendedFee(ctx context.Context) (fee types.Currency, err error)
- func (c *Client) RecordContractSpending(ctx context.Context, records []api.ContractSpendingRecord) (err error)
- func (c *Client) RecordHostScans(ctx context.Context, scans []hostdb.HostScan) (err error)
- func (c *Client) RecordPriceTables(ctx context.Context, priceTableUpdates []hostdb.PriceTableUpdate) (err error)
- func (c *Client) RedundancySettings(ctx context.Context) (rs api.RedundancySettings, err error)
- func (c *Client) RefreshHealth(ctx context.Context) error
- func (c *Client) RegisterAlert(ctx context.Context, alert alerts.Alert) error
- func (c *Client) RegisterWebhook(ctx context.Context, url, module, event string) error
- func (c *Client) ReleaseContract(ctx context.Context, fcid types.FileContractID, lockID uint64) (err error)
- func (c *Client) RemoveOfflineHosts(ctx context.Context, minRecentScanFailures uint64, maxDowntime time.Duration) (removed uint64, err error)
- func (c *Client) RenameObject(ctx context.Context, bucket, from, to string) (err error)
- func (c *Client) RenameObjects(ctx context.Context, bucket, from, to string) (err error)
- func (c *Client) RenewedContract(ctx context.Context, renewedFrom types.FileContractID) (contract api.ContractMetadata, err error)
- func (c *Client) ResetDrift(ctx context.Context, id rhpv3.Account) (err error)
- func (c *Client) S3AuthenticationSettings(ctx context.Context) (as api.S3AuthenticationSettings, err error)
- func (c *Client) ScheduleSync(ctx context.Context, id rhpv3.Account, hk types.PublicKey) (err error)
- func (c *Client) SearchHosts(ctx context.Context, filterMode string, addressContains string, ...) (hosts []hostdb.Host, err error)
- func (c *Client) SearchObjects(ctx context.Context, bucket, key string, offset, limit int) (entries []api.ObjectMetadata, err error)
- func (c *Client) SendSiacoins(ctx context.Context, scos []types.SiacoinOutput) (err error)
- func (c *Client) SetBalance(ctx context.Context, id rhpv3.Account, hk types.PublicKey, amount *big.Int) (err error)
- func (c *Client) SetContractSet(ctx context.Context, set string, contracts []types.FileContractID) (err error)
- func (c *Client) Setting(ctx context.Context, key string, value interface{}) (err error)
- func (c *Client) Settings(ctx context.Context) (settings []string, err error)
- func (c *Client) Slab(ctx context.Context, key object.EncryptionKey) (slab object.Slab, err error)
- func (c *Client) SlabBuffers() (buffers []api.SlabBuffer, err error)
- func (c *Client) SlabsForMigration(ctx context.Context, healthCutoff float64, set string, limit int) (slabs []api.UnhealthySlab, err error)
- func (c *Client) State() (state api.BusStateResponse, err error)
- func (c *Client) SyncerAddress(ctx context.Context) (addr string, err error)
- func (c *Client) SyncerConnect(ctx context.Context, addr string) (err error)
- func (c *Client) SyncerPeers(ctx context.Context) (resp []string, err error)
- func (c *Client) TrackUpload(ctx context.Context, uID api.UploadID) (err error)
- func (c *Client) TransactionPool(ctx context.Context) (txns []types.Transaction, err error)
- func (c *Client) UnlockAccount(ctx context.Context, id rhpv3.Account, lockID uint64) (err error)
- func (c *Client) UpdateAutopilot(ctx context.Context, autopilot api.Autopilot) (err error)
- func (c *Client) UpdateBucketPolicy(ctx context.Context, bucket string, policy api.BucketPolicy) error
- func (c *Client) UpdateHostAllowlist(ctx context.Context, add, remove []types.PublicKey, clear bool) (err error)
- func (c *Client) UpdateHostBlocklist(ctx context.Context, add, remove []string, clear bool) (err error)
- func (c *Client) UpdateSetting(ctx context.Context, key string, value interface{}) error
- func (c *Client) UpdateSlab(ctx context.Context, slab object.Slab, contractSet string, ...) (err error)
- func (c *Client) UploadPackingSettings(ctx context.Context) (ups api.UploadPackingSettings, err error)
- func (c *Client) UploadParams(ctx context.Context) (up api.UploadParams, err error)
- func (c *Client) Wallet(ctx context.Context) (resp api.WalletResponse, err error)
- func (c *Client) WalletAddress(ctx context.Context) (resp types.Address, err error)
- func (c *Client) WalletBalance(ctx context.Context) (bal types.Currency, err error)
- func (c *Client) WalletDiscard(ctx context.Context, txn types.Transaction) error
- func (c *Client) WalletFund(ctx context.Context, txn *types.Transaction, amount types.Currency) ([]types.Hash256, []types.Transaction, error)
- func (c *Client) WalletOutputs(ctx context.Context) (resp []wallet.SiacoinElement, err error)
- func (c *Client) WalletPending(ctx context.Context) (resp []types.Transaction, err error)
- func (c *Client) WalletPrepareForm(ctx context.Context, renterAddress types.Address, renterKey types.PublicKey, ...) (txns []types.Transaction, err error)
- func (c *Client) WalletPrepareRenew(ctx context.Context, revision types.FileContractRevision, ...) (api.WalletPrepareRenewResponse, error)
- func (c *Client) WalletRedistribute(ctx context.Context, outputs int, amount types.Currency) (id types.TransactionID, err error)
- func (c *Client) WalletSign(ctx context.Context, txn *types.Transaction, toSign []types.Hash256, ...) error
- func (c *Client) WalletTransactions(ctx context.Context, opts ...api.WalletTransactionsOption) (resp []wallet.Transaction, err error)
- func (c *Client) Webhooks(ctx context.Context) (resp api.WebHookResponse, err error)
- type EphemeralAccountStore
- type HostDB
- type MetadataStore
- type SettingStore
- type Syncer
- type TransactionPool
- type Wallet
Constants ¶
This section is empty.
Variables ¶
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 ¶
func New(s Syncer, am *alerts.Manager, hm *webhooks.Manager, cm ChainManager, tp TransactionPool, w Wallet, hdb HostDB, as AutopilotStore, ms MetadataStore, ss SettingStore, eas EphemeralAccountStore, l *zap.Logger) (*bus, error)
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 ¶
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 (*Client) AcceptBlock ¶
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) 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 (*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 (*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) 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) Autopilots ¶
Autopilots returns all autopilots in the autopilots store.
func (*Client) BroadcastAction ¶
BroadcastAction broadcasts an action that triggers a webhook.
func (*Client) BroadcastTransaction ¶
BroadcastTransaction broadcasts the transaction set to the network.
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 ¶
ConsensusNetwork returns information about the consensus network.
func (*Client) ConsensusState ¶
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 ¶
ContractSetSettings returns the contract set settings.
func (*Client) ContractSets ¶
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) 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
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 ¶
DeleteAllContracts deletes all contracts from the bus.
func (*Client) DeleteBucket ¶ added in v0.6.0
DeleteBucket deletes an existing bucket. Fails if the bucket isn't empty.
func (*Client) DeleteContract ¶
DeleteContract deletes the contract with the given ID.
func (*Client) DeleteContractSet ¶
DeleteContractSet removes the contract set from the bus.
func (*Client) DeleteContracts ¶
DeleteContracts deletes the contracts with the given IDs.
func (*Client) DeleteObject ¶
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 ¶
DeleteSetting will delete the setting with given key.
func (*Client) DeleteWebhook ¶
DeleteWebhook deletes the webhook with the given ID.
func (*Client) DismissAlerts ¶
DismissAlerts dimisses the alerts with the given IDs.
func (*Client) FetchPartialSlab ¶
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 ¶
FinishUpload marks the given upload as finished.
func (*Client) GougingParams ¶
GougingParams returns parameters used for performing gouging checks.
func (*Client) GougingSettings ¶
GougingSettings returns the gouging settings.
func (*Client) HostAllowlist ¶
HostAllowlist returns the allowlist.
func (*Client) HostBlocklist ¶
HostBlocklist returns a host blocklist.
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
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 (*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 (*Client) MultipartUploadParts ¶ added in v0.6.0
func (*Client) MultipartUploads ¶ added in v0.6.0
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 (*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 ¶
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 ¶
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 ¶
RedundancySettings returns the redundancy settings.
func (*Client) RefreshHealth ¶
RecomputeHealth recomputes the cached health of all slabs.
func (*Client) RegisterAlert ¶
RegisterAlert dimisses the alerts with the given IDs.
func (*Client) RegisterWebhook ¶
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 ¶
RenameObject renames a single object.
func (*Client) RenameObjects ¶
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 ¶
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 ¶
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) 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 ¶
SyncerAddress returns the address the syncer is listening on.
func (*Client) SyncerConnect ¶
SyncerConnect adds the address as a peer of the syncer.
func (*Client) SyncerPeers ¶
SyncerPeers returns the current peers of the syncer.
func (*Client) TrackUpload ¶
TrackUpload tracks the upload with given id in the bus.
func (*Client) TransactionPool ¶
TransactionPool returns the transactions currently in the pool.
func (*Client) UnlockAccount ¶
func (*Client) UpdateAutopilot ¶
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 ¶
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 ¶
UploadParams returns parameters used for uploading slabs.
func (*Client) WalletAddress ¶
WalletAddress returns an address controlled by the wallet.
func (*Client) WalletBalance ¶
WalletBalance returns the current wallet balance.
func (*Client) WalletDiscard ¶
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 ¶
WalletOutputs returns the set of unspent outputs controlled by the wallet.
func (*Client) WalletPending ¶
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.
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.