DKV (Decentralized Key-Value Store)
DKV is a decentralized graph store built on IPFS.
const ipfs = await IPFS let store = await DKVstore = await store storeid // 'bafyreibbbjhk7fnxplcc6fqb24jctxffgxoqv65466gbx73n3jbqyzn3ru'await store // { hello: 'world' }
Every mutation (set()
, del()
) returns a new instance because every
mutation creates a new immutable state with a unique id
(CID).
Since the data is accessible over IPFS it is shared in a p2p network
and other peers can access the data using the id of the store (store.id
).
let store = DKV
links
DKV offers a simple interface for storing key/value pairs. Values can include links to other values recursively, giving you the ability to create complex graphs that de-duplicate commonly linked data.
let store = await DKVconst pizza = await storelink type: 'food' name: 'pizza' store = await store const bob = await storeawait bob // { type: 'food', name: 'pizza' }