Documentation ¶
Overview ¶
Package renter is responsible for uploading and downloading files on the sia network.
Index ¶
- Constants
- Variables
- func AlertCauseSiafileLowRedundancy(siaPath modules.SiaPath, health float64) string
- func NewDownloadDestinationBuffer() *downloadDestinationBuffer
- func NewSectionWriter(w io.WriterAt, off int64, n int64) *sectionWriter
- type MockRPCClient
- type RPCClient
- type Renter
- func (r *Renter) ActiveHosts() ([]modules.HostDBEntry, error)
- func (r *Renter) AddSkykey(sk pubaccesskey.Pubaccesskey) error
- func (r *Renter) Alerts() (crit, err, warn []modules.Alert)
- func (r *Renter) AllHosts() ([]modules.HostDBEntry, error)
- func (r *Renter) BackupsOnHost(hostKey types.SiaPublicKey) ([]modules.UploadedBackup, error)
- func (r *Renter) Blacklist() ([]crypto.Hash, error)
- func (r *Renter) CancelContract(id types.FileContractID) error
- func (r *Renter) ClearDownloadHistory(after, before time.Time) error
- func (r *Renter) Close() error
- func (r *Renter) ContractStatus(fcID types.FileContractID) (modules.ContractWatchStatus, bool)
- func (r *Renter) ContractUtility(pk types.SiaPublicKey) (modules.ContractUtility, bool)
- func (r *Renter) ContractorChurnStatus() modules.ContractorChurnStatus
- func (r *Renter) Contracts() []modules.RenterContract
- func (r *Renter) CreateBackup(dst string, secret []byte) error
- func (r *Renter) CreateDir(siaPath modules.SiaPath, mode os.FileMode) error
- func (r *Renter) CreatePublinkFromSiafile(lup modules.PubfileUploadParameters, siaPath modules.SiaPath) (modules.Publink, error)
- func (r *Renter) CreateSkykey(name string, skType pubaccesskey.PubaccesskeyType) (pubaccesskey.Pubaccesskey, error)
- func (r *Renter) CurrentPeriod() types.BlockHeight
- func (r *Renter) DeleteDir(siaPath modules.SiaPath) error
- func (r *Renter) DeleteFile(siaPath modules.SiaPath) error
- func (r *Renter) DeleteSkykeyByID(id pubaccesskey.PubaccesskeyID) error
- func (r *Renter) DeleteSkykeyByName(name string) error
- func (r *Renter) DirList(siaPath modules.SiaPath) ([]modules.DirectoryInfo, error)
- func (r *Renter) Download(p modules.RenterDownloadParameters) (modules.DownloadID, func() error, error)
- func (r *Renter) DownloadAsync(p modules.RenterDownloadParameters, f func(error) error) (id modules.DownloadID, start func() error, cancel func(), err error)
- func (r *Renter) DownloadBackup(dst string, name string) (err error)
- func (r *Renter) DownloadByRoot(root crypto.Hash, offset, length uint64, timeout time.Duration) ([]byte, error)
- func (r *Renter) DownloadByRootLegacy(root crypto.Hash, offset, length uint64, timeout time.Duration) ([]byte, error)
- func (r *Renter) DownloadByUID(uid modules.DownloadID) (modules.DownloadInfo, bool)
- func (r *Renter) DownloadHistory() []modules.DownloadInfo
- func (r *Renter) DownloadPublink(link modules.Publink, timeout time.Duration) (modules.PubfileMetadata, modules.Streamer, error)
- func (r *Renter) EstimateHostScore(e modules.HostDBEntry, a modules.Allowance) (modules.HostScoreBreakdown, error)
- func (r *Renter) File(siaPath modules.SiaPath) (modules.FileInfo, error)
- func (r *Renter) FileCached(siaPath modules.SiaPath) (modules.FileInfo, error)
- func (r *Renter) FileList(siaPath modules.SiaPath, recursive, cached bool) ([]modules.FileInfo, error)
- func (r *Renter) Filter() (modules.FilterMode, map[string]types.SiaPublicKey, error)
- func (r *Renter) Host(spk types.SiaPublicKey) (modules.HostDBEntry, bool, error)
- func (r *Renter) InitRecoveryScan() error
- func (r *Renter) InitialScanComplete() (bool, error)
- func (r *Renter) LoadBackup(src string, secret []byte) (err error)
- func (r *Renter) MemoryStatus() (modules.MemoryStatus, error)
- func (r *Renter) Mount(mountPoint string, sp modules.SiaPath, opts modules.MountOptions) error
- func (r *Renter) MountInfo() []modules.MountInfo
- func (r *Renter) OldContracts() []modules.RenterContract
- func (r *Renter) PauseRepairsAndUploads(duration time.Duration) error
- func (r *Renter) PeriodSpending() (modules.ContractorSpending, error)
- func (r *Renter) PinPublink(publink modules.Publink, lup modules.PubfileUploadParameters, ...) error
- func (r *Renter) Portals() ([]modules.SkynetPortal, error)
- func (r *Renter) PriceEstimation(allowance modules.Allowance) (modules.RenterPriceEstimation, modules.Allowance, error)
- func (r *Renter) ProcessConsensusChange(cc modules.ConsensusChange)
- func (r *Renter) RecoverableContracts() []modules.RecoverableContract
- func (r *Renter) RecoveryScanStatus() (bool, types.BlockHeight)
- func (r *Renter) RefreshedContract(fcid types.FileContractID) bool
- func (r *Renter) RenameDir(oldPath, newPath modules.SiaPath) error
- func (r *Renter) RenameFile(currentName, newName modules.SiaPath) error
- func (r *Renter) ResumeRepairsAndUploads() error
- func (r *Renter) ScoreBreakdown(e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
- func (r *Renter) SetFileStuck(siaPath modules.SiaPath, stuck bool) error
- func (r *Renter) SetFileTrackingPath(siaPath modules.SiaPath, newPath string) error
- func (r *Renter) SetFilterMode(lm modules.FilterMode, hosts []types.SiaPublicKey) error
- func (r *Renter) SetIPRestriction(numhosts int)
- func (r *Renter) SetSettings(s modules.RenterSettings) error
- func (r *Renter) Settings() (modules.RenterSettings, error)
- func (r *Renter) SkykeyByID(id pubaccesskey.PubaccesskeyID) (pubaccesskey.Pubaccesskey, error)
- func (r *Renter) SkykeyByName(name string) (pubaccesskey.Pubaccesskey, error)
- func (r *Renter) SkykeyIDByName(name string) (pubaccesskey.PubaccesskeyID, error)
- func (r *Renter) Skykeys() ([]pubaccesskey.Pubaccesskey, error)
- func (r *Renter) Streamer(siaPath modules.SiaPath, disableLocalFetch bool) (string, modules.Streamer, error)
- func (r *Renter) StreamerByNode(node *filesystem.FileNode, disableLocalFetch bool) (modules.Streamer, error)
- func (r *Renter) Unmount(mountPoint string) error
- func (r *Renter) UpdateSkynetBlacklist(additions, removals []modules.Publink) error
- func (r *Renter) UpdateSkynetPortals(additions []modules.SkynetPortal, removals []modules.NetAddress) error
- func (r *Renter) Upload(up modules.FileUploadParams) error
- func (r *Renter) UploadBackup(src, name string) error
- func (r *Renter) UploadSkyfile(lup modules.PubfileUploadParameters) (modules.Publink, error)
- func (r *Renter) UploadStreamFromReader(up modules.FileUploadParams, reader io.Reader) error
- func (r *Renter) UploadedBackups() ([]modules.UploadedBackup, []types.SiaPublicKey, error)
- func (r *Renter) WorkerPoolStatus() (modules.WorkerPoolStatus, error)
- type StreamShard
Constants ¶
const ( // AlertMSGSiafileLowRedundancy indicates that a file is below 75% redundancy. AlertMSGSiafileLowRedundancy = "The SiaFile mentioned in the 'Cause' is below 75% redundancy" // AlertSiafileLowRedundancyThreshold is the health threshold at which we start // registering the LowRedundancy alert for a Siafile. AlertSiafileLowRedundancyThreshold = 0.75 )
const ( // DefaultMaxDownloadSpeed is set to zero to indicate no limit, the user // can set a custom MaxDownloadSpeed through the API DefaultMaxDownloadSpeed = 0 // DefaultMaxUploadSpeed is set to zero to indicate no limit, the user // can set a custom MaxUploadSpeed through the API DefaultMaxUploadSpeed = 0 )
Default bandwidth usage parameters.
const ( // PersistFilename is the filename to be used when persisting renter // information to a JSON file PersistFilename = "renter.json" // SiaDirMetadata is the name of the metadata file for the sia directory SiaDirMetadata = ".siadir" )
const ( // SkyfileLayoutSize describes the amount of space within the first sector // of a pubfile used to describe the rest of the pubfile. SkyfileLayoutSize = 99 // SkyfileDefaultBaseChunkRedundancy establishes the default redundancy for // the base chunk of a pubfile. SkyfileDefaultBaseChunkRedundancy = 10 // SkyfileVersion establishes the current version for creating pubfiles. // The pubfile versions are different from the siafile versions. SkyfileVersion = 1 )
const ( // DefaultStreamCacheSize is the default cache size of the /renter/stream cache in // chunks, the user can set a custom cache size through the API DefaultStreamCacheSize = 2 )
Deprecated consts.
TODO: Tear out all related code and drop these consts.
const ( // PriceEstimationSafetyFactor is the factor of safety used in the price // estimation to account for any missed costs PriceEstimationSafetyFactor = 1.2 )
Constants which don't fit into another category very well.
Variables ¶
var ( // DefaultDataPieces is the number of data pieces per erasure-coded chunk DefaultDataPieces = build.Select(build.Var{ Dev: 1, Standard: 10, Testing: 1, }).(int) // DefaultParityPieces is the number of parity pieces per erasure-coded // chunk DefaultParityPieces = build.Select(build.Var{ Dev: 1, Standard: 20, Testing: 4, }).(int) // RepairThreshold defines the threshold at which the renter decides to // repair a file. The renter will start repairing the file when the health // is equal to or greater than this value. RepairThreshold = build.Select(build.Var{ Dev: 0.25, Standard: 0.25, Testing: 0.25, }).(float64) )
Default redundancy parameters.
var ( // ErrBadFile is an error when a file does not qualify as .sia file ErrBadFile = errors.New("not a .sia file") // ErrIncompatible is an error when file is not compatible with current // version ErrIncompatible = errors.New("file is not compatible with current version") // ErrNoNicknames is an error when no nickname is given ErrNoNicknames = errors.New("at least one nickname must be supplied") // the defined share extension ErrNonShareSuffix = errors.New("suffix of file must be " + modules.SiaFileExtension) )
var ( // ErrRootNotFound is returned if all workers were unable to recover the // root ErrRootNotFound = errors.New("workers were unable to recover the data by sector root - all workers failed") // ErrProjectTimedOut is returned when the project timed out ErrProjectTimedOut = errors.New("project timed out") )
var ( // ErrPublinkBlacklisted is the error returned when a publink is blacklisted ErrPublinkBlacklisted = errors.New("publink is blacklisted") // ErrMetadataTooBig is the error returned when the metadata exceeds a // sectorsize. ErrMetadataTooBig = errors.New("metadata exceeds sectorsize") // ErrRedundancyNotSupported is the error returned when trying to convert a // Siafile that was uploaded with redundancy that is not currently supported // by Pubaccess ErrRedundancyNotSupported = errors.New("publinks currently only support 1-of-N redundancy, other redundancies will be supported in a later version") // ExtendedSuffix is the suffix that is added to a pubfile siapath if it is // a large file upload ExtendedSuffix = "-extended" )
var ( // DefaultPauseDuration is the default duration that the repairs and uploads // will be paused DefaultPauseDuration = build.Select(build.Var{ Standard: 10 * time.Minute, Dev: 1 * time.Minute, Testing: 100 * time.Millisecond, }).(time.Duration) )
var ( // ErrJobDiscarded is returned by a job if worker conditions have resulted // in the worker being able to run this type of job. Perhaps another job of // the same type failed recently, or some prerequisite like an ephemeral // account refill is not being met. The error may or may not be extended to // provide a reason. ErrJobDiscarded = errors.New("job is being discarded") )
var ( // ErrUploadDirectory is returned if the user tries to upload a directory. ErrUploadDirectory = errors.New("cannot upload directory") )
Functions ¶
func AlertCauseSiafileLowRedundancy ¶ added in v1.5.0
AlertCauseSiafileLowRedundancy creates a customized "cause" for a siafile with a certain path and health.
func NewDownloadDestinationBuffer ¶ added in v1.3.3
func NewDownloadDestinationBuffer() *downloadDestinationBuffer
NewDownloadDestinationBuffer allocates the necessary number of shards for the downloadDestinationBuffer and returns the new buffer.
Types ¶
type MockRPCClient ¶ added in v1.5.0
type MockRPCClient struct{}
MockRPCClient mocks the RPC Client
func (*MockRPCClient) FundEphemeralAccount ¶ added in v1.5.0
FundEphemeralAccount funds the given ephemeral account by given amount.
func (*MockRPCClient) UpdatePriceTable ¶ added in v1.5.0
func (m *MockRPCClient) UpdatePriceTable() error
UpdatePriceTable updates the price table.
type RPCClient ¶ added in v1.5.0
type RPCClient interface { // UpdatePriceTable updates the price table. UpdatePriceTable() error // FundEphemeralAccount funds the given ephemeral account by given amount. FundEphemeralAccount(id modules.AccountID, amount types.Currency) error }
RPCClient interface lists all possible RPC that can be called on the host
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 ScPrime, 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, mux *siamux.SiaMux, rl *ratelimit.RateLimit, persistDir string) (*Renter, <-chan error)
New returns an initialized renter.
func NewCustomRenter ¶ added in v1.3.3
func NewCustomRenter(g modules.Gateway, cs modules.ConsensusSet, tpool modules.TransactionPool, hdb modules.HostDB, w modules.Wallet, hc hostContractor, mux *siamux.SiaMux, persistDir string, rl *ratelimit.RateLimit, deps modules.Dependencies) (*Renter, <-chan error)
NewCustomRenter initializes a renter and returns it.
func (*Renter) ActiveHosts ¶ added in v1.0.0
func (r *Renter) ActiveHosts() ([]modules.HostDBEntry, error)
ActiveHosts returns an array of hostDB's active hosts
func (*Renter) AddSkykey ¶ added in v1.5.0
func (r *Renter) AddSkykey(sk pubaccesskey.Pubaccesskey) error
AddSkykey adds the pubaccesskey with the given name, cipher type, and entropy to the renter's pubaccesskey manager.
func (*Renter) Alerts ¶ added in v1.5.0
Alerts implements the modules.Alerter interface for the renter. It returns all alerts of the renter and its submodules.
func (*Renter) AllHosts ¶ added in v1.0.0
func (r *Renter) AllHosts() ([]modules.HostDBEntry, error)
AllHosts returns an array of all hosts
func (*Renter) BackupsOnHost ¶ added in v1.5.0
func (r *Renter) BackupsOnHost(hostKey types.SiaPublicKey) ([]modules.UploadedBackup, error)
BackupsOnHost returns the backups stored on a particular host. This operation can take multiple minutes if the renter is performing many other operations on this host, however this operation is given high priority over other types of operations.
func (*Renter) CancelContract ¶ added in v1.3.4
func (r *Renter) CancelContract(id types.FileContractID) error
CancelContract cancels a renter's contract by ID by setting goodForRenew and goodForUpload to false
func (*Renter) ClearDownloadHistory ¶ added in v1.3.4
ClearDownloadHistory clears the renter's download history inclusive of the provided before and after timestamps
TODO: This function can be improved by implementing a binary search, the trick will be making the binary search be just as readable while handling all the edge cases
func (*Renter) ContractStatus ¶ added in v1.5.0
func (r *Renter) ContractStatus(fcID types.FileContractID) (modules.ContractWatchStatus, bool)
ContractStatus returns the status of the given contract within the watchdog, and a bool indicating whether or not it is being monitored.
func (*Renter) ContractUtility ¶ added in v1.3.2
func (r *Renter) ContractUtility(pk types.SiaPublicKey) (modules.ContractUtility, bool)
ContractUtility returns the utility field for a given contract, along with a bool indicating if it exists.
func (*Renter) ContractorChurnStatus ¶ added in v1.5.0
func (r *Renter) ContractorChurnStatus() modules.ContractorChurnStatus
ContractorChurnStatus returns contract churn stats for the current period.
func (*Renter) Contracts ¶ added in v1.0.0
func (r *Renter) Contracts() []modules.RenterContract
Contracts returns an array of host contractor's staticContracts
func (*Renter) CreateBackup ¶ added in v1.4.0
CreateBackup creates a backup of the renter's siafiles. If a secret is not nil, the backup will be encrypted using the provided secret.
func (*Renter) CreatePublinkFromSiafile ¶ added in v1.5.0
func (r *Renter) CreatePublinkFromSiafile(lup modules.PubfileUploadParameters, siaPath modules.SiaPath) (modules.Publink, error)
CreatePublinkFromSiafile creates a pubfile from a siafile. This requires uploading a new pubfile which contains fanout information pointing to the siafile data. The SiaPath provided in 'lup' indicates where the new base sector pubfile will be placed, and the siaPath provided as its own input is the siaPath of the file that is being used to create the pubfile.
func (*Renter) CreateSkykey ¶ added in v1.5.0
func (r *Renter) CreateSkykey(name string, skType pubaccesskey.PubaccesskeyType) (pubaccesskey.Pubaccesskey, error)
CreateSkykey creates a new Pubaccesskey with the given name and ciphertype.
func (*Renter) CurrentPeriod ¶ added in v1.1.0
func (r *Renter) CurrentPeriod() types.BlockHeight
CurrentPeriod returns the host contractor's current period
func (*Renter) DeleteDir ¶ added in v1.4.0
DeleteDir removes a directory from the renter and deletes all its sub directories and files
func (*Renter) DeleteFile ¶ added in v0.3.1
DeleteFile removes a file entry from the renter and deletes its data from the hosts it is stored on.
func (*Renter) DeleteSkykeyByID ¶ added in v1.5.0
func (r *Renter) DeleteSkykeyByID(id pubaccesskey.PubaccesskeyID) error
DeleteSkykeyByID deletes the Pubaccesskey with the given ID from the renter's pubaccesskey manager if it exists.
func (*Renter) DeleteSkykeyByName ¶ added in v1.5.0
DeleteSkykeyByName deletes the Pubaccesskey with the given name from the renter's pubaccesskey manager if it exists.
func (*Renter) Download ¶
func (r *Renter) Download(p modules.RenterDownloadParameters) (modules.DownloadID, func() error, error)
Download creates a file download using the passed parameters and blocks until the download is finished. The download needs to be started by calling the returned method.
func (*Renter) DownloadAsync ¶ added in v1.3.3
func (r *Renter) DownloadAsync(p modules.RenterDownloadParameters, f func(error) error) (id modules.DownloadID, start func() error, cancel func(), err error)
DownloadAsync creates a file download using the passed parameters without blocking until the download is finished. The download needs to be started using the method returned by DownloadAsync. DownloadAsync also accepts an optional input function which will be registered to be called when the download is finished.
func (*Renter) DownloadBackup ¶ added in v1.5.0
DownloadBackup downloads the specified backup.
func (*Renter) DownloadByRoot ¶ added in v1.5.0
func (r *Renter) DownloadByRoot(root crypto.Hash, offset, length uint64, timeout time.Duration) ([]byte, error)
DownloadByRoot will fetch data using the merkle root of that data. This uses all of the async worker primitives to improve speed and throughput.
func (*Renter) DownloadByRootLegacy ¶ added in v1.5.0
func (r *Renter) DownloadByRootLegacy(root crypto.Hash, offset, length uint64, timeout time.Duration) ([]byte, error)
DownloadByRootLegacy will spin up a project to locate a root and then download that root.
This is the legacy version of the function that uses the synchronous renter protocol. We are only keeping the code becauase v1.4.9 needs to support this version. Starting with v1.5.0, this code will be removed.
func (*Renter) DownloadByUID ¶ added in v1.5.0
func (r *Renter) DownloadByUID(uid modules.DownloadID) (modules.DownloadInfo, bool)
DownloadByUID returns a single download from the history by it's UID.
func (*Renter) DownloadHistory ¶ added in v1.3.2
func (r *Renter) DownloadHistory() []modules.DownloadInfo
DownloadHistory returns the list of downloads that have been performed. Will include downloads that have not yet completed. Downloads will be roughly, but not precisely, sorted according to start time.
TODO: Currently the DownloadHistory only contains downloads from this session, does not contain downloads that were executed for the purposes of repairing, and has no way to clear the download history if it gets long or unwieldy. It's not entirely certain which of the missing features are actually desirable, please consult core team + app dev community before deciding what to implement.
func (*Renter) DownloadPublink ¶ added in v1.5.0
func (r *Renter) DownloadPublink(link modules.Publink, timeout time.Duration) (modules.PubfileMetadata, modules.Streamer, error)
DownloadPublink will take a link and turn it into the metadata and data of a download.
func (*Renter) EstimateHostScore ¶ added in v1.3.0
func (r *Renter) EstimateHostScore(e modules.HostDBEntry, a modules.Allowance) (modules.HostScoreBreakdown, error)
EstimateHostScore returns the estimated host score
func (*Renter) File ¶ added in v1.3.3
File returns file from siaPath queried by user. Update based on FileList
func (*Renter) FileCached ¶ added in v1.5.0
FileCached returns file from siaPath queried by user, using cached values for health and redundancy.
func (*Renter) FileList ¶
func (r *Renter) FileList(siaPath modules.SiaPath, recursive, cached bool) ([]modules.FileInfo, error)
FileList returns all of the files that the renter has.
func (*Renter) Filter ¶ added in v1.5.0
func (r *Renter) Filter() (modules.FilterMode, map[string]types.SiaPublicKey, error)
Filter returns the renter's hostdb's filterMode and filteredHosts
func (*Renter) Host ¶ added in v1.1.1
func (r *Renter) Host(spk types.SiaPublicKey) (modules.HostDBEntry, bool, error)
Host returns the host associated with the given public key
func (*Renter) InitRecoveryScan ¶ added in v1.4.0
InitRecoveryScan starts scanning the whole blockchain for recoverable contracts within a separate thread.
func (*Renter) InitialScanComplete ¶ added in v1.3.3
InitialScanComplete returns a boolean indicating if the initial scan of the hostdb is completed.
func (*Renter) LoadBackup ¶ added in v1.4.0
LoadBackup loads the siafiles of a previously created backup into the renter. If the backup is encrypted, secret will be used to decrypt it. Otherwise the argument is ignored.
func (*Renter) MemoryStatus ¶ added in v1.5.0
func (r *Renter) MemoryStatus() (modules.MemoryStatus, error)
MemoryStatus returns the current status of the memory manager
func (*Renter) Mount ¶ added in v1.5.0
Mount mounts the files under the specified siapath under the 'mountPoint' folder on the local filesystem.
func (*Renter) MountInfo ¶ added in v1.5.0
MountInfo returns the list of currently mounted fusefilesystems.
func (*Renter) OldContracts ¶ added in v1.3.4
func (r *Renter) OldContracts() []modules.RenterContract
OldContracts returns an array of host contractor's oldContracts
func (*Renter) PauseRepairsAndUploads ¶ added in v1.5.0
PauseRepairsAndUploads pauses the renter's repairs and uploads for a time duration
func (*Renter) PeriodSpending ¶ added in v1.3.1
func (r *Renter) PeriodSpending() (modules.ContractorSpending, error)
PeriodSpending returns the host contractor's period spending
func (*Renter) PinPublink ¶ added in v1.5.0
func (r *Renter) PinPublink(publink modules.Publink, lup modules.PubfileUploadParameters, timeout time.Duration) error
PinPublink wil fetch the file associated with the Publink, and then pin all necessary content to maintain that Publink.
func (*Renter) Portals ¶ added in v1.5.0
func (r *Renter) Portals() ([]modules.SkynetPortal, error)
Portals returns the list of known pubaccess portals.
func (*Renter) PriceEstimation ¶ added in v1.1.1
func (r *Renter) PriceEstimation(allowance modules.Allowance) (modules.RenterPriceEstimation, modules.Allowance, error)
PriceEstimation estimates the cost in siacoins of performing various storage and data operations. The estimation will be done using the provided allowance, if an empty allowance is provided then the renter's current allowance will be used if one is set. The final allowance used will be returned.
func (*Renter) ProcessConsensusChange ¶ added in v1.3.1
func (r *Renter) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange returns the process consensus change
func (*Renter) RecoverableContracts ¶ added in v1.4.0
func (r *Renter) RecoverableContracts() []modules.RecoverableContract
RecoverableContracts returns the host contractor's recoverable contracts.
func (*Renter) RecoveryScanStatus ¶ added in v1.4.0
func (r *Renter) RecoveryScanStatus() (bool, types.BlockHeight)
RecoveryScanStatus returns a bool indicating if a scan for recoverable contracts is in progress and if it is, the current progress of the scan.
func (*Renter) RefreshedContract ¶ added in v1.5.0
func (r *Renter) RefreshedContract(fcid types.FileContractID) bool
RefreshedContract returns a bool indicating if the contract was previously refreshed
func (*Renter) RenameDir ¶ added in v1.5.0
RenameDir takes an existing directory and changes the path. The original directory must exist, and there must not be any directory that already has the replacement path. All sia files within directory will also be renamed
func (*Renter) RenameFile ¶ added in v0.3.1
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) ResumeRepairsAndUploads ¶ added in v1.5.0
ResumeRepairsAndUploads resumes the renter's repairs and uploads
func (*Renter) ScoreBreakdown ¶ added in v1.1.1
func (r *Renter) ScoreBreakdown(e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
ScoreBreakdown returns the score breakdown
func (*Renter) SetFileStuck ¶ added in v1.5.0
SetFileStuck sets the Stuck field of the whole siafile to stuck.
func (*Renter) SetFileTrackingPath ¶ added in v1.3.5
SetFileTrackingPath sets the on-disk location of an uploaded file to a new value. Useful if files need to be moved on disk. SetFileTrackingPath will check that a file exists at the new location and it ensures that it has the right size, but it can't check that the content is the same. Therefore the caller is responsible for not accidentally corrupting the uploaded file by providing a different file with the same size.
func (*Renter) SetFilterMode ¶ added in v1.4.0
func (r *Renter) SetFilterMode(lm modules.FilterMode, hosts []types.SiaPublicKey) error
SetFilterMode sets the renter's hostdb filter mode
func (*Renter) SetIPRestriction ¶ added in v1.5.0
SetIPRestriction is a passthrough method to the hostdb's method of the same name.
func (*Renter) SetSettings ¶ added in v1.0.0
func (r *Renter) SetSettings(s modules.RenterSettings) error
SetSettings will update the settings for the renter.
NOTE: This function can't be atomic. Typically we try to have user requests be atomic, so that either everything changes or nothing changes, but since these changes happen progressively, it's possible for some of the settings (like the allowance) to succeed, but then if the bandwidth limits for example are bad, then the allowance will update but the bandwidth will not update.
func (*Renter) Settings ¶ added in v1.0.0
func (r *Renter) Settings() (modules.RenterSettings, error)
Settings returns the Renter's current settings.
func (*Renter) SkykeyByID ¶ added in v1.5.0
func (r *Renter) SkykeyByID(id pubaccesskey.PubaccesskeyID) (pubaccesskey.Pubaccesskey, error)
SkykeyByID gets the Pubaccesskey with the given ID from the renter's pubaccesskey manager if it exists.
func (*Renter) SkykeyByName ¶ added in v1.5.0
func (r *Renter) SkykeyByName(name string) (pubaccesskey.Pubaccesskey, error)
SkykeyByName gets the Pubaccesskey with the given name from the renter's pubaccesskey manager if it exists.
func (*Renter) SkykeyIDByName ¶ added in v1.5.0
func (r *Renter) SkykeyIDByName(name string) (pubaccesskey.PubaccesskeyID, error)
SkykeyIDByName gets the PubaccesskeyID of the key with the given name if it exists.
func (*Renter) Skykeys ¶ added in v1.5.0
func (r *Renter) Skykeys() ([]pubaccesskey.Pubaccesskey, error)
Skykeys returns a slice containing each Pubaccesskey being stored by the renter.
func (*Renter) Streamer ¶ added in v1.3.3
func (r *Renter) Streamer(siaPath modules.SiaPath, disableLocalFetch bool) (string, modules.Streamer, error)
Streamer creates a modules.Streamer that can be used to stream downloads from the sia network.
func (*Renter) StreamerByNode ¶ added in v1.5.0
func (r *Renter) StreamerByNode(node *filesystem.FileNode, disableLocalFetch bool) (modules.Streamer, error)
StreamerByNode will open a streamer for the renter, taking a FileNode as input instead of a siapath. This is important for fuse, which has filenodes that could be getting renamed before the streams are opened.
func (*Renter) Unmount ¶ added in v1.5.0
Unmount unmounts the fuse filesystem currently mounted at mountPoint.
func (*Renter) UpdateSkynetBlacklist ¶ added in v1.5.0
UpdateSkynetBlacklist updates the list of publinks that are blacklisted
func (*Renter) UpdateSkynetPortals ¶ added in v1.5.0
func (r *Renter) UpdateSkynetPortals(additions []modules.SkynetPortal, removals []modules.NetAddress) error
UpdateSkynetPortals updates the list of known pubaccess portals that are listed.
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.
func (*Renter) UploadBackup ¶ added in v1.5.0
UploadBackup creates a backup of the renter which is uploaded to the sia network as a snapshot and can be retrieved using only the seed.
func (*Renter) UploadSkyfile ¶ added in v1.5.0
UploadSkyfile will upload the provided data with the provided metadata, returning a publink which can be used by any viewnode to recover the full original file and metadata. The publink will be unique to the combination of both the file data and metadata.
func (*Renter) UploadStreamFromReader ¶ added in v1.5.0
UploadStreamFromReader reads from the provided reader until io.EOF is reached and upload the data to the ScPrime network.
func (*Renter) UploadedBackups ¶ added in v1.5.0
func (r *Renter) UploadedBackups() ([]modules.UploadedBackup, []types.SiaPublicKey, error)
UploadedBackups returns the backups that the renter can download, along with a list of which contracts are storing all known backups.
func (*Renter) WorkerPoolStatus ¶ added in v1.5.0
func (r *Renter) WorkerPoolStatus() (modules.WorkerPoolStatus, error)
WorkerPoolStatus returns the current status of the Renter's worker pool
type StreamShard ¶ added in v1.5.0
type StreamShard struct {
// contains filtered or unexported fields
}
StreamShard is a helper type that allows us to split an io.Reader up into multiple readers, wait for the shard to finish reading and then check the error for that Read. SignalChan will be closed when the shard has been closed.
func NewStreamShard ¶ added in v1.5.0
func NewStreamShard(r io.Reader, peek []byte) *StreamShard
NewStreamShard creates a new stream shard from a reader.
func (*StreamShard) Close ¶ added in v1.5.0
func (ss *StreamShard) Close() error
Close closes the underlying channel of the shard.
func (*StreamShard) Peek ¶ added in v1.5.0
func (ss *StreamShard) Peek() ([]byte, error)
Peek will check to see if there is more data in the stream.
func (*StreamShard) Read ¶ added in v1.5.0
func (ss *StreamShard) Read(b []byte) (int, error)
Read implements the io.Reader interface.
func (*StreamShard) Result ¶ added in v1.5.0
func (ss *StreamShard) Result() (int, error)
Result returns the returned values of calling Read on the shard.
Source Files ¶
- alert.go
- backup.go
- consts.go
- directoryheap.go
- dirs.go
- download.go
- downloadchunk.go
- downloaddestination.go
- downloadheap.go
- downloadstreamer.go
- files.go
- fuse.go
- fusemanager.go
- memory.go
- metadata.go
- persist.go
- persist_compat.go
- projectdownloadbyroot.go
- projectdownloadbyrootlegacy.go
- pubfile.go
- pubfilefanout.go
- pubfilefanoutfetch.go
- refreshpaths.go
- renter.go
- repair.go
- rpcclient.go
- skyfileencryption.go
- snapshot.go
- snapshotsession.go
- streambuffer.go
- streambufferlru.go
- stuckstack.go
- upload.go
- uploadchunk.go
- uploadheap.go
- uploadheapworsthealth.go
- uploadstreamer.go
- worker.go
- workeraccount.go
- workeraccountpersist.go
- workercache.go
- workercooldown.go
- workerdownload.go
- workerdownloadbyroot.go
- workerfetchbackups.go
- workerjobgeneric.go
- workerjobhassector.go
- workerjobread.go
- workerjobreadoffset.go
- workerjobreadsector.go
- workerjobuploadsnapshot.go
- workerloop.go
- workermaintenance.go
- workerpool.go
- workerpricetable.go
- workerrevisionmismatch.go
- workerrpc.go
- workerstatus.go
- workerupload.go
Directories ¶
Path | Synopsis |
---|---|
Package hostdb provides a HostDB object that implements the renter.hostDB interface.
|
Package hostdb provides a HostDB object that implements the renter.hostDB interface. |