manager

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 15 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, cs modules.ConsensusSet, g modules.Gateway, tpool modules.TransactionPool, wallet modules.Wallet, dir string) (*Manager, <-chan error)

New returns an initialized Manager.

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

func (m *Manager) BlockHeight() uint64

BlockHeight returns the current block height.

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) (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) DeleteMetadata

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

DeleteMetadata deletes the renter's saved file metadata.

func (*Manager) DeleteObject

func (m *Manager) DeleteObject(pk types.PublicKey, path string) 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) 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) GetExchangeRate

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

GetExchangeRate returns the exchange rate of a given currency.

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) 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) 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) (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) 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) 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 []string) ([]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) SetFilterMode

func (m *Manager) SetFilterMode(lm modules.FilterMode, hosts []types.PublicKey, netAddresses []string) error

SetFilterMode sets the hostdb filter mode.

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

func (m *Manager) UpdateRenterSettings(rpk types.PublicKey, settings modules.RenterSettings, sk types.PrivateKey) error

UpdateRenterSettings calls hostContractor.UpdateRenterSettings.

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