host

package
v0.5.1-beta Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 19 Imported by: 42

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

Constants

This section is empty.

Variables

View Source
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

func (h *Host) Announce() error

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

func (h *Host) Capacity() int64

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

func (h *Host) Close() error

Close shuts down the host, preparing it for garbage collection.

func (*Host) Contracts

func (h *Host) Contracts() uint64

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

func (h *Host) Revenue() (unresolved, resolved, lost types.Currency)

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.

Jump to

Keyboard shortcuts

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