RPC Client
Introduce the RPCClient
. See !4092 (closed).
The goal of this MR is to introduce an entity on the renter's side that is capable of performing the newly introduced RPCs.
#3861 (closed)
#3863 (closed)
#3864 (closed)
It is the responsibility of the RPCClient
to perform the communication with the host over the stream.
The RPCClient
could have the following interface:
// RPCClient interface lists all possible RPC that can be called on the host
type RPCClient interface {
UpdatePriceTable(pp modules.PaymentProvider) (modules.RPCPriceTable, error)
FundEphemeralAccount(pp modules.PaymentProvider, pt modules.RPCPriceTable, id string, amount types.Currency) error
DownloadSectorByRoot(pp modules.PaymentProvider, pt modules.RPCPriceTable, offset, length uint64, sectorRoot crypto.Hash, merkleProof bool, fcid types.FileContractID) ([]byte, error)
}
Note that this depends on some form of "payment", which can be mocked using an interface if necessary...