Skip to content

add string helpers to concurrent mode#110

Merged
kacy merged 4 commits intomainfrom
feat/concurrent-string-helpers
Feb 12, 2026
Merged

add string helpers to concurrent mode#110
kacy merged 4 commits intomainfrom
feat/concurrent-string-helpers

Conversation

@kacy
Copy link
Copy Markdown
Owner

@kacy kacy commented Feb 12, 2026

summary

concurrent mode previously only supported GET/SET/DEL/EXISTS/EXPIRE/TTL. this PR
adds the missing string and utility commands so concurrent mode has near-complete
coverage for string workloads.

new ConcurrentKeyspace methods:

  • arithmetic: incr, decr, incr_by, incr_by_float with proper error types
  • string: append, strlen
  • TTL: persist, pexpire, pttl
  • iteration: keys, scan_keys, rename

new concurrent handler commands:

  • INCR, DECR, INCRBY, DECRBY, INCRBYFLOAT
  • APPEND, STRLEN
  • PERSIST, PEXPIRE, PTTL
  • MGET, MSET, TYPE, KEYS, SCAN, RENAME, INFO

also made format_float and glob_match pub(crate) in keyspace.rs for reuse.

what was tested

  • 18 new unit tests for ConcurrentKeyspace methods (arithmetic, string ops, TTL, keys/scan/rename)
  • all 363 core tests pass
  • all 43 server tests pass
  • clippy clean (cargo clippy --workspace --features protobuf -- -D warnings)

design considerations

  • error types (ConcurrentOpError, ConcurrentFloatError) are separate from the sharded keyspace's
    IncrError/IncrFloatError because the concurrent keyspace only deals with Bytes values, not the
    Value enum — there's no WrongType variant needed.
  • incr_by uses get_mut to update in-place when possible, avoiding a full set+remove cycle.
    handles the expired-key edge case by removing the stale entry and treating the key as new.
  • render_concurrent_info is separate from the sharded render_info since it doesn't need to
    broadcast to shards — it reads stats directly from the concurrent keyspace.
  • TYPE always returns "string" because concurrent mode only stores string values.

kacy added 4 commits February 12, 2026 15:18
add incr, decr, incr_by, incr_by_float with error types
(ConcurrentOpError, ConcurrentFloatError) to ConcurrentKeyspace.
these mirror the sharded keyspace's integer/float operations but
operate directly on DashMap entries without channel overhead.

also make format_float and glob_match pub(crate) in keyspace.rs
for reuse in the concurrent module.
add append, strlen, persist, pexpire, pttl for string/TTL ops.
add keys, scan_keys, rename for iteration and key management.
all methods follow the same patterns as the sharded keyspace but
operate directly on DashMap entries.
add match arms for INCR, DECR, INCRBY, DECRBY, INCRBYFLOAT,
APPEND, STRLEN, PERSIST, PEXPIRE, PTTL in the concurrent handler.
these dispatch directly to the new ConcurrentKeyspace methods,
avoiding the shard channel round-trip.
…ndler

MGET/MSET loop over existing get/set methods. TYPE always returns
"string" since concurrent mode only stores string values. KEYS and
SCAN iterate the DashMap directly. RENAME does remove+insert. INFO
renders server/memory/stats/keyspace sections using the concurrent
keyspace stats rather than broadcasting to shards.
@kacy kacy merged commit 205cbf4 into main Feb 12, 2026
4 of 7 checks passed
@kacy kacy deleted the feat/concurrent-string-helpers branch February 12, 2026 20:30
kacy added a commit that referenced this pull request Feb 19, 2026
* feat: add arithmetic methods to concurrent keyspace

add incr, decr, incr_by, incr_by_float with error types
(ConcurrentOpError, ConcurrentFloatError) to ConcurrentKeyspace.
these mirror the sharded keyspace's integer/float operations but
operate directly on DashMap entries without channel overhead.

also make format_float and glob_match pub(crate) in keyspace.rs
for reuse in the concurrent module.

* feat: add string and TTL helpers to concurrent keyspace

add append, strlen, persist, pexpire, pttl for string/TTL ops.
add keys, scan_keys, rename for iteration and key management.
all methods follow the same patterns as the sharded keyspace but
operate directly on DashMap entries.

* feat: wire string/TTL commands into concurrent handler

add match arms for INCR, DECR, INCRBY, DECRBY, INCRBYFLOAT,
APPEND, STRLEN, PERSIST, PEXPIRE, PTTL in the concurrent handler.
these dispatch directly to the new ConcurrentKeyspace methods,
avoiding the shard channel round-trip.

* feat: add MGET, MSET, TYPE, KEYS, SCAN, RENAME, INFO to concurrent handler

MGET/MSET loop over existing get/set methods. TYPE always returns
"string" since concurrent mode only stores string values. KEYS and
SCAN iterate the DashMap directly. RENAME does remove+insert. INFO
renders server/memory/stats/keyspace sections using the concurrent
keyspace stats rather than broadcasting to shards.
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