Documentation ¶
Overview ¶
Package host is an implementation of the host module, and is responsible for storing data and advertising available storage to the network.
Index ¶
- Variables
- type Host
- func (h *Host) Announce() error
- func (h *Host) AnnounceAddress(addr modules.NetAddress) error
- func (h *Host) Capacity() int64
- func (h *Host) Close() error
- func (h *Host) Contracts() uint64
- func (h *Host) DeleteContract(id types.FileContractID) error
- func (h *Host) NetAddress() modules.NetAddress
- func (h *Host) ProcessConsensusChange(cc modules.ConsensusChange)
- func (h *Host) RPCMetrics() modules.HostRPCMetrics
- func (h *Host) Revenue() (unresolved, resolved, lost types.Currency)
- func (h *Host) SetSettings(settings modules.HostSettings) error
- func (h *Host) Settings() modules.HostSettings
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHostCapacity indicates that a host does not have enough room on disk // to accept more files. ErrHostCapacity = errors.New("host is at capacity and cannot take more files") // ErrLowPayment indicates that the money given to the host is not // sufficient for the file being uploaded. ErrLowPayment = errors.New("file contract does not pay enough") )
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
A Host contains all the fields necessary for storing files for clients and performing the storage proofs on the received files.
func New ¶
func New(cs modules.ConsensusSet, tpool modules.TransactionPool, wallet modules.Wallet, address string, persistDir string) (*Host, error)
New returns an initialized Host.
func (*Host) Announce ¶
Announce creates a host announcement transaction, adding information to the arbitrary data, signing the transaction, and submitting it to the transaction pool.
func (*Host) AnnounceAddress ¶ added in v1.0.0
func (h *Host) AnnounceAddress(addr modules.NetAddress) error
AnnounceAddress submits a host announcement to the blockchain to announce a specific address. No checks for validity are performed on the address.
func (*Host) Capacity ¶
Capacity returns the amount of storage still available on the machine. The amount can be negative if the total capacity was reduced to below the active capacity.
func (*Host) Close ¶ added in v1.0.0
Close shuts down the host, preparing it for garbage collection.
func (*Host) Contracts ¶
Contracts returns the number of unresolved file contracts that the host is responsible for.
func (*Host) DeleteContract ¶
func (h *Host) DeleteContract(id types.FileContractID) error
DeleteContract deletes a file contract. The revenue and collateral on the file contract will be lost, and the data will be removed.
func (*Host) NetAddress ¶ added in v1.0.0
func (h *Host) NetAddress() modules.NetAddress
NetAddress returns the address at which the host can be reached.
func (*Host) ProcessConsensusChange ¶ added in v1.0.0
func (h *Host) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange will be called by the consensus set every time there is a change to the blockchain.
func (*Host) RPCMetrics ¶
func (h *Host) RPCMetrics() modules.HostRPCMetrics
RPCMetrics returns information about the types of rpc calls that have been made to the host.
func (*Host) Revenue ¶
Revenue returns the amount of revenue that the host has lined up, as well as the amount of revenue that the host has successfully captured.
func (*Host) SetSettings ¶
func (h *Host) SetSettings(settings modules.HostSettings) error
SetSettings updates the host's internal HostSettings object.
func (*Host) Settings ¶
func (h *Host) Settings() modules.HostSettings
Settings returns the settings of a host.