lotus/api
Aarsh Shah d7076778e2
integrate DAG store and CARv2 in deal-making (#6671)
This commit removes badger from the deal-making processes, and
moves to a new architecture with the dagstore as the cental
component on the miner-side, and CARv2s on the client-side.

Every deal that has been handed off to the sealing subsystem becomes
a shard in the dagstore. Shards are mounted via the LotusMount, which
teaches the dagstore how to load the related piece when serving
retrievals.

When the miner starts the Lotus for the first time with this patch,
we will perform a one-time migration of all active deals into the
dagstore. This is a lightweight process, and it consists simply
of registering the shards in the dagstore.

Shards are backed by the unsealed copy of the piece. This is currently
a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so
when it's time to acquire a shard to serve a retrieval, the unsealed
CARv1 is joined with its index (safeguarded by the dagstore), to form
a read-only blockstore, thus taking the place of the monolithic
badger.

Data transfers have been adjusted to interface directly with CARv2 files.
On inbound transfers (client retrievals, miner storage deals), we stream
the received data into a CARv2 ReadWrite blockstore. On outbound transfers
(client storage deals, miner retrievals), we serve the data off a CARv2
ReadOnly blockstore.

Client-side imports are managed by the refactored *imports.Manager
component (when not using IPFS integration). Just like it before, we use
the go-filestore library to avoid duplicating the data from the original
file in the resulting UnixFS DAG (concretely the leaves). However, the
target of those imports are what we call "ref-CARv2s": CARv2 files placed
under the `$LOTUS_PATH/imports` directory, containing the intermediate
nodes in full, and the leaves as positional references to the original file
on disk.

Client-side retrievals are placed into CARv2 files in the location:
`$LOTUS_PATH/retrievals`.

A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore`
subcommands have been introduced on the miner-side to inspect and manage
the dagstore.

Despite moving to a CARv2-backed system, the IPFS integration has been
respected, and it continues to be possible to make storage deals with data
held in an IPFS node, and to perform retrievals directly into an IPFS node.

NOTE: because the "staging" and "client" Badger blockstores are no longer
used, existing imports on the client will be rendered useless. On startup,
Lotus will enumerate all imports and print WARN statements on the log for
each import that needs to be reimported. These log lines contain these
messages:

- import lacks carv2 path; import will not work; please reimport
- import has missing/broken carv2; please reimport

At the end, we will print a "sanity check completed" message indicating
the count of imports found, and how many were deemed broken.

Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>

Co-authored-by: Raúl Kripalani <raul@protocol.ai>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 23:34:32 +01:00
..
client api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
docgen integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
docgen-openrpc api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
mocks integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
types API proxy struct codegen (#5854) 2021-03-23 13:42:56 +01:00
v0api integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
v1api Merge apistruct with the api package 2021-03-25 15:10:08 +01:00
api_common.go api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
api_full.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
api_gateway.go feat: add ChainGetTipSetAfterHeight 2021-08-05 12:07:14 -07:00
api_net.go address net interface split review 2021-07-15 15:51:47 +02:00
api_storage.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
api_test.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
api_wallet.go lotus-wallet: Support permissioned api 2021-05-31 13:56:35 +02:00
api_worker.go remove read task type and run gen and docsgen 2021-06-07 15:03:06 +05:30
cbor_gen.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
checkstatuscode_string.go implement MessagePool.CheckMessages 2021-05-07 15:30:04 +02:00
miner_subsystems.go fix docs and nits. 2021-07-28 20:03:25 +01:00
permissioned.go api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
proxy_gen.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
proxy_util_test.go address net interface split review 2021-07-15 15:51:47 +02:00
proxy_util.go api: Separate the Net interface from Common 2021-07-15 11:41:30 +02:00
README.md api: Add basic package readme 2021-03-25 18:00:29 +01:00
types.go feat(cli): add a list retrievals command 2021-05-27 11:48:25 -07:00
utils.go Update to specs v0.9.6 2020-09-07 15:48:41 -04:00
version.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
wrap.go api: Fix Wrap for nested proxy structs 2021-06-28 19:00:37 +02:00

Lotus API

This package contains all lotus API definitions. Interfaces defined here are exposed as JsonRPC 2.0 endpoints by lotus programs.

Versions

File Alias File Interface Exposed by Version HTTP Endpoint Status Docs
api_common.go v0api/latest.go Common lotus; lotus-miner v0 /rpc/v0 Latest, Stable Methods
api_full.go v1api/latest.go FullNode lotus v1 /rpc/v1 Latest, Work in progress Methods
api_storage.go v0api/latest.go StorageMiner lotus-miner v0 /rpc/v0 Latest, Stable Methods
api_worker.go v0api/latest.go Worker lotus-worker v0 /rpc/v0 Latest, Stable Methods
v0api/full.go FullNode lotus v0 /rpc/v0 Stable Methods