metrale_storage/cache_peer/mod.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! 2026-09-25: The cache peer: a process that lends RAM to KV and snapshot
4//! clients over one-sided RDMA. A connection gets either its own arena (RAW
5//! mode), which the client allocates in, or the shared paging arena of its
6//! (kind, blob_bytes), backed by a swap file (`registry`).
7//!
8//! Owner: metrale-storage peers.
9//! Invariants:
10//! - A connection starts with the v2 paging header; `blob_bytes == 0`
11//! selects RAW mode, any other value paging.
12//! - A paging client is refused unless `RdmaConfig::swap_dir` is set.
13
14// 2026-09-25: The handshake codec is metrale-gpu-sys `wire`;
15// `kv_server_params_round_trip` in crates/gpu-sys/tests/wire_roundtrip.rs
16// covers `CacheServerParams`.
17pub use metrale_gpu_sys::wire::CacheServerParams;
18
19// 2026-09-25: Only the verbs build of the connection handler uses the registry.
20#[cfg(metrale_rdma_verbs)]
21mod registry;
22#[cfg(unix)]
23mod server_impl;
24
25#[cfg(unix)]
26pub use server_impl::{RdmaConfig, serve};