Plugin to add persistence and querying <a href="https://github.com/scuttlebutt">scuttlebutt</a> documents stored in leveldb.
Plugin to add persistence and querying scuttlebutt documents stored in leveldb.
Instead of representing an object as a single document, scuttlebutt represents a document as a series of immutable transactions. The 'document' is modified by appending a new transaction. Old transactions that are no longer relevant can be cleaned up, but you can never modify a transaction in place. As it turns out, leveldb (a log-structured merge tree) is optimized for exactly this sort of data.
Must be used with level-sublevel
var levelup =var level_scuttlebutt =var SubLevel =//create a leveldb instance...//levelup must be extended with SubLevel!var db =//a scuttlebutt model.var Model =//level-scuttlebutt needs to have an unique identifier of the current instancevar udid = 'app-name'//patch it with level-scuttlebutt.var sbDb = db //add a scuttlebutt 'table'//k//open a scuttlebutt instance by name.sbDb//the toJSON values are stored in the db,//so you can just use any other map reduce library on it!sbDbviews'all' =
level-scuttlebutt plugin to the
var level_scuttlebutt = require('level-scuttlebutt'); level_scuttlebutt(db, ID, schema)
ID is a unique string that identifies the node (the machine) and should be
tied to the leveldb instance.
I suggest using udid.
schema should be a function that takes a string (the name of the scuttlebutt instance)
and returns and empty scuttlebutt instance.
You can use scuttlebutt-schema.
Use some other
level-* plugin for queries!
get the 10 last edited documents!