pail
DAG based key value store. Sharded DAG that minimises traversals and work to build shards.
Install
npm install @alanshaw/pail
Usage
import { ShardBlock, put, get, del } from '@alanshaw/pail'
import { MemoryBlockstore } from '@alanshaw/pail/block'
const blocks = new MemoryBlockstore()
const init = await ShardBlock.create()
await blocks.put(init.cid, init.bytes)
const { root, additions, removals } = await put(blocks, init.cid, 'path/to/data0', dataCID0)
console.log(`new root: ${root}`)
for (const block of additions) {
await blocks.put(block.cid, block.bytes)
}
for (const block of removals) {
await blocks.delete(block.cid)
}
Contributing
Feel free to join in. All welcome. Open an issue!
License
Dual-licensed under MIT or Apache 2.0