Updates
This commit is contained in:
@@ -2,10 +2,14 @@ require('bare-process/global')
|
||||
const { HyperP2PCrdtVersionVector, compareVectors } = require('../index.js')
|
||||
|
||||
async function main () {
|
||||
const vv = new HyperP2PCrdtVersionVector()
|
||||
vv.increment('local')
|
||||
vv.merge({ remote: 3 })
|
||||
console.log(vv.toJSON(), compareVectors(vv.toJSON(), { local: 1 }), vv.getStats())
|
||||
const vv = new HyperP2PCrdtVersionVector({ topic: process.argv[2] || null })
|
||||
await vv.ready()
|
||||
vv.increment('peer-a')
|
||||
vv.increment('peer-a')
|
||||
vv.merge({ 'peer-b': 3 })
|
||||
console.log('clock:', vv.toJSON())
|
||||
console.log('compare:', compareVectors(vv.toJSON(), { 'peer-b': 3 }))
|
||||
console.log('stats:', vv.getStats())
|
||||
await vv.close()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user