How kividbio/kividb works
KiviDB is a Redis-compatible in-memory database server with RESP2/RESP3 clients, sharded key-value storage, optional persistence, replication and cluster operation, plus search, vectors, JSON and time-series capabilities. The principal workflow is a client sending a Redis command over the network; the server parses and dispatches it, operates on database state, and returns a protocol reply. The graph preserves documented product branches, but sampled excerpts do not expose the full request-dispatch implementation, so some subsystem relationships are documented by the README rather than traced through source.
Main entry points: commands Redis commands · main.rs Server startup · search.rs Full-text search · listen.rs Network listeners
Components 23
Server runtime
- Server startup
src/main.rs - Network listeners
src/listen.rs - RESP protocol
src/resp - Command dispatch
src/commands/handler.rs
Data and commands
- Redis commands
src/commands - Sharded key store
src/store/mod.rs - Pub/sub
src/pubsub.rs - Probabilistic sketches
src/sketch/mod.rs
Search and analytics
- Full-text search
src/commands/search.rs - Aggregation pipeline
src/commands/aggregate_pipeline.rs - Vector indexes
src/vector/mod.rs - JSON commands
src/commands/json.rs - Time-series commands
src/commands/ts_query.rs
Durability and topology
- Append-only log
src/aof.rs - Snapshots
src/snapshot.rs - Replication
src/replication/mod.rs - Replica client
src/replication/replica_client.rs - Cluster state
src/cluster/mod.rs - Cluster routing
src/cluster/routing.rs
Security and clients
- Client registry
src/client_registry.rs - ACL controls
src/acl.rs - Configuration
src/config.rs
Other components
- Redis client
Connections 22
- Redis client → Network listeners: connects
README.md - Network listeners → Server startup: serves clients
src/main.rs - Redis client → RESP protocol: speaks RESP
README.md - RESP protocol → Command dispatch: dispatches commands
- Command dispatch → Redis commands: routes commands
- Redis commands → Sharded key store: reads and writes
- Redis commands → Pub/sub: publishes messages
- Redis commands → Full-text search: runs FT commands
README.md - Full-text search → Vector indexes: uses indexes
- Full-text search → Aggregation pipeline: aggregates results
src/commands/aggregate_pipeline.rs - Redis commands → JSON commands: runs JSON commands
README.md - Redis commands → Time-series commands: runs TS commands
README.md - Redis commands → Probabilistic sketches: runs sketch commands
- Server startup → Append-only log: initializes persistence
src/main.rs - Server startup → Replication: starts replication
src/main.rs - Replication → Replica client: uses replica client
src/main.rs - Server startup → Cluster state: starts cluster
src/main.rs - Cluster state → Cluster routing: routes slots
src/cluster/routing.rs - Server startup → Snapshots: restores indexes
src/main.rs - Server startup → Client registry: tracks connections
src/main.rs - Redis commands → ACL controls: checks permissions
- Server startup → Configuration: loads settings
src/main.rs