All Projects → Level → Party

Level / Party

Licence: other
Open a leveldb handle multiple times

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Party

Rocksdb
Pure C++ Node.js RocksDB binding. An abstract-leveldown compliant store.
Stars: ✭ 138 (+4.55%)
Mutual labels:  leveldb, level
Level
Fast & simple storage. A Node.js-style LevelDB wrapper for Node.js, Electron and browsers.
Stars: ✭ 1,071 (+711.36%)
Mutual labels:  leveldb, level
Levelup
A wrapper for abstract-leveldown compliant stores, for Node.js and browsers.
Stars: ✭ 3,960 (+2900%)
Mutual labels:  leveldb, level
Electron Demo
Demo app loading LevelDB into an Electron context.
Stars: ✭ 79 (-40.15%)
Mutual labels:  leveldb, level
Awesome
An open list of awesome Level modules and resources.
Stars: ✭ 204 (+54.55%)
Mutual labels:  leveldb, level
level-test
Inject temporary and isolated level stores (leveldown, level-js, memdown or custom) into your tests.
Stars: ✭ 19 (-85.61%)
Mutual labels:  level, leveldb
Level Rocksdb
A convenience package bundling levelup and rocksdb.
Stars: ✭ 120 (-9.09%)
Mutual labels:  leveldb, level
Multileveldown
multilevel implemented using leveldowns with reconnect support
Stars: ✭ 51 (-61.36%)
Mutual labels:  level
Cssdbpy
Fastest SSDB client written on Cython. Production ready
Stars: ✭ 79 (-40.15%)
Mutual labels:  leveldb
Papyrusjs
papyrus.js renders maps of Minecraft: Bedrock Edition worlds using node.js, LevelDB and leaflet.
Stars: ✭ 50 (-62.12%)
Mutual labels:  leveldb
Fastonosql
FastoNoSQL is a crossplatform Redis, Memcached, SSDB, LevelDB, RocksDB, UnQLite, LMDB, ForestDB, Pika, Dynomite, KeyDB GUI management tool.
Stars: ✭ 1,001 (+658.33%)
Mutual labels:  leveldb
Ardb
A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
Stars: ✭ 1,707 (+1193.18%)
Mutual labels:  leveldb
Benchmarks
Benchmark of open source, embedded, memory-mapped, key-value stores available from Java (JMH)
Stars: ✭ 116 (-12.12%)
Mutual labels:  leveldb
Unity Plane Mesh Splitter
Unity Plane Mesh Splitter
Stars: ✭ 71 (-46.21%)
Mutual labels:  level
Tiled
Flexible level editor
Stars: ✭ 8,411 (+6271.97%)
Mutual labels:  level
Srchx
A standalone lightweight full-text search engine built on top of blevesearch and Go with multiple storage (scorch, boltdb, leveldb, badger)
Stars: ✭ 118 (-10.61%)
Mutual labels:  leveldb
Tmlibs
DEPRECATED: Merged into https://github.com/tendermint/tendermint under `libs`
Stars: ✭ 45 (-65.91%)
Mutual labels:  leveldb
Gun Level
LevelDB storage plugin for gunDB
Stars: ✭ 69 (-47.73%)
Mutual labels:  leveldb
Nci
Flexible, open source continuous integration server written in node.js
Stars: ✭ 103 (-21.97%)
Mutual labels:  leveldb
Level Browserify
No longer maintained: superseded by level v5.0.0.
Stars: ✭ 64 (-51.52%)
Mutual labels:  level

level-party

Open a leveldb handle multiple times, transparently upgrading to use multileveldown when more than 1 process try to use the same leveldb data directory at once and re-electing a new master when the primary unix socket goes down.

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

Example

Normally with level, when you try to open a database handle from more than one process you will get a locking error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
OpenError: IO error: lock /home/substack/projects/level-party/example/data/LOCK: Resource temporarily unavailable
    at /home/substack/projects/level-party/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:114:34

With level-party, the database open will automatically drop down to using multilevel over a unix socket using metadata placed into the level data directory transparently.

This means that if you have 2 programs, 1 that gets:

var level = require('level-party')
var db = level(__dirname + '/data', { valueEncoding: 'json' })

setInterval(function () {
  db.get('a', function (err, value) {
    console.log('a=', value)
  })
}, 250)

And 1 that puts:

var level = require('level-party')
var db = level(__dirname + '/data', { valueEncoding: 'json' })

var n = Math.floor(Math.random() * 100000)

setInterval(function () {
  db.put('a', n + 1)
}, 1000)

and you start them up in any order, everything will just work! No more IO error: lock exceptions.

$ node put.js & sleep 0.2; node put.js & sleep 0.2; node put.js & sleep 0.2; node put.js & sleep 0.2
[1] 3498
[2] 3502
[3] 3509
[4] 3513
$ node get.js
a= 35340
a= 31575
a= 37639
a= 58874
a= 35341
a= 31576
$ node get.js
a= 35344
a= 31579
a= 37643
a= 58878
a= 35345
^C

Hooray!

Seamless failover

level-party does seamless failover. This means that if you create a read-stream and the leader goes down while you are reading that stream level-party will resume your stream on the new leader.

This disables leveldb snapshotting so if your app relies on this you should disable this by setting opts.retry = false

var db = level('./data', { retry: false }) // will not retry streams / gets / puts if the leader goes down

Windows support

level-party works on windows as well using named pipes.

API

var db = level(...)

The arguments are exactly the same as level. You will sometimes get a real leveldb handle and sometimes get a multileveldown handle back in the response.

Install

With npm do:

npm install level-party

Contributing

Level/party 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 © 2014-present James Halliday 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].