Conversation
implements the EmberCache tonic trait with handlers for all command groups: strings, keys, lists, hashes, sets, sorted sets, vectors, server commands, and bidirectional pipeline streaming. each handler follows the same pattern: translate proto request to ShardRequest, route through the engine, map ShardResponse back to proto response. vector commands gracefully return UNIMPLEMENTED when built without the vector feature. error mapping: - WrongType → FAILED_PRECONDITION - OutOfMemory → RESOURCE_EXHAUSTED - shard unavailable → UNAVAILABLE - generic errors → INTERNAL no unwrap() or expect() in any handler.
tokio-stream provides ReceiverStream used by the bidirectional Pipeline rpc to stream responses back to clients.
adds --grpc-port (default 6380) and --no-grpc CLI args behind the grpc feature flag. the grpc listener spawns as a separate tokio task alongside the existing TCP and TLS accept loops, sharing the same engine, server context, and slowlog. both run() and run_concurrent() support the grpc listener.
37d6c01 to
1050f1a
Compare
kacy
added a commit
that referenced
this pull request
Feb 19, 2026
* add grpc service implementation implements the EmberCache tonic trait with handlers for all command groups: strings, keys, lists, hashes, sets, sorted sets, vectors, server commands, and bidirectional pipeline streaming. each handler follows the same pattern: translate proto request to ShardRequest, route through the engine, map ShardResponse back to proto response. vector commands gracefully return UNIMPLEMENTED when built without the vector feature. error mapping: - WrongType → FAILED_PRECONDITION - OutOfMemory → RESOURCE_EXHAUSTED - shard unavailable → UNAVAILABLE - generic errors → INTERNAL no unwrap() or expect() in any handler. * add tokio-stream dep for grpc pipeline streaming tokio-stream provides ReceiverStream used by the bidirectional Pipeline rpc to stream responses back to clients. * integrate grpc listener into server startup adds --grpc-port (default 6380) and --no-grpc CLI args behind the grpc feature flag. the grpc listener spawns as a separate tokio task alongside the existing TCP and TLS accept loops, sharing the same engine, server context, and slowlog. both run() and run_concurrent() support the grpc listener.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
implements the full grpc server for ember, sitting alongside RESP3 with its
own listener port. all commands route through the same sharded engine, so
behavior is identical regardless of protocol.
grpc.rs: tonic service impl (~1200 LOC) covering strings, keys, lists,hashes, sets, sorted sets, vectors, server commands, and bidirectional
pipeline streaming
--grpc-port 6380(default) and--no-grpcCLI flags behindgrpcfeaturerun()andrun_concurrent(), sharing engine, server context, and slowlogerror mapping follows grpc conventions:
no unwrap() or expect() anywhere. every match arm is covered.
what was tested
cargo build -p ember-server --features grpc— compilescargo build -p ember-server— no regression without featurecargo clippy -p ember-server --features grpc -- -D warnings— cleancargo test -p ember-server --features grpc— 43/43 passcargo fmt --all --check— cleandesign considerations
grpc service does not use a separate
grpc_convert.rsfile as originallyplanned. each handler does its own response mapping inline, which keeps the
code simpler and more readable since the mappings are straightforward.
the pipeline rpc uses a spawned task with an mpsc channel rather than direct
stream processing. this allows the pipeline to process commands concurrently
while maintaining response ordering via the request id field.
auth interceptor is not yet implemented (planned for a follow-up). the grpc
listener currently relies on the same protection mechanisms as RESP3 (network
isolation, requirepass at the RESP3 level).