ipfs / ipfs/boxo

[ipfs/go-bitswap] Per session blockstores for received blocks

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
need/triage
Dominant language
Go
Stars
316
Forks
163
Avg merge
4d 12h
Merged PRs (30d)
8

Description

# Goals

As we look ahead to integrating bitswap as a transport protocol in Filecoin, we often encounter situations where we want to direct wants from a certain set of requests to a specific blockstore other than the default (for example, if we're working with a DAG store, we're writing seperate CAR files for different DAGs).

We might also encounter a situation where we want to put blocks into a temporary store for a given session if we haven't yet verified them as part of a DAG the end user actually requested. (see https://github.com/protocol/beyond-bitswap/issues/25 for example)

I think the solution here is to allow us to optionally specify a different destination blockstore when we create a session.

# Suggested Implementation

My read of the code is that the SessionInterestManager makes it relatively easily to determine what sessions requested which blocks.

Blocks are received here: https://github.com/ipfs/go-bitswap/blob/44495c489844359d0eaef6d37ca620bff0341ab9/bitswap.go#L469)

My suggestion is when a block is received, we determine what sessions wanted it, and what custom blockstores (if any) it goes into, and write it once to each of these. We write to the default once for all sessions that don't specify a custom blockstore.

Moreover, I further suggest at least for the first version that we avoid both making the block available to for Bitswap wants and announcing it over the DHT UNLESS it's in the default store. (responding to wants over multiple blockstores seems complicated)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.