Skip to content

feat(commands): blocking sorted-set operations (BZPOPMIN/BZPOPMAX/BZMPOP) #57

Description

@TinDang97

Summary

Moon has no blocking zset commands. Priority queues and scheduler patterns built on BZPOPMIN break.

Missing commands

  • BZPOPMIN key [key ...] timeout
  • BZPOPMAX key [key ...] timeout
  • BZMPOP timeout numkeys key [key ...] MIN|MAX [COUNT count]

Design notes

  • Shares the per-key wait-queue infrastructure from feat(commands): blocking list operations (BLPOP/BRPOP/BLMOVE/BLMPOP/BRPOPLPUSH) #56 (blocking list ops) — implement that first.
  • Wake policy: on ZADD that inserts a new min/max, wake the oldest waiter whose side (MIN/MAX) matches. Score comparison determines whether the waiter gets the element or stays parked.
  • Must preserve zset ordering invariants while waker fires (no lock-across-await).

Acceptance criteria

  • Consistency tests for immediate, blocking, timeout, multi-key paths.
  • Unblock on DEL/UNLINK/FLUSHDB.
  • Dual-runtime support.

Depends on

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestredis-parityMissing Redis commands / parity gaps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions