renter

package
v0.4.3-beta Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2015 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PersistFilename = "renter.json"
	ShareExtension  = ".sia"
)

Variables

View Source
var (
	ErrUnknownNickname  = errors.New("no file known by that nickname")
	ErrNicknameOverload = errors.New("a file with the proposed nickname already exists")
)
View Source
var (
	ErrNoNicknames    = errors.New("at least one nickname must be supplied")
	ErrNonShareSuffix = errors.New("suffix of file must be " + ShareExtension)
	ErrBadFile        = errors.New("not a .sia file")
	ErrIncompatible   = errors.New("file is not compatible with current version")
)
View Source
var (
	ErrNilCS     = errors.New("cannot create renter with nil consensus set")
	ErrNilHostDB = errors.New("cannot create renter with nil hostdb")
	ErrNilWallet = errors.New("cannot create renter with nil wallet")
	ErrNilTpool  = errors.New("cannot create renter with nil transaction pool")
)

Functions

func NewRSCode added in v1.0.0

func NewRSCode(nData, nParity int) (modules.ErasureCoder, error)

NewRSCode creates a new Reed-Solomon encoder/decoder using the supplied parameters.

Types

type Renter

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

A Renter is responsible for tracking all of the files that a user has uploaded to Sia, as well as the locations and health of these files.

func New

func New(cs modules.ConsensusSet, hdb modules.HostDB, wallet modules.Wallet, tpool modules.TransactionPool, persistDir string) (*Renter, error)

New returns an empty renter.

func (*Renter) DeleteFile added in v0.3.3

func (r *Renter) DeleteFile(nickname string) error

DeleteFile removes a file entry from the renter.

func (*Renter) Download

func (r *Renter) Download(nickname, destination string) error

Download downloads a file, identified by its nickname, to the destination specified.

func (*Renter) DownloadQueue

func (r *Renter) DownloadQueue() []modules.DownloadInfo

DownloadQueue returns the list of downloads in the queue.

func (*Renter) FileList

func (r *Renter) FileList() (files []modules.FileInfo)

FileList returns all of the files that the renter has.

func (*Renter) Info

func (r *Renter) Info() (ri modules.RentInfo)

Info returns generic information about the renter and the files that are being rented.

func (*Renter) LoadSharedFiles added in v1.0.0

func (r *Renter) LoadSharedFiles(filename string) ([]string, error)

LoadSharedFiles loads a .sia file into the renter. It returns the nicknames of the loaded files.

func (*Renter) LoadSharedFilesAscii added in v0.3.3

func (r *Renter) LoadSharedFilesAscii(asciiSia string) ([]string, error)

LoadSharedFilesAscii loads an ASCII-encoded .sia file into the renter. It returns the nicknames of the loaded files.

func (*Renter) ProcessConsensusChange added in v1.3.1

func (r *Renter) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange will be called by the consensus set every time there is a change in the blockchain. Updates will always be called in order.

func (*Renter) RenameFile added in v0.3.3

func (r *Renter) RenameFile(currentName, newName string) error

RenameFile takes an existing file and changes the nickname. The original file must exist, and there must not be any file that already has the replacement nickname.

func (*Renter) ShareFiles added in v0.3.3

func (r *Renter) ShareFiles(nicknames []string, sharedest string) error

ShareFile saves the specified files to sharedest.

func (*Renter) ShareFilesAscii added in v0.3.3

func (r *Renter) ShareFilesAscii(nicknames []string) (string, error)

ShareFilesAscii returns the specified files in ASCII format.

func (*Renter) Upload

func (r *Renter) Upload(up modules.FileUploadParams) error

Upload takes an upload parameters, which contain a file to upload, and then creates a redundant copy of the file on the Sia network.

Jump to

Keyboard shortcuts

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