Expand description
Fixed-capacity ring buffers: a stack-allocated sample/latency ring and a lock-free single-producer/single-consumer ring, loom-tested.
ds-kit roadmap Part 3.2: latency/sample history and cross-thread handoff both want bounded queues with zero steady-state allocation. This crate is the canonical leaf: every domain crate may depend on it (layering L1, no upward edges).
Hot path contract: no panics, no syscalls, and no allocation after
construction — SampleRing never allocates at all, SpscRing
allocates its slot buffer exactly once in SpscRing::new. The naive
reference lives in oracle and is kept forever for differential
testing (ds-kit AGENTS.md).
SpscRing is the estate’s sanctioned unsafe exception: raw slot
access into a MaybeUninit buffer behind UnsafeCell, with every block
annotated with the acquire/release invariant it relies on and the whole
protocol model-checked under loom (tests/loom_spsc.rs). SampleRing
contains no unsafe code.
Modules§
- oracle
- The forever-oracle for differential testing: naive
Vec+ shift-on-pop spec forms, not optimized. Never deleted, never optimized. Naive reference implementations: the forever-oracle.
Structs§
- Iter
- Oldest-first iterator over a
SampleRing; exact-size. - Sample
Ring - Fixed-capacity sample/latency ring, stack-allocated, oldest-first.
- Spsc
Ring - Lock-free single-producer/single-consumer ring with fixed capacity.