Closed vweevers closed 2 years ago
Review of the following is welcome: function signatures of the public API, docs (README.md
and UPGRADING.md
), TypeScript types, and LICENSE
(see above comment). The code itself is covered by tests (now including the new sublevel
option for batches) but a high-level review on that would be welcome too (in terms of code complexity, plugin compatibility, extensibility, etc).
Merging because I have some cleanup to do on the main branch (has some fixup commits I forgot to squash). Retroactive review is of course still welcome.
I initially wanted to wait with this and instead fork
subleveldown
and keep that functionality in a separate module, but I figured that would require breaking changes later on. In addition, I've yet to benchmarkabstract-level
versuslevelup
andabstract-leveldown
; including sublevels now saves me from having to benchmark twice.Adds a
db.sublevel(name[, options])
method that works the same assubleveldown
except it returns anabstract-level
database instead of alevelup
database. Data-wise there's no change, so anabstract-level
sublevel can read sublevels previously created with (and populated by)subleveldown
.Uses code and tests from
subleveldown
. Where possible, I converted functional tests (against amemdown
db) to unit tests (against a mocked database). The abstract test suite also repeats itself, to run both on a regular database, and a sublevel of the database.Comes with some new features compared to
subleveldown
:db.batch(..)
takes asublevel
option on operations, to atomically commit data to multiple sublevelsAbstractLevel#_sublevel()
can be overridden to add additional methods to sublevels.