Skip to content

feat: add core string and key commands - #56

Merged
kacy merged 5 commits into
mainfrom
feat/core-string-key-commands
Feb 8, 2026
Merged

feat: add core string and key commands#56
kacy merged 5 commits into
mainfrom
feat/core-string-key-commands

Conversation

@kacy

@kacy kacy commented Feb 8, 2026

Copy link
Copy Markdown
Owner

summary

  • adds 7 missing commands that cover 90%+ of Redis string/key usage: INCRBY, DECRBY, INCRBYFLOAT, APPEND, STRLEN, KEYS, RENAME
  • full implementation across all layers: protocol parsing, keyspace methods, shard dispatch, AOF persistence, recovery, and connection routing
  • brings command count from 76 to 83, test count from 639 to 695

what was tested

  • protocol parsing tests for all 7 commands (correct parse + wrong arity)
  • keyspace unit tests: incr_by_float (5 tests), append (3 tests), strlen (3 tests), format_float (2 tests), keys (4 tests), rename (6 tests)
  • shard dispatch tests for all new request types including AOF record generation
  • cargo clippy --all-targets passes (fixed pre-existing approx_constant lint)
  • cargo test — 695 tests, all passing

design considerations

  • DECRBY reuses incr_by(key, -delta) rather than duplicating logic
  • INCRBYFLOAT records as SET in AOF (avoids float rounding drift during replay)
  • RENAME operates within a single shard (matches Redis Cluster cross-slot restriction)
  • KEYS scans all shards via broadcast and merges results
  • format_float helper matches Redis behavior (strips trailing zeros, integers without decimals)

kacy added 5 commits February 8, 2026 09:16
increment/decrement integer values by arbitrary amounts. makes
incr_by public in keyspace so INCRBY/DECRBY route through it
directly. includes full AOF persistence and recovery support.
increment float values by arbitrary amounts. adds IncrFloatError
type and incr_by_float method to keyspace. persists as SET records
in AOF to avoid float rounding drift during replay.
APPEND concatenates a value onto an existing string key (or creates
it). STRLEN returns the byte length of a string value. both handle
wrong-type errors and APPEND includes AOF persistence.
implements KEYS with glob pattern matching and RENAME with
atomic key move. includes full pipeline: protocol parsing,
keyspace methods, shard dispatch, AOF persistence, recovery,
and connection routing. also fixes clippy warnings in
INCRBYFLOAT tests (3.14 -> 2.72 to avoid approx_constant lint).
@kacy
kacy merged commit 2cd48a4 into main Feb 8, 2026
4 of 5 checks passed
@kacy
kacy deleted the feat/core-string-key-commands branch February 8, 2026 14:35
kacy added a commit that referenced this pull request Feb 11, 2026
* feat: add INCRBY and DECRBY commands

increment/decrement integer values by arbitrary amounts. makes
incr_by public in keyspace so INCRBY/DECRBY route through it
directly. includes full AOF persistence and recovery support.

* feat: add INCRBYFLOAT command

increment float values by arbitrary amounts. adds IncrFloatError
type and incr_by_float method to keyspace. persists as SET records
in AOF to avoid float rounding drift during replay.

* feat: add APPEND and STRLEN commands

APPEND concatenates a value onto an existing string key (or creates
it). STRLEN returns the byte length of a string value. both handle
wrong-type errors and APPEND includes AOF persistence.

* feat: add KEYS and RENAME commands

implements KEYS with glob pattern matching and RENAME with
atomic key move. includes full pipeline: protocol parsing,
keyspace methods, shard dispatch, AOF persistence, recovery,
and connection routing. also fixes clippy warnings in
INCRBYFLOAT tests (3.14 -> 2.72 to avoid approx_constant lint).

* docs: update README with new string and key commands
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