ipfs / ipfs/js-stores

feat: create new core data & blockstore that acts as a cache/buffered store

Open
#287 0 comments 2 reactions 1 assignee Claimed by @SgtPooki View on GitHub
dif/medium effort/days kind/enhancement P1 status/in-progress
Dominant language
TypeScript
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

see https://github.com/ipfs/helia-http-gateway/issues/18

We should be able to use a store like so:

```
import { BufferedBlockstore, MemoryBlockstore } from 'blockstore-core'
import { LevelBlockstore } from 'blockstore-level'

const myBlockStore = new BufferedBlockstore(new MemoryBlockstore(), new LevelBlockstore('path'), {})
```

That would take any blockstore as a "fronting" blockstore, and another blockstore as a "backing" blockstore, and would use the front blockstore for immediate writes (cache), and flush that data to the backing blockstore according to some criteria.

This should work similar to https://github.com/ChainSafe/lodestar/blob/unstable/packages/beacon-node/src/network/peers/datastore.ts?rgh-link-date=2023-10-19T14%3A35%3A02Z#L71 but be more generic (i.e. not just for peer data)

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.