Skip to content

feat: proto command parsing and server wiring - #85

Merged
kacy merged 4 commits into
mainfrom
feat/protobuf-commands
Feb 10, 2026
Merged

feat: proto command parsing and server wiring#85
kacy merged 4 commits into
mainfrom
feat/protobuf-commands

Conversation

@kacy

@kacy kacy commented Feb 10, 2026

Copy link
Copy Markdown
Owner

summary

  • adds Command variants and RESP3 parsing for all six PROTO.* commands (REGISTER, SET, GET, TYPE, SCHEMAS, DESCRIBE) to the protocol crate (no feature gates)
  • wires proto commands through the server's execute() handler, gated behind #[cfg(feature = "protobuf")]. PROTO.SET validates bytes against the schema registry before routing to the shard. PROTO.REGISTER broadcasts an AOF record to all shards for persistence
  • adds --protobuf CLI flag (and EMBER_PROTOBUF env var) to create a shared schema registry and enable proto commands at startup
  • adds proto key commands to cluster_slot_check() for cluster-mode slot routing
  • when the protobuf feature is not compiled, proto commands return an unknown command error

what was tested

  • cargo test --features protobuf — 310 tests pass, including 16 new command parsing tests covering all proto commands, flags (EX/PX/NX/XX), arity errors, and edge cases (zero expiry, NX+XX conflict)
  • cargo test (no feature) — full suite passes, no regressions
  • cargo clippy --features protobuf -- -D warnings — clean
  • cargo clippy -- -D warnings — clean
  • cargo fmt -- --check — clean

design considerations

  • protocol crate stays feature-free — the Command variants exist unconditionally so the parser doesn't need conditional compilation. the server handles the feature gate at execution time
  • schema validation happens in the connection handler (before shard routing), keeping the keyspace schema-unaware
  • ProtoRegisterAof is a dedicated shard request variant that writes an AOF record without touching the keyspace. broadcast to all shards ensures any shard's AOF can recover the schema on restart
  • std::sync::RwLock (not tokio's) is used for the schema registry since lock hold times are very short (validation, name lookups). avoids async lock overhead on the hot path

kacy added 4 commits February 10, 2026 13:00
add Command variants and from_frame() parsing for PROTO.REGISTER,
PROTO.SET, PROTO.GET, PROTO.TYPE, PROTO.SCHEMAS, and PROTO.DESCRIBE.
no feature gates in the protocol crate — these are just command
definitions. PROTO.SET supports the same EX/PX/NX/XX options as SET.
add execute() handling for all six PROTO.* commands, gated behind
the protobuf feature flag. PROTO.SET validates bytes against the
schema registry before routing to the shard. PROTO.REGISTER
broadcasts an AOF record to all shards for persistence.

adds ProtoRegisterAof shard request variant so schema registrations
are persisted through the existing AOF path. also adds proto key
commands to cluster_slot_check for cluster mode routing.
when --protobuf is passed (or EMBER_PROTOBUF env var is set), the
server creates a shared schema registry and wires it into the engine
config. gated behind the protobuf feature flag.
@kacy
kacy merged commit 67abfc7 into main Feb 10, 2026
7 checks passed
@kacy
kacy deleted the feat/protobuf-commands branch February 10, 2026 18:19
kacy added a commit that referenced this pull request Feb 11, 2026
* feat: add proto command parsing to protocol crate

add Command variants and from_frame() parsing for PROTO.REGISTER,
PROTO.SET, PROTO.GET, PROTO.TYPE, PROTO.SCHEMAS, and PROTO.DESCRIBE.
no feature gates in the protocol crate — these are just command
definitions. PROTO.SET supports the same EX/PX/NX/XX options as SET.

* feat: wire proto commands through server connection handler

add execute() handling for all six PROTO.* commands, gated behind
the protobuf feature flag. PROTO.SET validates bytes against the
schema registry before routing to the shard. PROTO.REGISTER
broadcasts an AOF record to all shards for persistence.

adds ProtoRegisterAof shard request variant so schema registrations
are persisted through the existing AOF path. also adds proto key
commands to cluster_slot_check for cluster mode routing.

* feat: add --protobuf CLI flag to enable proto commands

when --protobuf is passed (or EMBER_PROTOBUF env var is set), the
server creates a shared schema registry and wires it into the engine
config. gated behind the protobuf feature flag.

* chore: run cargo fmt
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