Documentation ¶
Index ¶
- Constants
- Variables
- type Host
- func (h *Host) Announce(addr modules.NetAddress) (err error)
- func (h *Host) Info() modules.HostInfo
- func (h *Host) NegotiateContract(conn modules.NetConn) (err error)
- func (h *Host) RetrieveFile(conn modules.NetConn) (err error)
- func (h *Host) SetSettings(settings modules.HostSettings)
- func (h *Host) Settings(conn modules.NetConn) error
Constants ¶
const ( // StorageProofReorgDepth states how many blocks to wait before submitting // a storage proof. This reduces the chance of needing to resubmit because // of a reorg. StorageProofReorgDepth = 20 )
Variables ¶
var (
HostCapacityErr = errors.New("host is at capacity and can not take more files")
)
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct { modules.HostSettings // 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(state *consensus.State, tpool modules.TransactionPool, wallet modules.Wallet, saveDir string) (h *Host, err error)
New returns an initialized Host.
func (*Host) Announce ¶
func (h *Host) Announce(addr modules.NetAddress) (err 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) NegotiateContract ¶
NegotiateContract is an RPC that negotiates a file contract. If the negotiation is successful, the file is downloaded and the host begins submitting proofs of storage.
func (*Host) RetrieveFile ¶
RetrieveFile is an RPC that uploads a specified file to a client.
Mutexes are applied carefully to avoid any disk intensive or network intensive operations. All necessary interaction with the host involves looking up the filepath of the file being requested. This is done all at once.
func (*Host) SetSettings ¶
func (h *Host) SetSettings(settings modules.HostSettings)
SetConfig updates the host's internal HostSettings object. To modify a specific field, use a combination of Info and SetConfig