Open bluelovers opened 4 years ago
anyone can give a real world demo ?
and what value of meta should be ?
meta
import IPFS from 'ipfs'; import createIpfsVersidag from '../'; IPFS.create().then(async (ipfs) => { const myVersidag = createIpfsVersidag({ ipfs, tieBreaker: (node1, node2) => node1.meta - node2.meta, }); const myVersidagA = await myVersidag.add('Hi', 1); const myVersidagB = await myVersidagA.add('Hello', 2); const myVersidagC = await myVersidagA.add('Hi World', 3); const myVersidagD = await myVersidagB.merge(myVersidagC.headCids, 'Hello World'); const versions = await myVersidagD.resolve(); // [ // { version: 'Hello World' }, // { version: 'Hi World', meta: 3 } // { version: 'Hello', meta: 2 } // { version: 'Hi', meta: 1 } // ] });
This tool is showing how you can construct a DAG (directed acyclic graph) using append only logs. Some useful tools to dive deeper on this:
can't display data in https://explore.ipld.io/
https://github.com/bluelovers/ws-ipfs-versidag/blob/master/packages/ipfs-versidag/test/demo.ts
anyone can give a real world demo ?
and what value of
meta
should be ?