{"id":20205013,"url":"https://github.com/level/rave-level","last_synced_at":"2025-06-26T07:31:48.950Z","repository":{"id":40571729,"uuid":"474702633","full_name":"Level/rave-level","owner":"Level","description":"Use a LevelDB database from multiple processes with seamless failover.","archived":false,"fork":false,"pushed_at":"2023-02-01T16:03:49.000Z","size":87,"stargazers_count":6,"open_issues_count":5,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-21T04:35:01.504Z","etag":null,"topics":["abstract-level","javascript","level","leveldb","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Level.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-27T17:00:34.000Z","updated_at":"2024-07-24T17:47:29.000Z","dependencies_parsed_at":"2023-02-18T17:05:14.059Z","dependency_job_id":null,"html_url":"https://github.com/Level/rave-level","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Level/rave-level","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Frave-level","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Frave-level/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Frave-level/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Frave-level/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/rave-level/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Frave-level/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262022307,"owners_count":23246298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract-level","javascript","level","leveldb","nodejs"],"created_at":"2024-11-14T05:16:15.689Z","updated_at":"2025-06-26T07:31:48.928Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","funding_links":["https://opencollective.com/level"],"categories":[],"sub_categories":[],"readme":"# rave-level\n\n**Use a LevelDB database from multiple processes with seamless failover.** Normally with [`classic-level`](https://github.com/Level/classic-level) opening the same location more than once would result in a [`LEVEL_LOCKED`](https://github.com/Level/abstract-level#errors) error. With `rave-level` the first process that succeeds in taking the LevelDB lock becomes the \"leader\" and creates a [`many-level`](https://github.com/Level/many-level) host to which other processes connect over a unix socket (Linux and Mac) or named pipe (Windows), transparently electing a new leader when it goes down. Pending database operations are then retried and iterators resumed at the last visited key as if nothing happened.\n\n\u003e :pushpin: Which module should I use? What happened to [`level-party`](https://github.com/Level/party)? Head over to the [FAQ](https://github.com/Level/community#faq).\n\n[![level badge][level-badge]](https://github.com/Level/awesome)\n[![npm](https://img.shields.io/npm/v/rave-level.svg)](https://www.npmjs.com/package/rave-level)\n[![Node version](https://img.shields.io/node/v/rave-level.svg)](https://www.npmjs.com/package/rave-level)\n[![Test](https://img.shields.io/github/workflow/status/Level/rave-level/Test?label=test)](https://github.com/Level/rave-level/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/rave-level?label=\\\u0026logo=codecov\\\u0026logoColor=fff)](https://codecov.io/gh/Level/rave-level)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript\\\u0026logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective\\\u0026logoColor=fff)](https://opencollective.com/level)\n\n## Usage\n\n```js\nconst { RaveLevel } = require('rave-level')\nconst db = new RaveLevel('./db')\n```\n\n## API\n\n### `db = new RaveLevel(location[, options])`\n\nThe `location` argument is the same as in [`classic-level`](https://github.com/Level/classic-level), making `rave-level` a drop-in replacement for when you need to read and write to the given `location` from multiple processes simultaneously. However, the `options` are different and limited because not every `RaveLevel` instance has direct access to the underlying LevelDB database. The `options` object may contain:\n\n- `keyEncoding` (string or object, default `'utf8'`): [encoding](https://github.com/Level/abstract-level#encodings) to use for keys\n- `valueEncoding` (string or object, default `'utf8'`): encoding to use for values\n- `retry` (boolean, default `true`): if true, operations are retried upon connecting to a new leader. This disables [snapshot guarantees](https://github.com/Level/abstract-level#iterator) because retries may implicitly use new snapshots. If false, operations are aborted upon disconnect, which means to yield an error on e.g. `db.get()`.\n\nThe `RaveLevel` class extends `AbstractLevel` and thus follows the public API of [`abstract-level`](https://github.com/Level/abstract-level). As such, the rest of the API is documented in `abstract-level`. The database opens itself but (unlike other `abstract-level` implementations) cannot be re-opened once `db.close()` has been called. Calling `db.open()` would then yield a [`LEVEL_NOT_SUPPORTED`](https://github.com/Level/abstract-level#errors) error.\n\n### Events\n\nA `RaveLevel` instance will only emit [events](https://github.com/Level/abstract-level#events) that are the result of its own operations (rather than other processes or instances). There's one additional event, emitted when `db` has been elected as the leader:\n\n```js\ndb.on('leader', function () {\n  console.log('I am the leader now')\n})\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install rave-level\n```\n\n## Contributing\n\n[`Level/rave-level`](https://github.com/Level/rave-level) is an **OPEN Open Source Project**. This means that:\n\n\u003e 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.\n\nSee the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.\n\n## Donate\n\nSupport us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.\n\n## License\n\n[MIT](LICENSE)\n\n[level-badge]: https://leveljs.org/img/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Frave-level","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevel%2Frave-level","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Frave-level/lists"}