Skip to content

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

@SgtPooki

Description

@SgtPooki

see ipfs/helia-http-gateway#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)

Metadata

Metadata

Assignees

Labels

P1High: Likely tackled by core team if no one steps updif/mediumPrior experience is likely helpfuleffort/daysEstimated to take multiple days, but less than a weekkind/enhancementA net-new feature or improvement to an existing featurestatus/in-progressIn progress

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions