Skip to main content

allsource_core/infrastructure/resp/
mod.rs

1//! Redis RESP3 protocol compatibility layer.
2//!
3//! Provides a TCP server that speaks the Redis RESP3 wire protocol, enabling
4//! `redis-cli` and Redis client libraries to interact with AllSource Core.
5//!
6//! ## Command Mapping
7//!
8//! | Redis Command | AllSource Operation |
9//! |---------------|---------------------|
10//! | `XADD <tenant> * event_type <t> entity_id <id> [payload <json>]` | `EventStore::ingest()` |
11//! | `XRANGE <stream_key> - + [COUNT n]` | `EventStore::query()` |
12//! | `XLEN <stream_key>` | event count |
13//! | `SUBSCRIBE <channel>` | real-time event broadcast |
14//! | `PING` | health check |
15//! | `INFO` | server info |
16//!
17//! ## Stream Key Conventions
18//!
19//! - Plain name (e.g., `default`) → filters by tenant_id
20//! - `entity:<id>` → filters by entity_id
21//! - `type:<event_type>` → filters by event_type
22//!
23//! ## Configuration
24//!
25//! Set `ALLSOURCE_RESP_PORT` to enable the RESP3 server (default: disabled).
26//! When set, the server listens on that port alongside the HTTP API.
27
28pub mod commands;
29pub mod protocol;
30pub mod server;
31
32pub use server::RespServer;