Expand description
The internals of the KiviDB server, a Redis-compatible in-memory database.
This crate is published so that cargo install kividb can build the
kividb server. The server binary is not built from this library:
src/main.rs declares its own modules and its own global allocator. The
library is built from the same sources so the integration tests can use
them; it is not a public API. It is not a client or an embeddable
database, and any release may change or remove any of it. It sets a
global allocator too, so a crate that depended on it would get that one.
To talk to KiviDB from Rust, use a Redis client such as the redis crate.
Documentation for running the server: https://github.com/kividbio/kividb.
Modules§
- acl
- aof
- client_
registry - cluster
- cmdstats
- command_
gate - commands
- compaction
- Active defrag (#113): moving string values off the slabs that deletes
have left sparse, so that those slabs empty and their memory goes back to
the kernel (see
value_slab). - config
- eviction
- What happens when
maxmemoryis reached: Redis’smaxmemory-policy. - expiry
- field_
expiry - key_
bytes - A key as bytes, in twenty-four bytes where it is held: what a key that is
kept outside the keyspace is (
store::Key), as the list of keys due to expire, the keys a snapshot gives a time to live, eviction’s choice. - key_
moves - keyspace_
events - keyspec
- latency
- lazyfree
- Freeing in the background what takes long to free, as Redis’s lazyfree
does: a large value
UNLINKremoves, the keyspaceFLUSHALL ASYNCandFLUSHDB ASYNCremove, the librariesFUNCTION FLUSH ASYNCremoves. - listen
- The ports clients connect to, and
CONFIG SET portandtls-portmoving them (#24). - loglevel
- The server log.
- member_
set - The members of a set (
SADD): a hash table that can also hand out a member at random without looking at the others. - memory_
use - How much memory the process has allocated: what
maxmemoryis measured against, andused_memoryinINFO. - monitor
- node_
tls - pause
- protected_
mode - pubsub
- Pub/Sub: the hub that routes a published message to its subscribers, and what a connection keeps while it is one.
- redis_
settings - replication
- resp
- script_
clock - Logical clock frozen for the duration of a Lua script / FCALL (Redis
execution unit). TTL math andTIMEuse the snapshot taken when script execution starts. - server
- server_
uring - shared_
bytes - Bytes that are shared and never changed, behind one pointer: what a string key’s value is.
- shutdown
- slowlog
- snapshot
- stats
- store
- tag_
locks - tracking
- types
- update_
check - Asking GitHub, once at startup, whether there is a newer KiviDB release.
- value_
slab - Slabs of KiviDB’s own for small string values (#113).
- vector
- wait_
table - watch
- write_
gate - write_
order
Macros§
- log_at
- log_
debug - Internals, for whoever is debugging KiviDB itself.
- log_
error - Something failed and the operator has to act: data not saved, a replica that cannot sync, a file that cannot be read.
- log_
fatal - The process cannot go on; the caller exits after this.
- log_
info - The server’s life story: startup, loading, saving, role changes, configuration changes, shutdown. The default level.
- log_
throttled - Log at
$levelat most once every$secsseconds from this call site, for errors that can repeat as fast as the work that hits them (a full disk fails every AOF write; a file-descriptor limit fails every accept). - log_
verbose - Per-client events: connections, authentication failures, protocol errors. Useful when chasing a client problem; noisy otherwise.
- log_
warn - Something is wrong or about to be, but the server carries on.
- read_
lock - write_
lock
Statics§
Functions§
- run_
for_ test - Entry point for integration tests — starts a tokio server on the given config and blocks the calling thread. Meant to run inside a thread::spawn.