Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Discussion, support and common information for projects in the community.

License

NotificationsYou must be signed in to change notification settings

Level/community

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discussion, support and common information for projects in the community.

level badgeTestDonate

FAQ

What is Level?

Level is a collection of Node.js modules for creating transparent databases. A solid set of primitives enable powerful databases to be built in userland. They can be embedded or networked, persistent or transient - in short, tailored to your needs.

At the heart of Level are key-value databases that follow the characteristics ofLevelDB. They support binary keys and values, batched atomic writes and bi-directional iterators that read from a snapshot in time. Entries are sorted lexicographically by keys which, when combined with ranged iterators, makes for a powerful query mechanism. Level combines idiomatic JavaScript interfaces like async iterators with Node.js interfaces likestreams,events andbuffers. It offers a rich set of data types through encodings and can split a database into evented sections called sublevels.

The underlying storage can be easily swapped by selecting a different database implementation, all sharing a common API and the same characteristics. Together they target a wide range of runtime environments: Node.js and Electron on Linux, Mac OS, Windows and FreeBSD, including ARM platforms like Raspberry Pi and Android, as well as Chrome, Firefox, Edge, Safari, iOS Safari and Chrome for Android.

Where do I start?

Thelevel module is the recommended way to get started. It offers a persistent database that works in both Node.js and browsers, backed by LevelDB and IndexedDB respectively.Many alternatives are available. For example,memory-level is an in-memory database backed by a red-black tree. VisitLevel/awesome to discover more modules.

What isabstract-level?

If you are new to Level, there is a quick answer:abstract-level is the new core of Level on top of which several databases are (or will be) implemented. Read on if you're already familiar with Level modules (before 2022) and have usedlevel,levelup,abstract-leveldown,encoding-down ordeferred-leveldown.

Back in 2012,levelup offered a Node.js binding for Google's LevelDB. Authored by Rod Vagg,levelup exposed the features of LevelDB in a Node.js-friendly way. It had streams, binary support, encodings... all the goodies. Later on, the binding was moved toleveldown, so that other stores could be swapped in while retaining the friendly API oflevelup.

This is when "up" vs "down" naming was born, where databases followed the formula of "level = levelup + leveldown". For example,level-mem was a convenience package that bundledlevelup withmemdown. Theabstract-leveldown module offered a lower-level abstraction for the "down" part, to encapsulate common logic between "down" stores. Many such stores were written, replacing LevelDB with IndexedDB, RocksDB, in-memory red-black trees, relational databases and more.

Around 2017, further parts were extracted fromlevelup and moved to single-purpose modules. This effectively introduced the concept of "layers", where an implementation ofabstract-leveldown wasn't necessarily a storage forlevelup but could also wrap anotherabstract-leveldown implementation. For example,levelup encoding logic was extracted toencoding-down. This changed the database formula to "level = levelup + encoding-down + leveldown". Or in other words: "levelup + layer + layer".

This highly modular architecture led to clean code, where each module had a single responsibility. By this time, the overall API had settled and matured, some contributors moved on to other exciting things and the primary remaining effort was maintenance. This posed new challenges. We worked on test suites, added automated browser tests, code coverage and database manifests.

Yet, releases too often required canary testing in dependents. It was hard to predict the effect of a change. In addition, documentation became fragmented and some modules actually suffered from the high modularity, having to peel off layers to customize behavior. At the same time, we could see that typical usage of a Level database still involved encodings and the other goodies that the originallevelup had.

Enterabstract-level. This module mergeslevelup,encoding-down andabstract-leveldown into a single codebase. Instead of implementing behaviors "vertically" in layers, it is done per database method. Performance-wiseabstract-level is on par with the old modules. GC pressure is lower because methods allocate less callback functions. Custom (userland) database methods also benefit from the new architecture, because they can reuse utility methods included inabstract-level rather than a layer having to detect and wrap custom methods.

Lastly,abstract-level comes with new features, some of which were not possible to implement before. Among them: Uint8Array support, built-in sublevels, atomically committing data to multiple sublevels, and reading multiple or all entries from an iterator in one call.

How do I upgrade toabstract-level?

We've put together several upgrade guides for different modules. For example, if you're currently usinglevel@7 and no other modules (ignoring transitive dependencies) then it will suffice to read the upgrade guide oflevel@8.

Naming-wise, databases generally use an npm package name in the form of*-level while utilities and plugins are calledlevel-*. This replaces thedown versus up naming scheme. Similarly, while it was previously helpful for documentation to distinguish between "database" and its "underlying store", now you will mostly just encounter the term "database".

To upgrade, please consult the following table. If you use a combination of the modules listed here, each must be upgraded to itsabstract-level equivalent.

Old moduleNew moduleNamed export3Upgrade guide
level <= 7level >= 8Levellevel@8
abstract-leveldownabstract-levelAbstractLevelabstract-level@1
levelupn/an/aDepends2
level orlevelup with streamslevel-read-streamEntryStreamlevel-read-stream@1
leveldownclassic-levelClassicLevelclassic-level@1
level-memmemory-levelMemoryLevelmemory-level@1
memdownmemory-levelMemoryLevelmemory-level@1
level-jsbrowser-levelBrowserLevelbrowser-level@1
level-rocksdbn/a (discontinued)n/an/a
rocksdbn/a (discontinued)n/an/a
multileveldownmany-levelManyLevelGuestmany-level@1
level-partyrave-levelRaveLevelrave-level@1
subleveldown1n/an/aabstract-level@1
deferred-leveldown1n/an/aabstract-level@1
encoding-down1n/an/aabstract-level@1
level-errors1n/an/aabstract-level@1
level-packagern/an/an/a
level-supports <= 2level-supports >= 3supportsn/a
level-codec4level-transcoderTranscoderlevel-transcoder@1
level-testn/an/aNot yet available
  1. Functionality is now included inabstract-level.
  2. If the module that you're wrapping withlevelup is listed here then refer to that module's upgrade guide, else seeabstract-level@1.
  3. Most new modules use named exports, for exampleconst { ClassicLevel } = require('classic-level') instead ofconst leveldown = require('leveldown').
  4. Encodings that follow thelevel-codec interface (withoutlevel-codec as a dependency) can still be used.

Why havelevel-rocksdb androcksdb been discontinued?

Maintaining these bindings to RocksDB (as an alternative to LevelDB) has been an afterthought for several years. There was no active maintainer in the Level organization who usedrocksdb themselves. Thelevel-rocksdb androcksdb npm packages in addition have seen very few downloads compared to the mainlevel package. LevelDB continues to be the preferred option for typical use cases of Level with good general-purpose performance.

You may find alternatives in user land.

How does Level relate to LevelDB?

Level is not affiliated with Google. Level includes a Node.js binding for Google's C++LevelDB project. That is how Level started and where the name comes from. Since then, our ecosystem has grown to include other key-value databases besides LevelDB.

Where can I get support?

If you need help - technical, philosophical or other - feel free toopen an issue incommunity or a more specific repository. We don't (yet) use GitHub Discussions, at least until discussions get the ability toclose them.

You will generally find someone willing to help. Good questions get better and quicker answers. We do not offer paid support. All time is volunteered.

Where can I follow progress?

Most if not all activity happens on GitHub. See ourproject board to find out what we're working on. Any timelines there are just a rough indication of priority. We cannot guarantee that feature X or Y will actually be released on the given dates.

Subscribe to individual repositories to follow their progress. All releases are accompanied by a changelog and a GitHub Release, which gives you the option to onlysubscribe to new releases.

People

Collaborators

Collaborator emeriti

Contributors

Is your name missing? Send us a pull request!

API

This repository also used to hold a small amount of metadata on past and present contributors. They can be accessed from code by:

console.log(require('level-community'))

This metadata is no longer maintained and the npm package will be deprecated at some point. Contributors are instead documented in this README underPeople.

Contributing

Level/community is anOPEN 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 theContribution Guide for more details.

Donate

Support us with a monthly donation onOpen Collective and help us continue our work.

License

MIT

About

Discussion, support and common information for projects in the community.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project


    [8]ページ先頭

    ©2009-2025 Movatter.jp