manager

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

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) Alerts

func (m *Manager) Alerts() (crit, err, warn, info []modules.Alert)

Alerts implements the modules.Alerter interface for the manager.

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

func (m *Manager) AssembleParts(pk types.PublicKey, id types.Hash256) (err error)

AssembleParts puts together the parts of a multipart upload and marks the resulting file as pending upload.

func (*Manager) BlockHeight

func (m *Manager) BlockHeight() uint64

BlockHeight returns the current block height.

func (*Manager) BufferedFilesDir added in v0.8.0

func (m *Manager) BufferedFilesDir() string

BufferedFilesDir returns the path to the buffered files directory.

func (*Manager) BytesUploaded added in v0.8.0

func (m *Manager) BytesUploaded(pk types.PublicKey, bucket, path []byte) (string, uint64, error)

BytesUploaded returns the size of the file already uploaded.

func (*Manager) Close

func (m *Manager) Close() error

Close shuts down the manager.

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

func (m *Manager) CreateNewRenter(email string, pk types.PublicKey)

CreateNewRenter calls hostContractor.CreateNewRenter.

func (*Manager) DeleteBufferedFile added in v0.8.0

func (m *Manager) DeleteBufferedFile(pk types.PublicKey, bucket, path []byte) error

DeleteBufferedFile deletes the specified file and the associated database record.

func (*Manager) DeleteBufferedFiles added in v0.8.0

func (m *Manager) DeleteBufferedFiles(pk types.PublicKey) error

DeleteBufferedFiles deletes the files waiting to be uploaded.

func (*Manager) DeleteMetadata

func (m *Manager) DeleteMetadata(pk types.PublicKey) error

DeleteMetadata deletes the renter's saved file metadata.

func (*Manager) DeleteMultipart added in v0.9.0

func (m *Manager) DeleteMultipart(rpk types.PublicKey, id types.Hash256) error

DeleteMultipart deletes an aborted multipart upload.

func (*Manager) DeleteMultipartUploads added in v0.9.0

func (m *Manager) DeleteMultipartUploads(pk types.PublicKey) error

DeleteMultipartUploads deletes the unfinished multipart uploads.

func (*Manager) DeleteObject

func (m *Manager) DeleteObject(pk types.PublicKey, bucket, path []byte) error

DeleteObject deletes the saved file metadata object.

func (*Manager) DeleteRenter

func (m *Manager) DeleteRenter(email string)

DeleteRenter deletes the renter data from the memory.

func (*Manager) DownloadObject

func (m *Manager) DownloadObject(w io.Writer, rpk types.PublicKey, bucket, path []byte) error

DownloadObject downloads an object and returns it.

func (*Manager) EstimateHostScore

EstimateHostScore returns the estimated host score.

func (*Manager) FeeEstimation

func (m *Manager) FeeEstimation() (min, max types.Currency)

FeeEstimation returns the minimum and the maximum estimated fees for a transaction.

func (*Manager) Filter

func (m *Manager) Filter() (modules.FilterMode, map[string]types.PublicKey, []string, error)

Filter returns the hostdb's filterMode and filteredHosts.

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

func (m *Manager) GetBufferSize() (total uint64, err error)

GetBufferSize returns the total size of the temporary files.

func (*Manager) GetEmailPreferences

func (m *Manager) GetEmailPreferences() (string, types.Currency)

GetEmailPreferences returns the email preferences.

func (*Manager) GetModifiedSlabs added in v0.8.0

func (m *Manager) GetModifiedSlabs(rpk types.PublicKey) ([]modules.Slab, error)

GetModifiedSlabs returns the slabs modified since the last retrieval.

func (*Manager) GetRenter

func (m *Manager) GetRenter(rpk types.PublicKey) (modules.Renter, error)

GetRenter calls hostContractor.GetRenter.

func (*Manager) GetSiacoinRate

func (m *Manager) GetSiacoinRate(currency string) (float64, error)

GetSiacoinRate calculates the SC price in a given currency.

func (*Manager) GetSpendings

func (m *Manager) GetSpendings(email string, month, year int) (us modules.UserSpendings, err error)

GetSpendings retrieves the user's spendings.

func (*Manager) GetWalletSeed

func (m *Manager) GetWalletSeed() (seed modules.Seed, err error)

GetWalletSeed returns the wallet seed.

func (*Manager) Host

Host returns the host associated with the given public key.

func (*Manager) IncrementStats

func (m *Manager) IncrementStats(email string, renewed bool) (err error)

IncrementStats increments the number of formed or renewed contracts.

func (*Manager) InitialScanComplete

func (m *Manager) InitialScanComplete() (bool, uint64, error)

InitialScanComplete returns a boolean indicating if the initial scan of the hostdb is completed.

func (*Manager) LockSiacoins

func (m *Manager) LockSiacoins(email string, amount float64) error

LockSiacoins locks the specified amount of Siacoins in the user balance.

func (*Manager) Maintenance added in v0.7.0

func (m *Manager) Maintenance() bool

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

func (m *Manager) RandomHosts(n uint64, a modules.Allowance) ([]modules.HostDBEntry, error)

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) Renters

func (m *Manager) Renters() []modules.Renter

Renters calls hostContractor.Renters.

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

func (m *Manager) RetrieveSpendings(email string, currency string) ([]modules.UserSpendings, error)

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

func (m *Manager) SetAllowance(rpk types.PublicKey, a modules.Allowance) error

SetAllowance calls hostContractor.SetAllowance.

func (*Manager) SetEmailPreferences

func (m *Manager) SetEmailPreferences(email string, threshold types.Currency) error

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

func (m *Manager) StartMaintenance(start bool) error

StartMaintenance switches the maintenance mode on and off.

func (*Manager) UnlockSiacoins

func (m *Manager) UnlockSiacoins(email string, amount, total float64, height uint64) error

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

func (m *Manager) UpdateMetadata(pk types.PublicKey, fm modules.FileMetadata) error

UpdateMetadata updates the file metadata in the database.

func (*Manager) UpdatePrices added in v0.6.0

func (m *Manager) UpdatePrices(prices modules.Pricing) error

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

func (m *Manager) UpdateSlab(pk types.PublicKey, slab modules.Slab, packed bool) error

UpdateSlab updates a file slab after a successful migration.

func (*Manager) UpdateSpendings

func (m *Manager) UpdateSpendings(email string, us modules.UserSpendings, month, year int) error

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.

Jump to

Keyboard shortcuts

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