Use abstract-level API for the command queue#16
Merged
Conversation
The FIFO command queue required a levelup-compatible database, which was a deliberate compatibility shim for ODIN while ODIN itself used levelup (see 3a351a4). ODIN has now migrated to the abstract-level family, so the queue is moved back to the abstract-level API (tracked in #7): - queue.mjs: createReadStream -> iterator().all(); callback-style batch/del -> their promise forms; counter restore simplified. - queue.test.mjs: MemoryLevel instead of levelup(memdown()) + subleveldown. - package.json: drop levelup/memdown/subleveldown devDependencies in favour of memory-level. Changing the required database API is a breaking change for consumers -> 3.0.0. All queue tests pass; full suite green (68).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the FIFO command queue back to the
abstract-levelAPI. The queue previously required alevelup-compatible database — a deliberate compatibility shim for ODIN while ODIN itself usedlevelup/subleveldown(commit3a351a4, "Use levelup/subleveldown API for ODIN compatibility"; abstract-level migration tracked in #7).ODIN has now migrated to the
abstract-levelfamily, so the queue must follow. Without this change, passing anabstract-leveldatabase toCommandAPIfails:queue.mjscallscreateReadStream(does not exist on abstract-level) and callback-stylebatch/del(abstract-level is promise-only), sodequeue()rejects and the consumer crashes on an undefined entry.Changes
createReadStream→iterator().all(); callback-stylebatch/del→ their promise forms; counter restore simplified. (Effectively re-applies the abstract-level version fromc0e24a4.)MemoryLevelinstead oflevelup(memdown())+subleveldown.levelup/memdown/subleveldowndevDependencies in favour ofmemory-level.queue.mjs/command-api.mjsupdated from "levelup-compatible" to "abstract-level".Breaking change
The database API required by
CommandAPI/FIFOchanges fromleveluptoabstract-level→ version bumped to 3.0.0. Consumers must pass anabstract-leveldatabase (e.g. a sublevel).Validation
npm test: 68 passing (queue suite: 10/10)oxlint: 0 errorsCloses #7.