Skip to main content

BlobProducer

Struct BlobProducer 

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

Producer for variable-sized binary blobs and metadata in shared memory.

Implementations§

Source§

impl<M: Copy + 'static> BlobProducer<M>

Source

pub fn create<P: AsRef<Path>>( path: P, capacity: u64, arena_capacity: usize, ) -> Result<Self>

Creates a new blob producer with default options. capacity is the number of ring slots (power of 2). arena_capacity is the byte capacity of the payload arena (power of 2, e.g. 16MB).

Source

pub fn create_with_options<P: AsRef<Path>>( path: P, options: BlobProducerBuilder, ) -> Result<Self>

Creates a new blob producer with custom builder options.

Source

pub fn push(&mut self, meta: &M, payload: &[u8]) -> Result<u64>

Publishes a message with metadata and binary payload. Returns the assigned sequence number.

Source

pub fn push_with<F, R>( &mut self, meta: &M, len: usize, f: F, ) -> Result<(u64, R)>
where F: FnOnce(&mut [u8]) -> R,

Publishes with zero-copy writing directly into the payload arena.

Source

pub fn min_reader_seq(&self) -> Option<u64>

Minimum sequence across all currently living registered readers.

Source

pub fn reader_lag(&self) -> u64

Maximum lag across registered readers.

Source

pub fn headroom(&self) -> u64

Remaining write headroom before the slowest reader is lapped.

Source

pub fn active_readers(&self) -> Vec<ReaderInfo>

Status of all registered active readers.

Source

pub fn sequence(&self) -> u64

Current sequence number of the producer.

Source§

impl BlobProducer<()>

Convenience methods for producers with no metadata (M = ()).

Source

pub fn push_payload(&mut self, payload: &[u8]) -> Result<u64>

Trait Implementations§

Source§

impl<M: Copy + 'static> Debug for BlobProducer<M>

Source§

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

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

impl<M: Copy + 'static> Drop for BlobProducer<M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<M: Copy + Send + 'static> Send for BlobProducer<M>

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> 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§

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.