renter

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrEmptyFilename = errors.New("filename must be a nonempty string")
	ErrUnknownPath   = errors.New("no file known with that path")
	ErrPathOverload  = errors.New("a file already exists at that location")
)
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")
)

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 DownloadBufferWriter added in v1.3.0

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

DownloadBufferWriter is a buffer-backed implementation of DownloadWriter.

func NewDownloadBufferWriter added in v1.3.0

func NewDownloadBufferWriter(size uint64, offset int64) *DownloadBufferWriter

NewDownloadBufferWriter creates a new DownloadWriter that writes to a buffer.

func (*DownloadBufferWriter) Bytes added in v1.3.0

func (dw *DownloadBufferWriter) Bytes() []byte

Bytes returns the underlying byte slice of the DownloadBufferWriter.

func (*DownloadBufferWriter) Destination added in v1.3.0

func (dw *DownloadBufferWriter) Destination() string

Destination implements the Destination method of the DownloadWriter interface and informs callers where this download writer is being written to.

func (*DownloadBufferWriter) WriteAt added in v1.3.0

func (dw *DownloadBufferWriter) WriteAt(bytes []byte, off int64) (int, error)

WriteAt writes the passed bytes to the DownloadBuffer.

type DownloadFileWriter added in v1.3.0

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

DownloadFileWriter is a file-backed implementation of DownloadWriter.

func NewDownloadFileWriter added in v1.3.0

func NewDownloadFileWriter(fname string, offset, length uint64) *DownloadFileWriter

NewDownloadFileWriter creates a new instance of a DownloadWriter backed by the file named.

func (*DownloadFileWriter) Destination added in v1.3.0

func (dw *DownloadFileWriter) Destination() string

Destination implements the Location method of the DownloadWriter interface and informs callers where this download writer is being written to.

func (*DownloadFileWriter) WriteAt added in v1.3.0

func (dw *DownloadFileWriter) WriteAt(b []byte, off int64) (int, error)

WriteAt writes the passed bytes at the specified offset.

type DownloadHttpWriter added in v1.3.0

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

DownloadHttpWriter is a http response writer-backed implementation of DownloadWriter. The writer writes all content that is written to the current `offset` directly to the ResponseWriter, and buffers all content that is written at other offsets. After every write to the ResponseWriter the `offset` and `length` fields are updated, and buffer content written until

func NewDownloadHttpWriter added in v1.3.0

func NewDownloadHttpWriter(w io.Writer, offset, length uint64) *DownloadHttpWriter

NewDownloadHttpWriter creates a new instance of http.ResponseWriter backed DownloadWriter.

func (*DownloadHttpWriter) Destination added in v1.3.0

func (dw *DownloadHttpWriter) Destination() string

Destination implements the Location method of the DownloadWriter interface and informs callers where this download writer is being written to.

func (*DownloadHttpWriter) WriteAt added in v1.3.0

func (dw *DownloadHttpWriter) WriteAt(b []byte, off int64) (int, error)

WriteAt buffers parts of the file until the entire file can be flushed to the client. Returns the number of bytes written or an error.

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(g modules.Gateway, cs modules.ConsensusSet, wallet modules.Wallet, tpool modules.TransactionPool, persistDir string) (*Renter, error)

New returns an initialized renter.

func (*Renter) ActiveHosts added in v1.0.0

func (r *Renter) ActiveHosts() []modules.HostDBEntry

hostdb passthroughs

func (*Renter) AllContracts added in v1.1.0

func (r *Renter) AllContracts() []modules.RenterContract

func (*Renter) AllHosts added in v1.0.0

func (r *Renter) AllHosts() []modules.HostDBEntry

func (*Renter) Close added in v1.0.0

func (r *Renter) Close() error

Close closes the Renter and its dependencies

func (*Renter) Contracts added in v1.0.0

func (r *Renter) Contracts() []modules.RenterContract

contractor passthroughs

func (*Renter) CurrentPeriod added in v1.1.0

func (r *Renter) CurrentPeriod() types.BlockHeight

func (*Renter) DeleteFile added in v0.3.1

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

DeleteFile removes a file entry from the renter and deletes its data from the hosts it is stored on.

TODO: The data is not cleared from any contracts where the host is not immediately online.

func (*Renter) Download

Download performs a file download using the passed parameters.

func (*Renter) DownloadQueue

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

DownloadQueue returns the list of downloads in the queue.

func (*Renter) EstimateHostScore added in v1.3.0

func (r *Renter) EstimateHostScore(e modules.HostDBEntry) modules.HostScoreBreakdown

func (*Renter) FileList

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

FileList returns all of the files that the renter has.

func (*Renter) Host added in v1.1.1

func (r *Renter) Host(spk types.SiaPublicKey) (modules.HostDBEntry, bool)

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.1

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) PriceEstimation added in v1.1.1

func (r *Renter) PriceEstimation() modules.RenterPriceEstimation

PriceEstimation estimates the cost in siacoins of performing various storage and data operations.

TODO: Make this function line up with the actual settings in the renter. Perhaps even make it so it uses the renter's actual contracts if it has any.

func (*Renter) RenameFile added in v0.3.1

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) ScoreBreakdown added in v1.1.1

func (r *Renter) ScoreBreakdown(e modules.HostDBEntry) modules.HostScoreBreakdown

func (*Renter) SetSettings added in v1.0.0

func (r *Renter) SetSettings(s modules.RenterSettings) error

SetSettings will update the settings for the renter.

func (*Renter) Settings added in v1.0.0

func (r *Renter) Settings() modules.RenterSettings

func (*Renter) ShareFiles added in v0.3.1

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

ShareFile saves the specified files to shareDest.

func (*Renter) ShareFilesAscii added in v0.3.1

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 instructs the renter to start tracking a file. The renter will automatically upload and repair tracked files using a background loop.

Directories

Path Synopsis
Package contractor is responsible for forming and renewing file contracts with hosts.
Package contractor is responsible for forming and renewing file contracts with hosts.
Package hostdb provides a HostDB object that implements the renter.hostDB interface.
Package hostdb provides a HostDB object that implements the renter.hostDB interface.

Jump to

Keyboard shortcuts

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