Skip to content

feat: LMPOP and ZMPOP commands - #317

Merged
kacy merged 1 commit into
mainfrom
feat/lmpop-zmpop
Feb 26, 2026
Merged

feat: LMPOP and ZMPOP commands#317
kacy merged 1 commit into
mainfrom
feat/lmpop-zmpop

Conversation

@kacy

@kacy kacy commented Feb 26, 2026

Copy link
Copy Markdown
Owner

summary

  • adds LMPOP numkeys key [key ...] LEFT|RIGHT [COUNT n] for atomic multi-key list pop
  • adds ZMPOP numkeys key [key ...] MIN|MAX [COUNT n] for atomic multi-key sorted set pop
  • both commands scan keys left-to-right, popping from the first non-empty collection
  • optional COUNT defaults to 1; returns [key_name, [elements]] or nil when all keys empty
  • AOF: LMPOP replays as individual LPOP/RPOP records; ZMPOP replays as ZREM

tested

  • 5 unit tests for lpop_count/rpop_count in keyspace (count, capped-at-size, missing key, wrong type)
  • 6 integration tests: lmpop basic (skips empty keys), lmpop COUNT, lmpop all-empty nil, zmpop MIN, zmpop MAX COUNT, zmpop all-empty nil
  • cargo clippy -D warnings clean on ember-protocol, emberkv-core, ember-server
  • 565 unit tests pass

design notes

execute.rs drives the key-scan loop: for each key, it sends a LmpopSingle/ZmpopSingle sub-request to the owning shard and returns immediately on the first non-empty result. this keeps all the routing logic in execute.rs and the shard dispatch simple.

adds LMPOP and ZMPOP for atomic multi-key pop across lists and sorted sets.

both commands scan keys left-to-right and pop from the first non-empty
collection. LMPOP supports LEFT/RIGHT direction; ZMPOP supports MIN/MAX score
order. optional COUNT argument (default 1) controls how many elements to pop.

response format follows redis 7.0 spec: [key_name, [elements...]] or nil when
all keys are empty.

persistence: LMPOP is replayed as individual LPOP/RPOP records; ZMPOP is
replayed as ZREM of the popped members.
@kacy
kacy merged commit 6e475c1 into main Feb 26, 2026
5 of 7 checks passed
@kacy
kacy deleted the feat/lmpop-zmpop branch February 26, 2026 20:41
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.

1 participant