lotus/extern/sector-storage
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
..
docs keep storage-fsm (renamed to storage-sealing) and sector-storage in extern. 2020-08-17 14:26:18 +01:00
ffiwrapper resolve merge conflicts 2021-06-22 11:28:23 +02:00
fr32 bypass task scheduler for reading unsealed pieces 2021-06-07 15:02:04 +05:30
fsutil Configurable storage path storage limit 2021-02-18 16:44:34 +01:00
mock resolve merge conflicts 2021-06-22 11:28:23 +02:00
partialfile do not depend on filecoin-ffi in api package 2021-06-07 11:51:25 +02:00
sealtasks remove read task type and run gen and docsgen 2021-06-07 15:03:06 +05:30
stores Update extern/sector-storage/stores/remote.go 2021-07-06 17:24:56 +02:00
storiface integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
tarutil Lint everything 2020-08-20 20:46:36 -07:00
cbor_gen.go integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
faults.go fix: don't check for t_aux when proving 2021-08-09 11:07:35 -07:00
manager_calltracker.go Collect worker task metrics 2021-03-05 12:48:17 +01:00
manager_test.go unit tests for the remote store Reader 2021-06-07 15:02:52 +05:30
manager.go remove pieceProvider from DI; small refactors 2021-07-12 11:30:26 +02:00
piece_provider_test.go fix signature 2021-07-06 18:12:30 +02:00
piece_provider.go changes as per review 2021-06-07 15:03:09 +05:30
README.md keep storage-fsm (renamed to storage-sealing) and sector-storage in extern. 2020-08-17 14:26:18 +01:00
request_queue_test.go keep storage-fsm (renamed to storage-sealing) and sector-storage in extern. 2020-08-17 14:26:18 +01:00
request_queue.go Making sealing logic work with multiple seal proof types 2020-11-16 19:03:30 +01:00
resources.go remove read task type and run gen and docsgen 2021-06-07 15:03:06 +05:30
roprov.go Making sealing logic work with multiple seal proof types 2020-11-16 19:03:30 +01:00
sched_resources.go move scheduling filtering logic down. 2021-06-21 20:49:16 +01:00
sched_test.go add a unit test. 2021-06-21 20:49:24 +01:00
sched_worker.go move scheduling filtering logic down. 2021-06-21 20:49:16 +01:00
sched.go move scheduling filtering logic down. 2021-06-21 20:49:16 +01:00
selector_alloc.go sched: use more letters for variables 2020-10-28 14:23:38 +01:00
selector_existing.go sched: use more letters for variables 2020-10-28 14:23:38 +01:00
selector_task.go Update selector_task.go 2020-11-03 09:20:48 +08:00
stats.go Making sealing logic work with multiple seal proof types 2020-11-16 19:03:30 +01:00
teststorage_test.go make sector-storage compile 2020-11-16 19:03:30 +01:00
testworker_test.go Add error codes to worker return 2020-11-17 16:17:55 +01:00
worker_calltracker.go sectorstorage: calltracker: work around cbor-gen bytearray len limit 2020-09-23 00:29:10 +02:00
worker_local.go add ability to ignore worker resources when scheduling. 2021-06-21 20:08:18 +01:00
worker_tracked.go remove read task type and run gen and docsgen 2021-06-07 15:03:06 +05:30

sector-storage

CircleCI standard-readme compliant

a concrete implementation of the specs-storage interface

The sector-storage project provides a implementation-nonspecific reference implementation of the specs-storage interface.

Disclaimer

Please report your issues with regards to sector-storage at the lotus issue tracker

Architecture

high-level architecture

Manager

Manages is the top-level piece of the storage system gluing all the other pieces together. It also implements scheduling logic.

package stores

This package implements the sector storage subsystem. Fundamentally the storage is divided into paths, each path has it's UUID, and stores a set of sector 'files'. There are currently 3 types of sector files - unsealed, sealed, and cache.

Paths can be shared between nodes by sharing the underlying filesystem.

stores.Local

The Local store implements SectorProvider for paths mounted in the local filesystem. Paths can be shared between nodes, and support shared filesystems such as NFS.

stores.Local implements all native filesystem-related operations

stores.Remote

The Remote store extends Local store, handles fetching sector files into a local store if needed, and handles removing sectors from non-local stores.

stores.Index

The Index is a singleton holding metadata about storage paths, and a mapping of sector files to paths

LocalWorker

LocalWorker implements the Worker interface with ffiwrapper.Sealer and a store.Store instance

License

The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms: