Skip to content

mvayngrib/logbase

Repository files navigation

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

About

log and log-based database based on changes-feed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published