Level / abstract-level

Abstract class for a lexicographically sorted key-value database.
MIT License
128 stars 8 forks source link

Breaking: remove callbacks in favor of promises #50

Closed vweevers closed 2 years ago

vweevers commented 2 years ago

Applies to both the public and private API. If you were already using promises in the public API, nothing changed, except for subtle timing differences. In the private API, it means that function signatures like _get(key, options, callback) have changed to async _get(key, options).

In addition:

TODO:

vweevers commented 2 years ago

Ouch: I wondered why tests are passing in Node 12 (I didn't expect it to, for lack of AbortController). Turns out, they aren't passing, but the exit code is 0. Must be a bug in faucet which was recently updated.

vweevers commented 2 years ago

Now comes the fun part: using promises in the C++ of classic-level.

Edit: that's surprisingly easy (at least for basic methods like put()) and performance is roughly the same. No blockers :)