Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
/ levelup Public archive
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Break levelup into smaller packages #270

@rvagg

Description

@rvagg

This is intended as a follow-up to the discussion in #255 where we have been unable to reach enough of a consensus to merge the proposed feature. The approach outlined in this issue has been suggested as something of a compromise and an attempt to provide the Dulcimer community with something useful without going against the fundamental ideas of LevelUP that some have stated as their main objection to the merge.

One major problem we are bumping up against is the inability to get at the deep insides of LevelUP itself. While we have obviously achieved a good API that is extensible, otherwise there wouldn't be such a vibrant ecosystem, we have extensibility problems at a deeper level, with too much logic tucked away internally with no means of accessing it.

Plus, LevelUP turns out to be too big for most of our tastes, even the fact that we have a lib directory is a warning sign. We're already removing WriteStream and opting for a user-lang pluggable mechanism, we should be able to take a similar approach with all of the components of LevelUP. If we modularise properly we can leave LevelUP as a simple glue between the main parts that form what we know of as LevelUP today but with the logic of each of those parts residing in self-contained, separately tested and documented packages. We can perform most of this work in the Level org too.

Some things this would enable:

  • Wiring together alternative forms of LevelUP by piecing together the components in different ways with different glue logic, perhaps pulling in additional components, perhaps removing some and perhaps replacing some with alternative versions.
  • Experiment more flexibly with alternative approaches
  • Iterate faster by forming interest groups around the separate packages and adopting separate release cycles
  • Re-use some of the great logic that's currently tucked away inside LevelUP, for example level-sublevel pulls in all of LevelUP now to just reuse a couple of the internal components.
  • Do something meaningful with the leveldb package that we now own and have yet to do anything with! (a more strict interpretation of leveldb exposed in Node? A more fully-featured LevelUP?)

Initial suggestion for package split-up:

  • codec/encodings - for k/v encoding and decoding
  • read-stream
  • write-stream (already done, in multiple forms)
  • errors (maybe)
  • batch (not sure how this would work, perhaps push more of it down into abstract-leveldown?)

Also a bunch of smaller things such as:

  • the logic for keeping track of the open/close state add .status abstract-leveldown#68
  • the /NotFound/ matching stuff, which I have already re-implemented in other places myself

And doing a re-audit of the logic that is currently duplicated across levelup and abstract-leveldown, particularly the argument checking. In fact, an abstract-levelup might even be in order purely to define the levelup interface and provide a basic shell for it.

Discussion and humorous animated GIFs please.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions