Expand description
kevy-embedded — kevy without the network.
In-process Redis-compatible key–value store: load + reply directly from your own threads, no TCP, no shards, no reactor. Use this when you want kevy’s data structures + persistence in the same address space as your app — caches, embedded databases, WASM blobs, sidecar tools.
Zero crates.io dependencies: only kevy-store (the keyspace)
and kevy-persist (snapshot + AOF). The whole network layer
(kevy-rt, kevy-sys, kevy-uring) is intentionally NOT pulled in.
§Quick start
use kevy_embedded::{Store, Config};
let s = Store::open(Config::default())?;
s.set(b"greeting", b"hello")?;
assert_eq!(s.get(b"greeting")?, Some(b"hello".to_vec()));§With persistence
with_persist(dir) enables AOF auto-append on every write and replays
on open — restart-safe out of the box. Snapshot (dump-0.rdb) is
loaded first if present; AOF (aof-0.aof) is replayed on top.
use kevy_embedded::{Store, Config};
let s = Store::open(Config::default().with_persist("./data"))?;
s.set(b"counter", b"42")?;
drop(s); // flushes AOF on drop
// Next process: state survives.
let s2 = Store::open(Config::default().with_persist("./data"))?;
assert_eq!(s2.get(b"counter")?, Some(b"42".to_vec()));§When NOT to use this crate
- You want a Redis-protocol TCP server → use the
kevycrate’sserveinstead. - You need cross-process concurrency → kevy-embedded is single-process (one mutex). Multi-process needs the network layer.
Structs§
- Config
- Embedded-store config. Build by chaining
with_*methods onConfig::default. - Expire
Stats - What
Store::tick_expiresaw and did. Surfaced for tests, INFO keyspace, and (eventually) Wave 2 task #4’s crash-safe verifier. - Kevy
Info - Snapshot of a store’s runtime counters, returned by
Store::info. A cheap aggregate (one mutex lock); fields mirror the individual accessors. - Rewrite
Stats - Result of an
Aof::rewrite_fromcall. Surfaced byBGREWRITEAOF/INFO persistence. - Store
- The embedded keyspace.
- Subscription
- A handle to one subscription — owns the receive end of the bus channel.
- Weak
Store - Weak handle to a
Store— does not keep the underlying keyspace alive.
Enums§
- Append
Fsync - When to fsync the AOF to disk.
- Eviction
Policy - Maxmemory eviction policy. Mirror of
kevy_config::EvictionPolicy— duplicated here sokevy-storestays a leaf crate (nokevy-configdep). - Pubsub
Frame - One pub/sub event delivered to a
Subscription. - Store
Error - Operation errors surfaced to the command layer.
- TtlReaper
Mode - How the active TTL reaper runs.