GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs.rs
  • ringfire-0.5.2
  • Permalink
  • Docs.rs crate page
  • MIT
  • Apache-2.0
  • Repository
  • crates.io
  • Source
  • alex09x
  • futures-core ^0.3 normal optional
  • libc ^0.2 normal
  • memmap2 ^0.9 normal
  • tokio ^1 normal optional

This view

  • Original page
  • New address

GeezerVison is showing docs.rs — RingConsumer in ringfire::spmc - Rust

ringfire::spmc

Struct RingConsumer 

Source
pub struct RingConsumer<T: Copy + 'static> { /* private fields */ }
Expand description

Multi-consumer ring buffer reader backed by shared memory (/dev/shm).

Implementations§

Source§

impl<T: Copy + LayoutSignature + 'static> RingConsumer<T>

Source

pub fn builder() -> RingConsumerBuilder<T>

Returns a new RingConsumerBuilder for configuring attach options.

Source

pub fn attach<P: AsRef<Path>>(path: P) -> Result<Self>

Attaches to an existing ring buffer, starting from the oldest available message.

Preserves standard replay behavior.

Source

pub fn attach_latest<P: AsRef<Path>>(path: P) -> Result<Self>

Attaches to an existing ring buffer, starting from the latest published message.

Skips historical messages to connect immediately to live market data.

Source

pub fn attach_from_offset<P: AsRef<Path>, O: AsRef<Path>>( path: P, offset_file: O, ) -> Result<Self>

Attaches to an existing ring buffer, resuming from the specified offset file.

If the offset file does not exist, starts from the latest published message.

Source

pub fn attach_with_options<P: AsRef<Path>>( path: P, options: RingConsumerBuilder<T>, ) -> Result<Self>

Attaches to an existing shared memory ring buffer at path with custom builder options.

Source

pub fn recv_status(&mut self) -> RecvStatus<T>

Attempts to read the next message with explicit status (Ok, Empty, or Lapped).

Source

pub fn try_recv(&mut self) -> Option<T>

Attempts to read the next available message without blocking. Returns Some(T) if a new message was published (even if lapped), or None if caught up.

Source

pub fn recv_batch(&mut self, buf: &mut [T]) -> usize

Reads up to buf.len() available messages into the provided slice. Returns the number of messages read.

Source

pub fn recv_blocking<W: WaitStrategy>(&mut self, wait: &mut W) -> T

Reads the next message, blocking according to the provided WaitStrategy.

Source

pub fn jump_to_latest(&mut self) -> u64

Jumps cursor directly to the latest published sequence, skipping any backlog. Returns the count of skipped messages.

Source

pub fn jump_to_oldest(&mut self) -> u64

Jumps cursor to the oldest message still surviving in the buffer. Returns the count of skipped messages.

Source

pub fn lapped_count(&self) -> u64

Returns the total count of messages skipped due to writer lapping.

Source

pub fn cursor(&self) -> u64

Current reader cursor sequence number.

Source

pub fn capacity(&self) -> u64

Ring buffer capacity.

Source

pub fn lag(&self) -> u64

Number of published messages currently pending for this consumer.

Source

pub fn seek(&mut self, target_seq: u64) -> u64

Seeks reader cursor to a specific sequence number.

If target_seq is older than the oldest surviving message in the ring, cursor automatically advances to the oldest available sequence and returns the number of skipped messages.

Source

pub fn checkpoint(&self) -> Option<&OffsetCheckpoint>

Reference to the attached shared memory offset checkpoint, if configured.

Source

pub fn offset_path(&self) -> Option<&Path>

Path to the shared memory offset file, if configured.

Source

pub fn registry(&self) -> Option<&ReaderRegistry>

Reference to the ReaderRegistry, if enabled in the ring header.

Source

pub fn registration(&self) -> Option<&ReaderRegistration>

Reference to this consumer’s ReaderRegistration, if registered.

Source

pub fn commit_offset(&self) -> Result<()>

Atomically persists the last processed sequence number (cursor - 1) directly into shared memory.

Source

pub fn commit_offset_to<P: AsRef<Path>>( &self, path: P, consumer_name: &str, ) -> Result<()>

Atomically persists the last processed sequence number (cursor - 1) to a specified shared memory path.

Source

pub fn last_processed_sequence(&self) -> u64

Sequence number of the last successfully processed message (cursor - 1).

Trait Implementations§

Source§

impl<T: Copy + 'static> Debug for RingConsumer<T>

Source§

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

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

impl<T: Copy + Send + 'static> Send for RingConsumer<T>

Auto Trait Implementations§

§

impl<T> !Sync for RingConsumer<T>

§

impl<T> Forget for RingConsumer<T>

§

impl<T> Freeze for RingConsumer<T>
where *const Slot<T>: Freeze, PhantomData<T>: Freeze,

§

impl<T> Move for RingConsumer<T>

§

impl<T> RefUnwindSafe for RingConsumer<T>
where *const Slot<T>: RefUnwindSafe, PhantomData<T>: RefUnwindSafe,

§

impl<T> Unpin for RingConsumer<T>
where *const Slot<T>: Unpin, PhantomData<T>: Unpin,

§

impl<T> UnsafeUnpin for RingConsumer<T>
where *const Slot<T>: UnsafeUnpin, PhantomData<T>: UnsafeUnpin,

§

impl<T> UnwindSafe for RingConsumer<T>
where *const Slot<T>: UnwindSafe, PhantomData<T>: UnwindSafe,

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> 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> LayoutSignature for T
where T: 'static,

Source§

fn layout_signature() -> u64

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.