Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
support sublevel and plugin extensions #8
This pull request allows multilevel to support sublevels, and plugins.
You just have to pass a manifest from the server to the client multilevel:
var db = levelup(path) sublevel(db) //setup db... var foo = MapReduce(db, 'map',...) //etc fs.writeFileSync(JSON.stringify(manifest(db, true)), './manifest.json')) //later... stream.pipe(multilevel.server(db)).pipe(stream)
and then the client browserifys that in.
If you don't provide a manifest you will still be able to use the normal methods on the base level.
This will work great if you have browserify setup to generate lazily,
I'm making this pull request as a work in progress, I've disabled events,
Writing this has also given me several ideas for a better mux-demux,
Also, maybe, we can add an event emitter syntax to the manifest, where you can declare what events should be exposed (for security)
Another thing that I am considering is some way to (mostly) transparently handle reconnections,
Streams can be reconnected (for a live stream, it can buffer a few recent updates - else give the client the whole stream again, and for a non live stream, reconnect since the last update received)
I've already figured that stuff for scuttlebutts.
Needs to be a string so that it can be sent over the wire...
Which can handle things like this, but making this compromise got it out the door.