logbase

4.0.0 • Public • Published

logbase

Append-only log and log-based database

this module is used by Tradle

NPM

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

Package Sidebar

Install

npm i logbase

Weekly Downloads

13

Version

4.0.0

License

ISC

Last publish

Collaborators

  • spwilko
  • genevayngrib
  • pgmemk
  • tenaciousmv