All Projects → Level → Multileveldown

Level / Multileveldown

Licence: other
multilevel implemented using leveldowns with reconnect support

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Multileveldown

Level
Fast & simple storage. A Node.js-style LevelDB wrapper for Node.js, Electron and browsers.
Stars: ✭ 1,071 (+2000%)
Mutual labels:  level, browsers
Browser Logos
🗂 High resolution web browser logos
Stars: ✭ 5,538 (+10758.82%)
Mutual labels:  browsers
deferred-leveldown
An abstract-leveldown implementation that queues operations while a real abstract-leveldown instance is being opened.
Stars: ✭ 18 (-64.71%)
Mutual labels:  level
Fluentreports
📄 Fluent Reports - Data Driven Reporting Engine for Node.js and Browsers 📄
Stars: ✭ 305 (+498.04%)
Mutual labels:  browsers
CockyGrabber
C# library for the collection of browser information such as cookies, logins, and more
Stars: ✭ 46 (-9.8%)
Mutual labels:  browsers
Levelup
A wrapper for abstract-leveldown compliant stores, for Node.js and browsers.
Stars: ✭ 3,960 (+7664.71%)
Mutual labels:  level
packager
A levelup package helper for distributing with an abstract-leveldown compatible back-end.
Stars: ✭ 20 (-60.78%)
Mutual labels:  level
Loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
Stars: ✭ 33 (-35.29%)
Mutual labels:  browsers
Pale Moon
Pale Moon web browser
Stars: ✭ 512 (+903.92%)
Mutual labels:  browsers
Memdown
In-memory abstract-leveldown store for Node.js and browsers.
Stars: ✭ 259 (+407.84%)
Mutual labels:  level
Bfuzz
Fuzzing Browsers
Stars: ✭ 258 (+405.88%)
Mutual labels:  browsers
batify
Only one udevrule file triggering plug and critical battery level notifications (multi-x sessions support)
Stars: ✭ 47 (-7.84%)
Mutual labels:  level
Level Js
An abstract-leveldown compliant store on top of IndexedDB.
Stars: ✭ 485 (+850.98%)
Mutual labels:  level
level-test
Inject temporary and isolated level stores (leveldown, level-js, memdown or custom) into your tests.
Stars: ✭ 19 (-62.75%)
Mutual labels:  level
Qs
A querystring parser with nesting support
Stars: ✭ 6,688 (+13013.73%)
Mutual labels:  browsers
discord-leveling-system-ranking-system
A simple rankcard system with the ranking system included using an enmap database, and canvacord
Stars: ✭ 49 (-3.92%)
Mutual labels:  level
mem
A convenience package bundling levelup and memdown.
Stars: ✭ 23 (-54.9%)
Mutual labels:  level
Grinder
Grinder is a system to automate the fuzzing of web browsers and the management of a large number of crashes.
Stars: ✭ 393 (+670.59%)
Mutual labels:  browsers
Tiled
Flexible level editor
Stars: ✭ 8,411 (+16392.16%)
Mutual labels:  level
Community
General discussion, cross-repo efforts and common information for projects in the community.
Stars: ✭ 24 (-52.94%)
Mutual labels:  level

multileveldown

multilevel implemented using leveldowns with seamless retry support

level badge npm Node version Travis npm Coverage Status JavaScript Style Guide Backers on Open Collective Sponsors on Open Collective

Usage

Similar to multilevel you can use this to share a levelup database across multiple processes over a stream. In addition multileveldown supports seamless retry so you can reconnect to a server without your read streams / puts failing etc.

First create a server

var multileveldown = require('multileveldown')
var level = require('level')
var net = require('net')

var db = level('db')

var server = net.createServer(function (sock) {
  sock.on('error', function () {
    sock.destroy()
  })

  sock.pipe(multileveldown.server(db)).pipe(sock)
})

server.listen(9000)

Then create some clients

var multileveldown = require('multileveldown')
var net = require('net')

var db = multileveldown.client()

var sock = net.connect(9000)
sock.pipe(db.connect()).pipe(sock)

db.put('hello', 'world', function () {
  db.get('hello', console.log)
})

Reconnect

To setup reconnect in your client simply set retry: true and reconnect to your server when the connection fails

var multileveldown = require('multileveldown')
var net = require('net')

var db = multileveldown.client({
  retry: true
})

var connect = function () {
  var sock = net.connect(9000)
  var remote = db.connect()

  sock.on('error', function () {
    sock.destroy()
  })

  sock.on('close', function () {
    remote.destroy()
    setTimeout(connect, 1000) // reconnect after 1s
  })

  sock.pipe(remote).pipe(sock)
}

connect()

multileveldown will now make sure to retry your pending operations when you reconnect. If you create a read stream and your connection fails half way through reading that stream multileveldown makes sure to only retry the part of the stream you are missing. Please note that this might not guarantee leveldb snapshotting if you rely on that.

API

multileveldown.server(db, [options])

Returns a new duplex server stream that you should connect with a client. Options include

{
  readonly: true, // make the database be accessible as read only
  preput: function (key, val, cb) {}, // called before puts
  predel: function (key, cb) {}, // called before dels
  prebatch: function (batch, cb) {} // called before batches
}

clientDb = multileveldown.client([options])

Creates a new client levelup that you can connect to a server. Options are forwarded to the levelup constructor.

clientDb.connect()

Returns a new duplex client stream that you should connect with a server stream

clientDb.createRpcStream()

Just an alias to .connect for multilevel API compatibility.

Install

With npm do:

npm i multileveldown

Contributing

Level/multileveldown is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the Contribution Guide for more details.

Donate

To sustain Level and its activities, become a backer or sponsor on Open Collective. Your logo or avatar will be displayed on our 28+ GitHub repositories and npm packages. 💖

Backers

Open Collective backers

Sponsors

Open Collective sponsors

License

MIT © 2015-present Mathias Buus and Contributors.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].