pub struct OutputRing { /* private fields */ }Expand description
Per-pane bounded live output storage with independent cursor polling.
Implementations§
Source§impl OutputRing
impl OutputRing
Sourcepub fn new(event_capacity: usize, recent_byte_capacity: usize) -> Self
pub fn new(event_capacity: usize, recent_byte_capacity: usize) -> Self
Creates an empty output ring with explicit event and recent-byte limits.
Both limits must be positive. A zero-sized ring would make every subscriber permanently lagged and is rejected at construction.
Sourcepub fn with_default_capacities() -> Self
pub fn with_default_capacities() -> Self
Creates an empty output ring using the v1 defaults.
Sourcepub fn push(&mut self, bytes: Vec<u8>) -> OutputEvent
pub fn push(&mut self, bytes: Vec<u8>) -> OutputEvent
Appends one output event, rotates the ring, and updates recent live bytes.
Sourcepub fn clear_retained(&mut self)
pub fn clear_retained(&mut self)
Clears retained events and recent bytes without rewinding the sequence.
Sourcepub fn cursor_from_oldest(&self) -> OutputCursor
pub fn cursor_from_oldest(&self) -> OutputCursor
Returns a cursor that starts with the oldest retained event.
Sourcepub fn cursor_from_now(&self) -> OutputCursor
pub fn cursor_from_now(&self) -> OutputCursor
Returns a cursor that starts after the newest appended event.
Sourcepub const fn cursor_from_sequence(sequence: u64) -> OutputCursor
pub const fn cursor_from_sequence(sequence: u64) -> OutputCursor
Returns a cursor that starts at an explicit output sequence.
Sourcepub fn poll_cursor(&self, cursor: &mut OutputCursor) -> Option<OutputCursorItem>
pub fn poll_cursor(&self, cursor: &mut OutputCursor) -> Option<OutputCursorItem>
Polls one item for cursor, reporting gaps before retained events.
Sourcepub fn poll_cursor_batch(
&self,
cursor: &mut OutputCursor,
limit: usize,
) -> Vec<OutputCursorItem>
pub fn poll_cursor_batch( &self, cursor: &mut OutputCursor, limit: usize, ) -> Vec<OutputCursorItem>
Polls up to limit items for cursor from one retained-ring snapshot.
A lag gap is returned only as the first item. Once the cursor is inside the retained range, the same immutable ring view cannot produce a later gap in this batch; callers therefore never advance over an event and then replace it with a lag response from a concurrently rotated ring.
Sourcepub fn oldest_sequence(&self) -> u64
pub fn oldest_sequence(&self) -> u64
Returns the oldest retained event sequence, or the next sequence if empty.
Sourcepub const fn next_sequence(&self) -> u64
pub const fn next_sequence(&self) -> u64
Returns the next sequence that will be assigned.
Sourcepub fn newest_sequence(&self) -> u64
pub fn newest_sequence(&self) -> u64
Returns the newest appended sequence, or zero before the first append.
Sourcepub const fn event_capacity(&self) -> usize
pub const fn event_capacity(&self) -> usize
Returns the configured event capacity.
Sourcepub const fn recent_byte_capacity(&self) -> usize
pub const fn recent_byte_capacity(&self) -> usize
Returns the configured recent live byte capacity.
Sourcepub fn retained_len(&self) -> usize
pub fn retained_len(&self) -> usize
Returns retained event count.
Sourcepub fn recent_len(&self) -> usize
pub fn recent_len(&self) -> usize
Returns the total bytes currently retained in recent live storage.
Sourcepub fn recent_snapshot(&self) -> RecentOutputSnapshot
pub fn recent_snapshot(&self) -> RecentOutputSnapshot
Returns a bounded recent live output snapshot.
Sourcepub fn retained_events(&self) -> Vec<OutputEvent>
pub fn retained_events(&self) -> Vec<OutputEvent>
Returns retained events in sequence order.
Trait Implementations§
Source§impl Clone for OutputRing
impl Clone for OutputRing
Source§fn clone(&self) -> OutputRing
fn clone(&self) -> OutputRing
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more