renter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Download

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

A Download is a file download that has been queued by the renter.

func (*Download) Complete

func (d *Download) Complete() bool

Complete returns whether the file is ready to be used.

func (*Download) Destination

func (d *Download) Destination() string

Destination returns the file's location on disk.

func (*Download) Filesize

func (d *Download) Filesize() uint64

Filesize returns the size of the file.

func (*Download) Nickname

func (d *Download) Nickname() string

Nickname returns the identifier assigned to the file when it was uploaded.

func (*Download) Received

func (d *Download) Received() uint64

Received returns the number of bytes downloaded so far.

func (*Download) Write

func (d *Download) Write(b []byte) (int, error)

Write implements the io.Writer interface. Each write updates the Download's received field. This allows download progress to be monitored in real-time.

type File

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

A file is a single file that has been uploaded to the network.

func (*File) Available

func (f *File) Available() bool

Available indicates whether the file is ready to be downloaded.

func (*File) Nickname

func (f *File) Nickname() string

Nickname returns the nickname of the file.

func (*File) Repairing

func (f *File) Repairing() bool

Repairing returns whether or not the file is actively being repaired.

func (*File) TimeRemaining

func (f *File) TimeRemaining() consensus.BlockHeight

TimeRemaining returns the amount of time until the file's contracts expire.

type FilePiece

type FilePiece struct {
	Active     bool                     // Set to true if the host is online and has the file, false otherwise.
	Repairing  bool                     // Set to true if there's an upload happening for the piece at the moment.
	Contract   consensus.FileContract   // The contract being enforced.
	ContractID consensus.FileContractID // The ID of the contract.
	HostIP     modules.NetAddress       // Where to find the file.
}

A FilePiece contains information about an individual file piece that has been uploaded to a host, including information about the host and the health of the file piece.

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(state *consensus.State, gateway modules.Gateway, hdb modules.HostDB, wallet modules.Wallet, saveDir string) (r *Renter, err error)

New returns an empty 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) Rename

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

Rename 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) Upload

func (r *Renter) Upload(up modules.UploadParams) 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