Expand description
kevy-config — TOML subset parser + Config schema for the kevy server.
Zero crates.io dependencies; #![forbid(unsafe_code)]. Built specifically
for kevy’s config file shape; not a general-purpose TOML library.
Supported TOML subset:
[section]table headers (one level deep)key = valuewithvalue∈ {string, integer, boolean, size literal}- String literals:
"double-quoted"and'single-quoted' - Integers: signed decimal (
123,-7); prefixed forms (0x/0o/0b) NOT supported - Booleans:
true/false - Size literals (kevy-specific extension):
"64mb"/"2gb"/"512kb"parsed viaparse_sizewhen the schema field expects bytes # commentto end of line
INTENTIONALLY UNSUPPORTED (TOML spec features kevy doesn’t need):
- dotted keys (
a.b.c = ...) - multi-line strings (
"""…""") - arrays / arrays of tables
- inline tables (
{ a = 1, b = 2 }) - datetime literals
See Config for the schema, Config::load for the precedence chain.
Structs§
- Advanced
Section [advanced]section — reactor-loop tuning knobs that used to be hardcodedconsts inkevy-rt. Defaults match the values shipped in workspace v1.3 / earlier so the existing benchmark numbers translate one-to-one. Tune only if you know what you’re doing (bench/REPORT.mddocuments the trade-offs).- CliOverrides
- Optional CLI overrides applied via
Config::merge_cli. - Config
- Complete kevy config: defaults + per-section overrides loaded from the TOML file + env + CLI.
- Expiry
Section [expiry]section. Controls the TTL background reaper.- LogSection
[log]section.- Memory
Section [memory]section.- Notification
Flags - Parsed view of
NotificationSection::notify_keyspace_events. The runtime caches this struct per-shard (hot-reload via the existingLiveRuntimeConfigtick path) so the per-write-command check reduces to four bool reads on the hot path. - Notification
Section [notification]section.notify_keyspace_eventsis a string of flag chars (Redis convention):Kkeyspace channel,Ekeyevent channel,ggeneric cmds,$string cmds,llist,sset,hhash,zzset,Aalias forg$lshz(every event class except the not-yet-implementedx/e/t/n). Default empty = OFF (Redis default — zero hot-path cost).- Persistence
Section [persistence]section.- Server
Section [server]section.- Slowlog
Section [slowlog]section — controls the per-shard slow-command ring buffer surfaced bySLOWLOG GET/LEN/RESET. Default is OFF (slower_than_micros = -1) so the hot path never pays theInstant::now()pair around dispatch (~30 ns/op, ≈9 % at 3 M ops/s). To enable Redis-style 10 ms tracking, setslower_than_micros = 10000in[slowlog]or runCONFIG SET slowlog-log-slower-than 10000.
Enums§
- Append
Fsync - AOF fsync policy. Matches Redis
appendfsync. - Config
Error - Reasons
Config::load/from_toml_strcan fail. - Eviction
Policy - Maxmemory eviction policy. 8 variants matching Redis.
NoEviction(default) returns an error on writes oncemaxmemoryis hit. - LogLevel
- Log verbosity.
- LogOutput
- Where to write log output.
Functions§
- parse_
notification_ flags - Parse a Redis-style
notify_keyspace_eventsflag string intoNotificationFlags. Unknown chars are ignored (forward-compat forx/e/t/nnot yet implemented — see the section docs). TheAalias enables every event-class flag except channels. - parse_
size - Parse a size literal (
"64mb","2gb","512", …) into a byte count.