|
| 1 | +--- |
| 2 | +description: >- |
| 3 | + This page describes the Local Index Directory component in Boost, what it is |
| 4 | + used for, how it works and how to start using it |
| 5 | +--- |
| 6 | + |
| 7 | +# Local Index Directory |
| 8 | + |
| 9 | +## Background |
| 10 | + |
| 11 | +The Local Index Directory (_LID_) manages and stores indices of deal data so that it can be retrieved by a content identifier (_cid_). |
| 12 | + |
| 13 | +Currently this task is performed by the _DAG store_ component. The DAG store keeps its indexes on disk on a single machine. LID replaces the DAG store and introduces a horizontally scalable backend database for storing the data - YugabyteDB. |
| 14 | + |
| 15 | +LID is designed to provide a more intuitive experience for the user, by surfacing problems and providing various repair tools. |
| 16 | + |
| 17 | +To summarize, LID is the component which keeps fine-grained metadata about all the deals on Filecoin that a given Storage Provider stores, and without it client would only be able to retrieve full pieces, which generally are between 8GiB and 32GiB in size. |
| 18 | + |
| 19 | +## Storing data on Filecoin |
| 20 | + |
| 21 | +When a client uploads deal data to Boost, LID records the sector that the deal data is stored in and scans the deal data to create an index of all its blocks indexed by block cid. This way cilents can later retrieve subsets of the original deal data, without retrieving the full deal data. |
| 22 | + |
| 23 | +<figure><img src="../../.gitbook/assets/Screenshot 2023-05-18 at 13.39.53.png" alt=""><figcaption><p>How Boost stores deal data from clients</p></figcaption></figure> |
| 24 | + |
| 25 | +## Retrieving data |
| 26 | + |
| 27 | +When a client makes a request for data by cid, LID:\ |
| 28 | +\- checks which piece the cid is in, and where in the piece the data is\ |
| 29 | +\- checks which sector the piece is in, and where in the sector the piece is\ |
| 30 | +\- reads the data from the sector |
| 31 | + |
| 32 | +<figure><img src="../../.gitbook/assets/Screenshot 2023-05-18 at 13.45.14.png" alt=""><figcaption><p>How clients retrieve their data from Boost</p></figcaption></figure> |
| 33 | + |
| 34 | +## Use cases |
| 35 | + |
| 36 | +The retrieval use cases that the Local Index Directory supports are: |
| 37 | + |
| 38 | +#### Graphsync retrieval |
| 39 | + |
| 40 | +_Request one root cid with a selector, receive many blocks_ |
| 41 | + |
| 42 | +LID is able to:\ |
| 43 | +\- look up which piece contains the root cid\ |
| 44 | +\- look up which sector contains the piece\ |
| 45 | +\- for each block, get the offset into the piece for the block |
| 46 | + |
| 47 | +#### Bitswap retrieval |
| 48 | + |
| 49 | +_Request one block at a time_ |
| 50 | + |
| 51 | +LID is able to:\ |
| 52 | +\- look up which piece contains the block\ |
| 53 | +\- get the size of the block (Bitswap asks for the size before getting the block data)\ |
| 54 | +\- look up which sector contains the piece\ |
| 55 | +\- get the offset into the piece for the block |
| 56 | + |
| 57 | +#### HTTP retrieval |
| 58 | + |
| 59 | +_Request a whole piece_ |
| 60 | + |
| 61 | +LID is able to look up which sector contains the piece. |
| 62 | + |
| 63 | +_Request an individual block_ |
| 64 | + |
| 65 | +LID is able to:\ |
| 66 | +\- look up which piece contains the block\ |
| 67 | +\- look up which sector contains the piece\ |
| 68 | +\- get the offset into the piece for the block |
| 69 | + |
| 70 | +_Request a file by root cid_ |
| 71 | + |
| 72 | +LID is able to:\ |
| 73 | +\- look up which piece contains the block\ |
| 74 | +\- look up which sector contains the piece\ |
| 75 | +\- for each block, get the offset into the piece for the block |
0 commit comments