Documentation ¶
Index ¶
- type Manager
- func (m *Manager) AcceptContracts(rpk types.PublicKey, contracts []modules.ContractMetadata)
- func (m *Manager) ActiveHosts() ([]modules.HostDBEntry, error)
- func (m *Manager) Alerts() (crit, err, warn, info []modules.Alert)
- func (m *Manager) AllHosts() ([]modules.HostDBEntry, error)
- func (m *Manager) AssembleParts(pk types.PublicKey, id types.Hash256) (err error)
- func (m *Manager) BlockHeight() uint64
- func (m *Manager) BufferedFilesDir() string
- func (m *Manager) BytesUploaded(pk types.PublicKey, bucket, path []byte) (string, uint64, error)
- func (m *Manager) Close() error
- func (m *Manager) Contract(fcid types.FileContractID) (modules.RenterContract, bool)
- func (m *Manager) ContractPriceEstimation(hpk types.PublicKey, endHeight uint64, storage uint64, upload uint64, ...) (types.Currency, float64, error)
- func (m *Manager) Contracts() []modules.RenterContract
- func (m *Manager) ContractsByRenter(rpk types.PublicKey) []modules.RenterContract
- func (m *Manager) CreateNewRenter(email string, pk types.PublicKey)
- func (m *Manager) DeleteBufferedFile(pk types.PublicKey, bucket, path []byte) error
- func (m *Manager) DeleteBufferedFiles(pk types.PublicKey) error
- func (m *Manager) DeleteMetadata(pk types.PublicKey) error
- func (m *Manager) DeleteMultipart(rpk types.PublicKey, id types.Hash256) error
- func (m *Manager) DeleteMultipartUploads(pk types.PublicKey) error
- func (m *Manager) DeleteObject(pk types.PublicKey, bucket, path []byte) error
- func (m *Manager) DeleteRenter(email string)
- func (m *Manager) DownloadObject(w io.Writer, rpk types.PublicKey, bucket, path []byte) error
- func (m *Manager) EstimateHostScore(a modules.Allowance, e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
- func (m *Manager) FeeEstimation() (min, max types.Currency)
- func (m *Manager) Filter() (modules.FilterMode, map[string]types.PublicKey, []string, error)
- func (m *Manager) FormContract(s *modules.RPCSession, rpk types.PublicKey, epk types.PublicKey, ...) (modules.RenterContract, error)
- func (m *Manager) FormContracts(rpk types.PublicKey, rsk types.PrivateKey, a modules.Allowance) ([]modules.RenterContract, error)
- func (m *Manager) GetAverages() modules.HostAverages
- func (m *Manager) GetBalance(email string) (modules.UserBalance, error)
- func (m *Manager) GetBufferSize() (total uint64, err error)
- func (m *Manager) GetEmailPreferences() (string, types.Currency)
- func (m *Manager) GetModifiedSlabs(rpk types.PublicKey) ([]modules.Slab, error)
- func (m *Manager) GetRenter(rpk types.PublicKey) (modules.Renter, error)
- func (m *Manager) GetSiacoinRate(currency string) (float64, error)
- func (m *Manager) GetSpendings(email string, month, year int) (us modules.UserSpendings, err error)
- func (m *Manager) GetWalletSeed() (seed modules.Seed, err error)
- func (m *Manager) Host(pk types.PublicKey) (modules.HostDBEntry, bool, error)
- func (m *Manager) IncrementStats(email string, renewed bool) (err error)
- func (m *Manager) InitialScanComplete() (bool, uint64, error)
- func (m *Manager) LockSiacoins(email string, amount float64) error
- func (m *Manager) Maintenance() bool
- func (m *Manager) OldContracts() []modules.RenterContract
- func (m *Manager) OldContractsByRenter(rpk types.PublicKey) []modules.RenterContract
- func (m *Manager) PriceEstimation(allowance modules.Allowance, invoicing bool) (float64, modules.Allowance, error)
- func (m *Manager) ProcessConsensusChange(cc modules.ConsensusChange)
- func (m *Manager) PutMultipartPart(pk types.PublicKey, id types.Hash256, part int, filename string) error
- func (m *Manager) RandomHosts(n uint64, a modules.Allowance) ([]modules.HostDBEntry, error)
- func (m *Manager) RefreshedContract(fcid types.FileContractID) bool
- func (m *Manager) RegisterMultipart(rpk types.PublicKey, key types.Hash256, bucket, path, mimeType []byte, ...) (id types.Hash256, err error)
- func (m *Manager) RegisterUpload(pk types.PublicKey, bucket, path, mimeType []byte, encrypted bool, ...) error
- func (m *Manager) RenewContract(s *modules.RPCSession, rpk types.PublicKey, fcid types.FileContractID, ...) (modules.RenterContract, error)
- func (m *Manager) RenewContracts(rpk types.PublicKey, rsk types.PrivateKey, a modules.Allowance, ...) ([]modules.RenterContract, error)
- func (m *Manager) RenewedFrom(fcid types.FileContractID) types.FileContractID
- func (m *Manager) Renters() []modules.Renter
- func (m *Manager) RetrieveMetadata(pk types.PublicKey, present []modules.BucketFiles) ([]modules.FileMetadata, error)
- func (m *Manager) RetrieveSpendings(email string, currency string) ([]modules.UserSpendings, error)
- func (m *Manager) ScoreBreakdown(e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
- func (m *Manager) SetAllowance(rpk types.PublicKey, a modules.Allowance) error
- func (m *Manager) SetEmailPreferences(email string, threshold types.Currency) error
- func (m *Manager) SetFilterMode(lm modules.FilterMode, hosts []types.PublicKey, netAddresses []string) error
- func (m *Manager) StartMaintenance(start bool) error
- func (m *Manager) UnlockSiacoins(email string, amount, total float64, height uint64) error
- func (m *Manager) UpdateBalance(email string, ub modules.UserBalance) error
- func (m *Manager) UpdateContract(rev types.FileContractRevision, sigs []types.TransactionSignature, ...) error
- func (m *Manager) UpdateMetadata(pk types.PublicKey, fm modules.FileMetadata) error
- func (m *Manager) UpdatePrices(prices modules.Pricing) error
- func (m *Manager) UpdateRenterSettings(rpk types.PublicKey, settings modules.RenterSettings, sk, ak types.PrivateKey) error
- func (m *Manager) UpdateSlab(pk types.PublicKey, slab modules.Slab, packed bool) error
- func (m *Manager) UpdateSpendings(email string, us modules.UserSpendings, month, year int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager contains the information necessary to communicate with the hosts.
func New ¶
func New(db *sql.DB, ms mail.MailSender, cs modules.ConsensusSet, g modules.Gateway, tpool modules.TransactionPool, wallet modules.Wallet, dir string, name string) (*Manager, <-chan error)
New returns an initialized Manager.
func (*Manager) AcceptContracts ¶
func (m *Manager) AcceptContracts(rpk types.PublicKey, contracts []modules.ContractMetadata)
AcceptContracts accepts a set of contracts from the renter and adds them to the contract set.
func (*Manager) ActiveHosts ¶
func (m *Manager) ActiveHosts() ([]modules.HostDBEntry, error)
ActiveHosts returns an array of hostDB's active hosts.
func (*Manager) AllHosts ¶
func (m *Manager) AllHosts() ([]modules.HostDBEntry, error)
AllHosts returns an array of all hosts.
func (*Manager) AssembleParts ¶ added in v0.9.0
AssembleParts puts together the parts of a multipart upload and marks the resulting file as pending upload.
func (*Manager) BlockHeight ¶
BlockHeight returns the current block height.
func (*Manager) BufferedFilesDir ¶ added in v0.8.0
BufferedFilesDir returns the path to the buffered files directory.
func (*Manager) BytesUploaded ¶ added in v0.8.0
BytesUploaded returns the size of the file already uploaded.
func (*Manager) Contract ¶
func (m *Manager) Contract(fcid types.FileContractID) (modules.RenterContract, bool)
Contract calls hostContractor.Contract.
func (*Manager) ContractPriceEstimation ¶
func (m *Manager) ContractPriceEstimation(hpk types.PublicKey, endHeight uint64, storage uint64, upload uint64, download uint64, minShards uint64, totalShards uint64, invoicing bool) (types.Currency, float64, error)
ContractPriceEstimation estimates the cost in siacoins of forming a contract with the given host.
func (*Manager) Contracts ¶
func (m *Manager) Contracts() []modules.RenterContract
Contracts returns the hostContractor's contracts.
func (*Manager) ContractsByRenter ¶
func (m *Manager) ContractsByRenter(rpk types.PublicKey) []modules.RenterContract
ContractsByRenter returns the contracts belonging to a specific renter.
func (*Manager) CreateNewRenter ¶
CreateNewRenter calls hostContractor.CreateNewRenter.
func (*Manager) DeleteBufferedFile ¶ added in v0.8.0
DeleteBufferedFile deletes the specified file and the associated database record.
func (*Manager) DeleteBufferedFiles ¶ added in v0.8.0
DeleteBufferedFiles deletes the files waiting to be uploaded.
func (*Manager) DeleteMetadata ¶
DeleteMetadata deletes the renter's saved file metadata.
func (*Manager) DeleteMultipart ¶ added in v0.9.0
DeleteMultipart deletes an aborted multipart upload.
func (*Manager) DeleteMultipartUploads ¶ added in v0.9.0
DeleteMultipartUploads deletes the unfinished multipart uploads.
func (*Manager) DeleteObject ¶
DeleteObject deletes the saved file metadata object.
func (*Manager) DeleteRenter ¶
DeleteRenter deletes the renter data from the memory.
func (*Manager) DownloadObject ¶
DownloadObject downloads an object and returns it.
func (*Manager) EstimateHostScore ¶
func (m *Manager) EstimateHostScore(a modules.Allowance, e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
EstimateHostScore returns the estimated host score.
func (*Manager) FeeEstimation ¶
FeeEstimation returns the minimum and the maximum estimated fees for a transaction.
func (*Manager) FormContract ¶
func (m *Manager) FormContract(s *modules.RPCSession, rpk types.PublicKey, epk types.PublicKey, hpk types.PublicKey, endHeight uint64, storage uint64, upload uint64, download uint64, minShards uint64, totalShards uint64) (modules.RenterContract, error)
FormContract creates a contract with a single host using the new Renter-Satellite protocol.
func (*Manager) FormContracts ¶
func (m *Manager) FormContracts(rpk types.PublicKey, rsk types.PrivateKey, a modules.Allowance) ([]modules.RenterContract, error)
FormContracts forms the specified number of contracts with the hosts and returns them.
func (*Manager) GetAverages ¶
func (m *Manager) GetAverages() modules.HostAverages
GetAverages retrieves the host network averages from HostDB.
func (*Manager) GetBalance ¶
func (m *Manager) GetBalance(email string) (modules.UserBalance, error)
GetBalance retrieves the balance information on the account. An empty struct is returned when there is no data.
func (*Manager) GetBufferSize ¶ added in v0.8.0
GetBufferSize returns the total size of the temporary files.
func (*Manager) GetEmailPreferences ¶
GetEmailPreferences returns the email preferences.
func (*Manager) GetModifiedSlabs ¶ added in v0.8.0
GetModifiedSlabs returns the slabs modified since the last retrieval.
func (*Manager) GetSiacoinRate ¶
GetSiacoinRate calculates the SC price in a given currency.
func (*Manager) GetSpendings ¶
GetSpendings retrieves the user's spendings.
func (*Manager) GetWalletSeed ¶
GetWalletSeed returns the wallet seed.
func (*Manager) IncrementStats ¶
IncrementStats increments the number of formed or renewed contracts.
func (*Manager) InitialScanComplete ¶
InitialScanComplete returns a boolean indicating if the initial scan of the hostdb is completed.
func (*Manager) LockSiacoins ¶
LockSiacoins locks the specified amount of Siacoins in the user balance.
func (*Manager) Maintenance ¶ added in v0.7.0
Maintenance returns true if the maintenance mode is active.
func (*Manager) OldContracts ¶
func (m *Manager) OldContracts() []modules.RenterContract
OldContracts calls hostContractor.OldContracts expired.
func (*Manager) OldContractsByRenter ¶
func (m *Manager) OldContractsByRenter(rpk types.PublicKey) []modules.RenterContract
OldContractsByRenter returns the old contracts of a specific renter.
func (*Manager) PriceEstimation ¶
func (m *Manager) PriceEstimation(allowance modules.Allowance, invoicing bool) (float64, modules.Allowance, error)
PriceEstimation estimates the cost in siacoins of forming contracts with the hosts. The estimation will be done using the provided allowance. The final allowance used will be returned.
func (*Manager) ProcessConsensusChange ¶
func (m *Manager) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange gets called to inform Manager about the changes in the consensus set.
func (*Manager) PutMultipartPart ¶ added in v0.9.0
func (m *Manager) PutMultipartPart(pk types.PublicKey, id types.Hash256, part int, filename string) error
PutMultipartPart associates the uploaded file with the part of a multipart upload.
func (*Manager) RandomHosts ¶
RandomHosts picks up to the specified number of random hosts from the hostdb sorted by score.
func (*Manager) RefreshedContract ¶
func (m *Manager) RefreshedContract(fcid types.FileContractID) bool
RefreshedContract calls hostContractor.RefreshedContract
func (*Manager) RegisterMultipart ¶ added in v0.9.0
func (m *Manager) RegisterMultipart(rpk types.PublicKey, key types.Hash256, bucket, path, mimeType []byte, encrypted bool) (id types.Hash256, err error)
RegisterMultipart registers a new multipart upload.
func (*Manager) RegisterUpload ¶ added in v0.8.0
func (m *Manager) RegisterUpload(pk types.PublicKey, bucket, path, mimeType []byte, encrypted bool, filename string, complete bool) error
RegisterUpload associates the uploaded file with the object.
func (*Manager) RenewContract ¶
func (m *Manager) RenewContract(s *modules.RPCSession, rpk types.PublicKey, fcid types.FileContractID, endHeight uint64, storage uint64, upload uint64, download uint64, minShards uint64, totalShards uint64) (modules.RenterContract, error)
RenewContract renews a contract using the new Renter-Satellite protocol.
func (*Manager) RenewContracts ¶
func (m *Manager) RenewContracts(rpk types.PublicKey, rsk types.PrivateKey, a modules.Allowance, contracts []types.FileContractID) ([]modules.RenterContract, error)
RenewContracts renews a set of contracts and returns a new set.
func (*Manager) RenewedFrom ¶
func (m *Manager) RenewedFrom(fcid types.FileContractID) types.FileContractID
RenewedFrom returns the ID of the contract the given contract was renewed from, if any.
func (*Manager) RetrieveMetadata ¶
func (m *Manager) RetrieveMetadata(pk types.PublicKey, present []modules.BucketFiles) ([]modules.FileMetadata, error)
RetrieveMetadata retrieves the file metadata from the database.
func (*Manager) RetrieveSpendings ¶
RetrieveSpendings retrieves the user's spendings in the given currency.
func (*Manager) ScoreBreakdown ¶
func (m *Manager) ScoreBreakdown(e modules.HostDBEntry) (modules.HostScoreBreakdown, error)
ScoreBreakdown returns the score breakdown of the specific host.
func (*Manager) SetAllowance ¶
SetAllowance calls hostContractor.SetAllowance.
func (*Manager) SetEmailPreferences ¶
SetEmailPreferences changes the email preferences.
func (*Manager) SetFilterMode ¶
func (m *Manager) SetFilterMode(lm modules.FilterMode, hosts []types.PublicKey, netAddresses []string) error
SetFilterMode sets the hostdb filter mode.
func (*Manager) StartMaintenance ¶ added in v0.7.0
StartMaintenance switches the maintenance mode on and off.
func (*Manager) UnlockSiacoins ¶
UnlockSiacoins unlocks the specified amount of Siacoins in the user balance.
func (*Manager) UpdateBalance ¶
func (m *Manager) UpdateBalance(email string, ub modules.UserBalance) error
UpdateBalance updates the balance information on the account.
func (*Manager) UpdateContract ¶
func (m *Manager) UpdateContract(rev types.FileContractRevision, sigs []types.TransactionSignature, uploads, downloads, fundAccount types.Currency) error
UpdateContract updates the contract with the new revision.
func (*Manager) UpdateMetadata ¶
UpdateMetadata updates the file metadata in the database.
func (*Manager) UpdatePrices ¶ added in v0.6.0
UpdatePrices updates the pricing table in the database.
func (*Manager) UpdateRenterSettings ¶
func (m *Manager) UpdateRenterSettings(rpk types.PublicKey, settings modules.RenterSettings, sk, ak types.PrivateKey) error
UpdateRenterSettings calls hostContractor.UpdateRenterSettings.
func (*Manager) UpdateSlab ¶
UpdateSlab updates a file slab after a successful migration.
func (*Manager) UpdateSpendings ¶
UpdateSpendings updates the user's spendings.
Directories ¶
Path | Synopsis |
---|---|
Package hostdb provides a HostDB object that implements the Manager.HostDB interface.
|
Package hostdb provides a HostDB object that implements the Manager.HostDB interface. |