orbit_rs/ring/cursor/source.rs
1use crate::ring::Frame;
2
3/// Read-only source that can be walked by [`super::RingCursor`].
4///
5/// Implementors expose only the ring facts needed by the generic walker:
6/// the ring kind, current head, fixed capacity, and counter-addressed
7/// frame reads.
8pub trait RingFrameSource {
9 /// The `OrbitTyped::KIND` carried by this ring.
10 fn kind(&self) -> u8;
11
12 /// Monotonic write head: number of writes ever published.
13 fn head(&self) -> u64;
14
15 /// Fixed slot count for this ring.
16 fn capacity(&self) -> usize;
17
18 /// Read the frame currently occupying `counter % capacity`.
19 fn read_at(&self, counter: u64) -> Option<Frame>;
20}