Level Vector Clock
LevelDB + Vector Clocks
Install
$ npm install level-vectorclock --save
Use
Import
var LVC = ;
Initialize Database
var level = ; var nodeId = 'node-44';var db = ;
put(key, value[, meta], cb);
Without metadata (may create sibilings):
db;
With metadata:
db;
get(key, cb);
db;
Merge two sibilings
Since you may have had two conflicting writes, when you read you may get more than one record.
To resolve the conflict you need to provide all the metadatas of the records you want to resolve into a put
call like this:
var metas = meta1 meta2;db;
createReadStream(options)
Without options, streams all the data:
var s = db; s;
With options:
var options = start: 'C' end: 'A' reverse: true values: false keys: true; var s = db;
createValueStream(options)
Alias for `createReadStream({values: true, keys: false});
createReadStream(options)
Returns only the keys. Alias for `createReadStream({values: false, keys: true});
createWriteStream(options)
Creates a writable stream.
Supports the same options as levelup.
License
MIT