Skip to content

Use abstract-level API for the command queue#16

Merged
ThomasHalwax merged 1 commit into
mainfrom
chore/abstract-level-queue
May 21, 2026
Merged

Use abstract-level API for the command queue#16
ThomasHalwax merged 1 commit into
mainfrom
chore/abstract-level-queue

Conversation

@ThomasHalwax
Copy link
Copy Markdown
Member

Summary

Moves the FIFO command queue back to the abstract-level API. The queue previously required a levelup-compatible database — a deliberate compatibility shim for ODIN while ODIN itself used levelup/subleveldown (commit 3a351a4, "Use levelup/subleveldown API for ODIN compatibility"; abstract-level migration tracked in #7).

ODIN has now migrated to the abstract-level family, so the queue must follow. Without this change, passing an abstract-level database to CommandAPI fails: queue.mjs calls createReadStream (does not exist on abstract-level) and callback-style batch/del (abstract-level is promise-only), so dequeue() rejects and the consumer crashes on an undefined entry.

Changes

  • queue.mjs: createReadStreamiterator().all(); callback-style batch/del → their promise forms; counter restore simplified. (Effectively re-applies the abstract-level version from c0e24a4.)
  • queue.test.mjs: MemoryLevel instead of levelup(memdown()) + subleveldown.
  • package.json: drop levelup/memdown/subleveldown devDependencies in favour of memory-level.
  • Doc comments in queue.mjs / command-api.mjs updated from "levelup-compatible" to "abstract-level".

Breaking change

The database API required by CommandAPI/FIFO changes from levelup to abstract-level → version bumped to 3.0.0. Consumers must pass an abstract-level database (e.g. a sublevel).

Validation

  • npm test: 68 passing (queue suite: 10/10)
  • oxlint: 0 errors
  • Verified end-to-end against ODIN's abstract-level migration branch: collaboration (project sharing, command queue) works.

Closes #7.

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from levelup/subleveldown to classic-level/sublevel

1 participant