Documentation ¶
Overview ¶
Package renter is responsible for uploading and downloading files on the sia network.
Index ¶
- Constants
- Variables
- func AlertCauseSiafileLowRedundancy(siaPath modules.SiaPath, health, redundancy float64) string
- func NewDownloadDestinationBuffer() *downloadDestinationBuffer
- func NewSectionWriter(w io.WriterAt, off int64, n int64) *sectionWriter
- func SkylinkStreamerFromSlice(b []byte, md modules.SkyfileMetadata) modules.SkyfileStreamer
- func StreamerFromSlice(b []byte) modules.Streamer
- type MockRPCClient
- type RPCClient
- type Renter
- func (r *Renter) ActiveHosts() ([]modules.HostDBEntry, error)
- func (r *Renter) AddSkykey(sk skykey.Skykey) 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) Blocklist() ([]crypto.Hash, error)
- func (r *Renter) BubbleMetadata(siaPath modules.SiaPath, force, recursive bool) 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) CreateSkykey(name string, skType skykey.SkykeyType) (skykey.Skykey, error)
- func (r *Renter) CreateSkylinkFromSiafile(sup modules.SkyfileUploadParameters, siaPath modules.SiaPath) (_ modules.Skylink, err 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 skykey.SkykeyID) error
- func (r *Renter) DeleteSkykeyByName(name string) error
- func (r *Renter) DirList(siaPath modules.SiaPath) (dis []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) DownloadByUID(uid modules.DownloadID) (modules.DownloadInfo, bool)
- func (r *Renter) DownloadHistory() []modules.DownloadInfo
- func (r *Renter) DownloadSkylink(link modules.Skylink, timeout time.Duration, pricePerMS types.Currency) (modules.SkyfileLayout, modules.SkyfileMetadata, modules.Streamer, error)
- func (r *Renter) DownloadSkylinkBaseSector(link modules.Skylink, timeout time.Duration, pricePerMS types.Currency) (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, flf modules.FileListFunc) 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) PinSkylink(skylink modules.Skylink, lup modules.SkyfileUploadParameters, ...) 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) ReadRegistry(spk types.SiaPublicKey, tweak crypto.Hash, timeout time.Duration) (modules.SignedRegistryValue, error)
- 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) RestoreSkyfile(reader io.Reader) (modules.Skylink, 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) (err error)
- func (r *Renter) SetFileTrackingPath(siaPath modules.SiaPath, newPath string) (err error)
- func (r *Renter) SetFilterMode(lm modules.FilterMode, hosts []types.SiaPublicKey) error
- func (r *Renter) SetIPViolationCheck(enabled bool)
- func (r *Renter) SetSettings(s modules.RenterSettings) error
- func (r *Renter) Settings() (modules.RenterSettings, error)
- func (r *Renter) SkykeyByID(id skykey.SkykeyID) (skykey.Skykey, error)
- func (r *Renter) SkykeyByName(name string) (skykey.Skykey, error)
- func (r *Renter) SkykeyIDByName(name string) (skykey.SkykeyID, error)
- func (r *Renter) Skykeys() ([]skykey.Skykey, error)
- func (r *Renter) Streamer(siaPath modules.SiaPath, disableLocalFetch bool) (_ string, _ modules.Streamer, err error)
- func (r *Renter) StreamerByNode(node *filesystem.FileNode, disableLocalFetch bool) (modules.Streamer, error)
- func (r *Renter) Unmount(mountPoint string) error
- func (r *Renter) UpdateRegistry(spk types.SiaPublicKey, srv modules.SignedRegistryValue, timeout time.Duration) error
- func (r *Renter) UpdateSkynetBlocklist(additions, removals []crypto.Hash) 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(sup modules.SkyfileUploadParameters, reader modules.SkyfileUploadReader) (skylink modules.Skylink, err 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 ( // 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 ( // 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 ( // MaxRegistryReadTimeout is the default timeout used when reading from // the registry. MaxRegistryReadTimeout = build.Select(build.Var{ Dev: 30 * time.Second, Standard: 5 * time.Minute, Testing: 10 * time.Second, }).(time.Duration) // DefaultRegistryUpdateTimeout is the default timeout used when updating // the registry. DefaultRegistryUpdateTimeout = build.Select(build.Var{ Dev: 30 * time.Second, Standard: 5 * time.Minute, Testing: 3 * time.Second, }).(time.Duration) // ErrRegistryEntryNotFound is returned if all workers were unable to fetch // the entry. ErrRegistryEntryNotFound = errors.New("registry entry not found") // ErrRegistryLookupTimeout is similar to ErrRegistryEntryNotFound but it is // returned instead if the lookup timed out before all workers returned. ErrRegistryLookupTimeout = errors.New("registry entry not found within given time") // ErrRegistryUpdateInsufficientRedundancy is returned if updating the // registry failed due to running out of workers before reaching // MinUpdateRegistrySuccess successful updates. ErrRegistryUpdateInsufficientRedundancy = errors.New("registry update failed due reach sufficient redundancy") // ErrRegistryUpdateNoSuccessfulUpdates is returned if not a single update // was successful. ErrRegistryUpdateNoSuccessfulUpdates = errors.New("all registry updates failed") // ErrRegistryUpdateTimeout is returned when updating the registry was // aborted before reaching MinUpdateRegistrySucesses. ErrRegistryUpdateTimeout = errors.New("registry update timed out before reaching the minimum amount of updated hosts") // MinUpdateRegistrySuccesses is the minimum amount of success responses we // require from UpdateRegistry to be valid. MinUpdateRegistrySuccesses = build.Select(build.Var{ Dev: 3, Standard: 3, Testing: 3, }).(int) // ReadRegistryBackgroundTimeout is the amount of time a read registry job // can stay active in the background before being cancelled. ReadRegistryBackgroundTimeout = build.Select(build.Var{ Dev: time.Minute, Standard: 2 * time.Minute, Testing: 5 * time.Second, }).(time.Duration) )
var ( // ErrEncryptionNotSupported is the error returned when Skykey encryption is // not supported for a Skynet action. ErrEncryptionNotSupported = errors.New("skykey encryption not supported") // ErrInvalidMetadata is the error returned when the metadata is not valid. ErrInvalidMetadata = errors.New("metadata is invalid") // ErrMetadataTooBig is the error returned when the metadata exceeds a // sectorsize. ErrMetadataTooBig = errors.New("metadata exceeds sectorsize") // ErrSkylinkBlocked is the error returned when a skylink is blocked ErrSkylinkBlocked = errors.New("skylink is blocked") )
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.4.2
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.
func NewSectionWriter ¶ added in v1.4.2
NewSectionWriter returns a sectionWriter that writes to w starting at offset off and stops with EOF after n bytes.
func SkylinkStreamerFromSlice ¶ added in v1.5.6
func SkylinkStreamerFromSlice(b []byte, md modules.SkyfileMetadata) modules.SkyfileStreamer
SkylinkStreamerFromSlice creates a modules.SkyfileStreamer from a byte slice.
func StreamerFromSlice ¶ added in v1.5.4
StreamerFromSlice returns a modules.Streamer given a slice. This is non-trivial because a bytes.Reader does not implement Close.
Types ¶
type MockRPCClient ¶ added in v1.4.3
type MockRPCClient struct{}
MockRPCClient mocks the RPC Client
func (*MockRPCClient) FundEphemeralAccount ¶ added in v1.4.3
FundEphemeralAccount funds the given ephemeral account by given amount.
func (*MockRPCClient) UpdatePriceTable ¶ added in v1.4.3
func (m *MockRPCClient) UpdatePriceTable() error
UpdatePriceTable updates the price table.
type RPCClient ¶ added in v1.4.3
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 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, 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.4.8
AddSkykey adds the skykey with the given name, cipher type, and entropy to the renter's skykey manager.
func (*Renter) Alerts ¶ added in v1.4.2
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.4.1
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) Blocklist ¶ added in v1.5.1
Blocklist returns the merkleroots that are on the blocklist
func (*Renter) BubbleMetadata ¶ added in v1.5.5
BubbleMetadata will queue a bubble update for the directory. A bubble update includes calculating the updated values of a directory's metadata, updating the siadir metadata on disk, and then queuing a bubble update for the parent directory. This process will continue until the root directory is reached.
This method is only blocking for the queuing of the bubble, or the preparation of the subtree if recursive is true.
If the recursive boolean is supplied, all sub directories will be queued.
If the force boolean is supplied, the LastHealthCheckTime of the directories will be ignored so all directories will be considered.
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.4.2
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.4.2
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) CreateSkykey ¶ added in v1.4.8
CreateSkykey creates a new Skykey with the given name and ciphertype.
func (*Renter) CreateSkylinkFromSiafile ¶ added in v1.4.3
func (r *Renter) CreateSkylinkFromSiafile(sup modules.SkyfileUploadParameters, siaPath modules.SiaPath) (_ modules.Skylink, err error)
CreateSkylinkFromSiafile creates a skyfile from a siafile. This requires uploading a new skyfile which contains fanout information pointing to the siafile data. The SiaPath provided in 'sup' indicates where the new base sector skyfile will be placed, and the siaPath provided as its own input is the siaPath of the file that is being used to create the skyfile.
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
DeleteSkykeyByID deletes the Skykey with the given ID from the renter's skykey manager if it exists.
func (*Renter) DeleteSkykeyByName ¶ added in v1.5.0
DeleteSkykeyByName deletes the Skykey with the given name from the renter's skykey 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.4.1
DownloadBackup downloads the specified backup.
func (*Renter) DownloadByRoot ¶ added in v1.4.3
func (r *Renter) DownloadByRoot(root crypto.Hash, offset, length uint64, timeout time.Duration, pricePerMS types.Currency) ([]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) DownloadByUID ¶ added in v1.4.2
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) DownloadSkylink ¶ added in v1.4.3
func (r *Renter) DownloadSkylink(link modules.Skylink, timeout time.Duration, pricePerMS types.Currency) (modules.SkyfileLayout, modules.SkyfileMetadata, modules.Streamer, error)
DownloadSkylink will take a link and turn it into the metadata and data of a download.
func (*Renter) DownloadSkylinkBaseSector ¶ added in v1.5.1
func (r *Renter) DownloadSkylinkBaseSector(link modules.Skylink, timeout time.Duration, pricePerMS types.Currency) (modules.Streamer, error)
DownloadSkylinkBaseSector will take a link and turn it into the data of a basesector without any decoding of the metadata, fanout, or decryption.
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.4.2
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, flf modules.FileListFunc) error
FileList loops over all the files within the directory specified by siaPath and will then call the provided listing function on the file.
func (*Renter) Filter ¶ added in v1.4.1
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.4.2
Mount mounts the files under the specified siapath under the 'mountPoint' folder on the local filesystem.
func (*Renter) MountInfo ¶ added in v1.4.2
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.4.2
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) PinSkylink ¶ added in v1.4.3
func (r *Renter) PinSkylink(skylink modules.Skylink, lup modules.SkyfileUploadParameters, timeout time.Duration, pricePerMS types.Currency) error
PinSkylink will fetch the file associated with the Skylink, and then pin all necessary content to maintain that Skylink.
func (*Renter) Portals ¶ added in v1.4.8
func (r *Renter) Portals() ([]modules.SkynetPortal, error)
Portals returns the list of known skynet 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) ReadRegistry ¶ added in v1.5.1
func (r *Renter) ReadRegistry(spk types.SiaPublicKey, tweak crypto.Hash, timeout time.Duration) (modules.SignedRegistryValue, error)
ReadRegistry starts a registry lookup on all available workers. The jobs have 'timeout' amount of time to finish their jobs and return a response. Otherwise the response with the highest revision number will be used.
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.4.1
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.4.1
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) RestoreSkyfile ¶ added in v1.5.5
RestoreSkyfile restores a skyfile from disk such that the skylink is preserved.
func (*Renter) ResumeRepairsAndUploads ¶ added in v1.4.2
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.4.1
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) SetIPViolationCheck ¶ added in v1.4.0
SetIPViolationCheck 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.4.8
SkykeyByID gets the Skykey with the given ID from the renter's skykey manager if it exists.
func (*Renter) SkykeyByName ¶ added in v1.4.8
SkykeyByName gets the Skykey with the given name from the renter's skykey manager if it exists.
func (*Renter) SkykeyIDByName ¶ added in v1.4.8
SkykeyIDByName gets the SkykeyID of the key with the given name if it exists.
func (*Renter) Skykeys ¶ added in v1.4.9
Skykeys returns a slice containing each Skykey 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, err error)
Streamer creates a modules.Streamer that can be used to stream downloads from the sia network.
func (*Renter) StreamerByNode ¶ added in v1.4.2
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.4.2
Unmount unmounts the fuse filesystem currently mounted at mountPoint.
func (*Renter) UpdateRegistry ¶ added in v1.5.1
func (r *Renter) UpdateRegistry(spk types.SiaPublicKey, srv modules.SignedRegistryValue, timeout time.Duration) error
UpdateRegistry updates the registries on all workers with the given registry value.
func (*Renter) UpdateSkynetBlocklist ¶ added in v1.5.1
UpdateSkynetBlocklist updates the list of hashed merkleroots that are blocked
func (*Renter) UpdateSkynetPortals ¶ added in v1.4.8
func (r *Renter) UpdateSkynetPortals(additions []modules.SkynetPortal, removals []modules.NetAddress) error
UpdateSkynetPortals updates the list of known Skynet 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.4.1
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.4.3
func (r *Renter) UploadSkyfile(sup modules.SkyfileUploadParameters, reader modules.SkyfileUploadReader) (skylink modules.Skylink, err error)
UploadSkyfile will upload the provided data with the provided metadata, returning a skylink which can be used by any portal to recover the full original file and metadata. The skylink will be unique to the combination of both the file data and metadata.
func (*Renter) UploadStreamFromReader ¶ added in v1.4.1
UploadStreamFromReader reads from the provided reader until io.EOF is reached and upload the data to the Sia network.
func (*Renter) UploadedBackups ¶ added in v1.4.1
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.4.8
func (r *Renter) WorkerPoolStatus() (modules.WorkerPoolStatus, error)
WorkerPoolStatus returns the current status of the Renter's worker pool
type StreamShard ¶ added in v1.4.1
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.4.1
func NewStreamShard(r io.Reader, peek []byte) *StreamShard
NewStreamShard creates a new stream shard from a reader.
func (*StreamShard) Close ¶ added in v1.4.1
func (ss *StreamShard) Close() error
Close closes the underlying channel of the shard.
func (*StreamShard) Peek ¶ added in v1.4.2
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.4.1
func (ss *StreamShard) Read(b []byte) (int, error)
Read implements the io.Reader interface.
func (*StreamShard) Result ¶ added in v1.4.1
func (ss *StreamShard) Result() (int, error)
Result returns the returned values of calling Read on the shard.
Source Files ¶
- alert.go
- backup.go
- bubble.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
- projectchunkworkerset.go
- projectdownloadchunk.go
- projectdownloadinit.go
- projectdownloadoverdrive.go
- refreshpaths.go
- registry.go
- registrystats.go
- renter.go
- repair.go
- rpcclient.go
- skyfile.go
- skyfileencryption.go
- skyfilefanout.go
- skylinkdatasource.go
- snapshot.go
- streambuffer.go
- streambufferlru.go
- stuckstack.go
- upload.go
- uploadchunk.go
- uploadchunkdistributionqueue.go
- uploadheap.go
- uploadheapworsthealth.go
- uploadstreamer.go
- worker.go
- workeraccount.go
- workeraccountpersist.go
- workercache.go
- workercooldown.go
- workerdownload.go
- workerjobdownloadsnapshot.go
- workerjobgeneric.go
- workerjobhassector.go
- workerjobread.go
- workerjobreadoffset.go
- workerjobreadregistry.go
- workerjobreadsector.go
- workerjobrenewcontract.go
- workerjobupdateregistry.go
- workerjobuploadsnapshot.go
- workerloop.go
- workermaintenance.go
- workerpool.go
- workerpricetable.go
- workerregistrycache.go
- workerrevisionmismatch.go
- workerrpc.go
- workerstatus.go
- workersubscription.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. |