Skip to content

experiment: http retrieval #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

experiment: http retrieval #495

wants to merge 1 commit into from

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented May 3, 2022

HTTP Retrieval

To serve a file over HTTP we need to

  1. Check if the piece is unsealed
  2. Get a reader over the piece data
  3. Get the offset of the CAR file inside the piece data
  4. Get the size of the CAR file with padding removed

HTTP Server as an embedded process

Dependencies required for an HTTP retrieval endpoint:

PieceStore

The Piece Store is needed to get the sector id, offset and length of a deal

SectorAccessor (defined in lotus/markets/dagstore)

The Sector Accessor is needed to get a reader over the piece.

The dependencies of the sector accessor are:

  • dtypes.MinerAddress
  • sectorblocks.SectorBuilder
    Requires a connection to the sealing RPC API
  • api.FullNode (full node API)
    Requires a connection to the full node RPC API
  • sectorstorage.PieceProvider
    Requires a connection to the sealing RPC API and Remote storage RPC API

DAGStore

The DAG store is needed to calculate the size of the unpadded CAR file:

  • Get the index from the DAG store
  • Get the largest offset in the index
  • Seek to that position in the file and read the size of the section
  • The size of the unpadded CAR file = offset + section size

HTTP Server as a separate process

To run the HTTP server as a separate process, it would need configuration for

  • Sealing RPC API
  • Full node RPC API
  • Storage config (storage.json)
  • Boost RPC API

The Boost RPC API would need the following new methods:

// Gets the sector, offset, length of a piece
GetPieceInfo(pieceCid) PieceInfo
  (calls PieceStore)

// Gets the largest offset in the index for a piece
PieceLargestBlockOffset(pieceCid) offset
  (calls DAGstore)

@dirkmc dirkmc mentioned this pull request May 4, 2022
@dirkmc dirkmc mentioned this pull request Jun 7, 2022
4 tasks
@dirkmc
Copy link
Contributor Author

dirkmc commented Jun 14, 2022

Closing in favour of #574

@dirkmc dirkmc closed this Jun 14, 2022
@nonsense nonsense deleted the exp/http-retrieval branch August 4, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant