logbase
v4.0.0
Published
log and log-based database based on changes-feed
Downloads
94
Readme
logbase
Append-only log and log-based database
this module is used by Tradle
Usage
var lb = require('logbase')
var log = new lb.Log('path/to/db', {
db: leveldown
})
var red = new lb.Entry()
.set({
name: 'roxie',
color: 'red'
})
// change color
var blue = new lb.Entry()
.set({
name: 'roxie',
color: 'blue'
})
log.append(red)
log.append(blue)
// stores latest colors
var db = new lb.Base({
log: log,
db: levelup('path/to/another/db', {
db: leveldown,
valueEncoding: 'utf8'
})
})
db._process = function (entry, cb) {
this._db.put(entry.get('name'), entry.get('color'), cb)
}
TODO
Remove/isolate all "write" methods