Modules like subleveldown and multileveldown have to peel off layers (levelup, deferred-leveldown and/or encoding-down) from an input db to get to the inner db, which they then rewrap with those same layers.
That process ain't pretty, so I wrote reachdown to hide that ugliness. It currently has to feature-detect deferred-leveldown and encoding-down, and this may clash with another abstract-leveldown implementation at some point. To counter that, we can add a type property across the board:
MyLeveldown.prototype.type = 'my-leveldown'
Note: with that in place, the unwrapping (or even merely the fact that we have to unwrap) still isn't very clean, but IMO it's acceptable as a medium-term solution because there's a plan to merge level(up) functionality into abstract-leveldown (https://github.com/Level/community/issues/58) which ultimately removes the need to unwrap.
A continuation of https://github.com/Level/subleveldown/issues/34. cc @ralphtheninja
Background
Modules like
subleveldown
andmultileveldown
have to peel off layers (levelup
,deferred-leveldown
and/orencoding-down
) from an input db to get to the inner db, which they then rewrap with those same layers.That process ain't pretty, so I wrote
reachdown
to hide that ugliness. It currently has to feature-detectdeferred-leveldown
andencoding-down
, and this may clash with anotherabstract-leveldown
implementation at some point. To counter that, we can add atype
property across the board:Note: with that in place, the unwrapping (or even merely the fact that we have to unwrap) still isn't very clean, but IMO it's acceptable as a medium-term solution because there's a plan to merge
level(up)
functionality intoabstract-leveldown
(https://github.com/Level/community/issues/58) which ultimately removes the need to unwrap.Tasks
Add
type
levelup
deferred-leveldown
encoding-down
subleveldown
(already had it)multileveldown
Release: not ourslevel-js
(not needed now)leveldown
(not needed now)memdown
(not needed now)rocksdb
Use
reachdown
utilitysubleveldown
(reachdown
itself was adapted from code insubleveldown
)multileveldown
Release: not ourslevel-bench
level-test
(in its tests)