Coder Social home page Coder Social logo

Comments (4)

vweevers avatar vweevers commented on May 10, 2024

The backstory of abstract-level can be found in the FAQ: What is abstract-level?

The short version, that I hope will answer your more specific questions, is this:

  • LevelDB is a C++ project by Google. We're not affiliated with Google.
  • leveldown was a Node.js binding for LevelDB
  • levelup wrapped leveldown in a more convenient interface, later indeed including promises
  • leveldown and levelup are now legacy modules
  • classic-level is effectively a merger of leveldown and levelup. It's thus a binding to LevelDB with a convenient interface. I say effectively because the real story is more nuanced and can be found in the FAQ that I mentioned.

If I instead were to explain the relationships to someone that's new to Level (and thus doesn't have to know about leveldown and levelup), then I would say, using OOP terms:

  • AbstractLevel is an abstract class for a lexicographically sorted key-value database. It handles state, encodings and other generic behaviors that can be implemented in pure JavaScript.
  • ClassicLevel implements that abstract class, using LevelDB for storage.

from classic-level.

vweevers avatar vweevers commented on May 10, 2024

In case your question is, should I use classic-level or leveldown? Then the answer is classic-level, without a doubt.

Legacy modules like leveldown are no longer maintained. They work perfectly fine, but won't get new features, performance improvements or other updates. Feature-wise, classic-level has the following additional features:

  • Sublevels
  • Support of Uint8Array
  • iterator.nextv() and iterator.all()
  • Built-in TypeScript types

And more features are coming soon:

from classic-level.

AdaJass avatar AdaJass commented on May 10, 2024
  • AbstractLevel is an abstract class for a lexicographically sorted key-value database. It handles state, encodings and other generic behaviors that can be implemented in pure JavaScript.
  • ClassicLevel implements that abstract class, using LevelDB for storage.

Thanks a lot, I saw the compare with levelDB and rocksDB in internet, it is said rocksDb is the better one. By your mention, I could write code with abstractlevel or classiclevel, but if i want in the future, i could just simply replace the require/import package, it is that right?

will you plan to upgrade the rocksdb package to the abstractlevel style?

from classic-level.

vweevers avatar vweevers commented on May 10, 2024

We don't have a (new) RocksDB binding yet, see Level/abstract-level#14. I can't say when that will happen, it's low priority atm.

But yes, once that's available, you could replace const { ClassicLevel } = require('classic-level') with const { RocksLevel } = require('rocks-level') and you'll get the same interface.

PS. "Better" is subjective. LevelDB is a good choice (and the most popular among Level users) when you want small binaries, a wide range of supported platforms, and good general performance (that isn't optimized for one particular scenario like SSDs). RocksDB does have more features, but the majority are not exposed in our bindings because those features don't fit in the abstract-level interface and RocksDB receives less attention from us.

from classic-level.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.