rhp

package
v1.0.3-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RPCFormContract

func RPCFormContract(ctx context.Context, t *rhp2.Transport, renterKey types.PrivateKey, txnSet []types.Transaction) (_ rhp2.ContractRevision, _ []types.Transaction, err error)

RPCFormContract forms a contract with a host.

func RPCSettings

func RPCSettings(ctx context.Context, t *rhp2.Transport) (settings rhp2.HostSettings, err error)

RPCSettings calls the Settings RPC, returning the host's reported settings.

Types

type RHP2Session

type RHP2Session struct {
	// contains filtered or unexported fields
}

RHP2Session represents a session with a host

func NewRHP2Session

func NewRHP2Session(t *rhp2.Transport, key types.PrivateKey, rev rhp2.ContractRevision, settings rhp2.HostSettings) *RHP2Session

NewRHP2Session returns a new rhp2 session

func (*RHP2Session) Append

func (s *RHP2Session) Append(ctx context.Context, sector *[rhp2.SectorSize]byte, price, collateral types.Currency) (types.Hash256, error)

Append appends the sector to the contract

func (*RHP2Session) Close

func (s *RHP2Session) Close() (err error)

Close closes the underlying transport

func (*RHP2Session) Delete

func (s *RHP2Session) Delete(ctx context.Context, sectorIndices []uint64, price types.Currency) error

Delete deletes the sectors at the given indices from the contract

func (*RHP2Session) HostKey

func (s *RHP2Session) HostKey() types.PublicKey

HostKey returns the host's public key

func (*RHP2Session) RPCAppendCost

func (s *RHP2Session) RPCAppendCost(remainingDuration uint64) (types.Currency, types.Currency, error)

RPCAppendCost returns the cost of a single append

func (*RHP2Session) Read

func (s *RHP2Session) Read(ctx context.Context, w io.Writer, sections []rhp2.RPCReadRequestSection, price types.Currency) (err error)

Read reads the given sections

func (*RHP2Session) Reconnect

func (s *RHP2Session) Reconnect(ctx context.Context, hostIP string, hostKey types.PublicKey, renterKey types.PrivateKey, contractID types.FileContractID) (err error)

Reconnect reconnects to the host

func (*RHP2Session) Refresh

func (s *RHP2Session) Refresh(ctx context.Context, sessionTTL time.Duration, renterKey types.PrivateKey, contractID types.FileContractID) error

Refresh refreshes the session

func (*RHP2Session) RenewContract

func (s *RHP2Session) RenewContract(ctx context.Context, txnSet []types.Transaction, finalPayment types.Currency) (_ rhp2.ContractRevision, _ []types.Transaction, err error)

RenewContract renews the contract

func (*RHP2Session) Revision

func (s *RHP2Session) Revision() (rev rhp2.ContractRevision)

Revision returns the contract revision

func (*RHP2Session) SectorRoots

func (s *RHP2Session) SectorRoots(ctx context.Context, offset, n uint64, price types.Currency) (roots []types.Hash256, err error)

SectorRoots returns n roots at offset.

func (*RHP2Session) Settings

func (s *RHP2Session) Settings() *rhp2.HostSettings

Settings returns the host settings

func (*RHP2Session) Write

func (s *RHP2Session) Write(ctx context.Context, actions []rhp2.RPCWriteAction, price, collateral types.Currency) (err error)

Write performs the given write actions

Jump to

Keyboard shortcuts

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