proto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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 IsRevisionMismatch

func IsRevisionMismatch(err error) bool

IsRevisionMismatch returns true if err was caused by the host reporting a different revision number than expected.

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 {
	SaveFn revisionSaver

	// 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 {
	SaveFn revisionSaver

	// 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

func (he *Editor) Close() error

Close cleanly terminates the revision loop with the host and closes the connection.

func (*Editor) Delete

func (he *Editor) Delete(root crypto.Hash) (modules.RenterContract, error)

Delete negotiates a revision that removes a sector from a file contract.

func (*Editor) Modify

func (he *Editor) Modify(oldRoot, newRoot crypto.Hash, offset uint64, newData []byte) (modules.RenterContract, error)

Modify negotiates a revision that edits a sector in a file contract.

func (*Editor) Upload

func (he *Editor) Upload(data []byte) (modules.RenterContract, crypto.Hash, error)

Upload negotiates a revision that adds a sector to a file contract.

Jump to

Keyboard shortcuts

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