Skip to main content

OutputRing

Struct OutputRing 

Source
pub struct OutputRing { /* private fields */ }
Expand description

Per-pane bounded live output storage with independent cursor polling.

Implementations§

Source§

impl OutputRing

Source

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.

Source

pub fn with_default_capacities() -> Self

Creates an empty output ring using the v1 defaults.

Source

pub fn push(&mut self, bytes: Vec<u8>) -> u64

Appends one output event, rotates the ring, and updates recent live bytes.

Source

pub fn push_with_recent_retention( &mut self, bytes: Vec<u8>, retain_recent: bool, ) -> u64

Appends one output event, optionally updating the lag-recovery buffer.

Source

pub fn push_shared(&mut self, bytes: Arc<[u8]>) -> u64

Appends one shared output event without copying its byte payload.

Source

pub fn push_shared_with_recent_retention( &mut self, bytes: Arc<[u8]>, retain_recent: bool, ) -> u64

Appends one shared output event, optionally updating lag recovery bytes.

Source

pub fn clear_retained(&mut self)

Clears retained events and recent bytes without rewinding the sequence.

Source

pub fn cursor_from_oldest(&self) -> OutputCursor

Returns a cursor that starts with the oldest retained event.

Source

pub fn cursor_from_now(&self) -> OutputCursor

Returns a cursor that starts after the newest appended event.

Source

pub const fn cursor_from_sequence(sequence: u64) -> OutputCursor

Returns a cursor that starts at an explicit output sequence.

Source

pub fn poll_cursor(&self, cursor: &mut OutputCursor) -> Option<OutputCursorItem>

Polls one item for cursor, reporting gaps before retained events.

Source

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.

Source

pub fn oldest_sequence(&self) -> u64

Returns the oldest retained event sequence, or the next sequence if empty.

Source

pub const fn next_sequence(&self) -> u64

Returns the next sequence that will be assigned.

Source

pub fn newest_sequence(&self) -> u64

Returns the newest appended sequence, or zero before the first append.

Source

pub const fn event_capacity(&self) -> usize

Returns the configured event capacity.

Source

pub const fn recent_byte_capacity(&self) -> usize

Returns the configured recent live byte capacity.

Source

pub fn retained_len(&self) -> usize

Returns retained event count.

Source

pub const fn retained_event_bytes(&self) -> usize

Returns the total raw bytes retained by event payloads.

Source

pub fn recent_len(&self) -> usize

Returns the total bytes currently retained in recent live storage.

Source

pub fn recent_snapshot(&self) -> RecentOutputSnapshot

Returns a bounded recent live output snapshot.

Source

pub fn retained_events(&self) -> Vec<OutputEvent>

Returns retained events in sequence order.

Trait Implementations§

Source§

impl Clone for OutputRing

Source§

fn clone(&self) -> OutputRing

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutputRing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OutputRing

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.