master-master replication with levelup.
Implements scuttlebutt style handshake and then syncs data, then replicates real time changes.
Replicate from a between two processes. One process starts a server, and another connects.
//master1.jsvar level =var SubLevel =var net =var Replicate =//setup the database.var db =//install Master plugin!var master =//create a server, and stream data to who ever connects.net
Then, the code for the client!
//master2.jsvar levelup =var SubLevel =var net =var Replicate =var db =var master =var stream = netstream
Wow, that was simple.
by default, level-replicate supports buffers by converting them to base64 via
If you desire more efficiency, use
var Replicate =var db =var master =
//install Master plugin with the `recursive` option set to `true`.var master =// changes made to all sublevels of `db` will replicate!db
note: this depends on having level-sublevel@>=5.2.0 with level-hooks@>=4.5.0