Documentation ¶
Index ¶
- func FormContract(params ContractParams, txnBuilder transactionBuilder, tpool transactionPool) (modules.RenterContract, error)
- func Renew(contract modules.RenterContract, params ContractParams, ...) (modules.RenterContract, error)
- type ContractParams
- type Downloader
- type Editor
- func (he *Editor) Close() error
- func (he *Editor) Delete(root crypto.Hash) (modules.RenterContract, error)
- func (he *Editor) Modify(oldRoot, newRoot crypto.Hash, offset uint64, newData []byte) (modules.RenterContract, error)
- func (he *Editor) Upload(data []byte) (modules.RenterContract, crypto.Hash, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormContract ¶
func FormContract(params ContractParams, txnBuilder transactionBuilder, tpool transactionPool) (modules.RenterContract, error)
FormContract forms a contract with a host and submits the contract transaction to tpool.
func Renew ¶
func Renew(contract modules.RenterContract, params ContractParams, txnBuilder transactionBuilder, tpool transactionPool) (modules.RenterContract, error)
Renew negotiates a new contract for data already stored with a host, and submits the new contract transaction to tpool.
Types ¶
type ContractParams ¶
type ContractParams struct { Host modules.HostDBEntry Filesize uint64 StartHeight types.BlockHeight EndHeight types.BlockHeight RefundAddress types.UnlockHash }
ContractParams are supplied as an argument to FormContract.
type Downloader ¶
type Downloader struct { // metrics DownloadSpending types.Currency // contains filtered or unexported fields }
A Downloader retrieves sectors by calling the download RPC on a host. Downloaders are NOT thread- safe; calls to Sector must be serialized.
func NewDownloader ¶
func NewDownloader(host modules.HostDBEntry, contract modules.RenterContract) (*Downloader, error)
NewDownloader initiates the download request loop with a host, and returns a Downloader.
func (*Downloader) Close ¶
func (hd *Downloader) Close() error
Close cleanly terminates the download loop with the host and closes the connection.
func (*Downloader) Sector ¶
func (hd *Downloader) Sector(root crypto.Hash) (modules.RenterContract, []byte, error)
Sector retrieves the sector with the specified Merkle root, and revises the underlying contract to pay the host proportionally to the data retrieve.
type Editor ¶
type Editor struct { // metrics StorageSpending types.Currency UploadSpending types.Currency // contains filtered or unexported fields }
A Editor modifies a Contract by calling the revise RPC on a host. It Editors are NOT thread-safe; calls to Upload must happen in serial.
func NewEditor ¶
func NewEditor(host modules.HostDBEntry, contract modules.RenterContract, currentHeight types.BlockHeight) (*Editor, error)
NewEditor initiates the contract revision process with a host, and returns an Editor.
func (*Editor) Close ¶
Close cleanly terminates the revision loop with the host and closes the connection.