Skip to content

add RPC call Metadata requesting sector IDs (second attempt)

Boris Nagaev requested to merge starius/Sia:rpc-metadata-6 into master

This MR replaces !2584 (closed) (I pushed to metadata-rpc-3 but GitLab does not update that MR. Maybe because it was created on GitHub originally.)

RPC Metadata is similar to RPC Download - the renter has to pay for it as was requested in the review of !2584 (closed)

RPC Metadata

Description of Feature

Now renters can get the list of sector IDs from host. They have to pay for this at standard download rates.

Description of Work Flow

This is an essential step towards storing metadata remotely. Final goal is to develop a system where the only thing a renter must store is a seed.

Testing Added

I added test TestIntegrationMetadata in which the renter creates a contract, uploads some sectors and requests their IDs with the Metadata call.

Modules and Packages Impacted

The main change of this MR is RPC handler on host for Metadata call. In the same commit I added renter function GetMetadata which calls RPC Metadata on server and returns the recent revision and the list of sector IDs.

I refactored private function verifyRecentRevision from package modules/renter/proto. I factored out function getRecentRevision that loads recent revision and can be used when the renter does not know what the current revision is. The function is used by GetMetadata.

Also I re-added SecretKey back to RenterContract. It is needed for the test. The secret key is passed to GetMetadata directly, not as part of any (private) data structure, so I need it in the test's code.

Merge request reports