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>
impl<M: Copy + 'static> BlobProducer<M>
Sourcepub fn create<P: AsRef<Path>>(
path: P,
capacity: u64,
arena_capacity: usize,
) -> Result<Self>
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).
Sourcepub fn create_with_options<P: AsRef<Path>>(
path: P,
options: BlobProducerBuilder,
) -> Result<Self>
pub fn create_with_options<P: AsRef<Path>>( path: P, options: BlobProducerBuilder, ) -> Result<Self>
Creates a new blob producer with custom builder options.
Sourcepub fn push(&mut self, meta: &M, payload: &[u8]) -> Result<u64>
pub fn push(&mut self, meta: &M, payload: &[u8]) -> Result<u64>
Publishes a message with metadata and binary payload. Returns the assigned sequence number.
Sourcepub fn push_with<F, R>(
&mut self,
meta: &M,
len: usize,
f: F,
) -> Result<(u64, R)>
pub fn push_with<F, R>( &mut self, meta: &M, len: usize, f: F, ) -> Result<(u64, R)>
Publishes with zero-copy writing directly into the payload arena.
Sourcepub fn min_reader_seq(&self) -> Option<u64>
pub fn min_reader_seq(&self) -> Option<u64>
Minimum sequence across all currently living registered readers.
Sourcepub fn reader_lag(&self) -> u64
pub fn reader_lag(&self) -> u64
Maximum lag across registered readers.
Sourcepub fn active_readers(&self) -> Vec<ReaderInfo>
pub fn active_readers(&self) -> Vec<ReaderInfo>
Status of all registered active readers.
Source§impl BlobProducer<()>
Convenience methods for producers with no metadata (M = ()).
impl BlobProducer<()>
Convenience methods for producers with no metadata (M = ()).
pub fn push_payload(&mut self, payload: &[u8]) -> Result<u64>
Trait Implementations§
Source§impl<M: Copy + 'static> Debug for BlobProducer<M>
impl<M: Copy + 'static> Debug for BlobProducer<M>
Source§impl<M: Copy + 'static> Drop for BlobProducer<M>
impl<M: Copy + 'static> Drop for BlobProducer<M>
impl<M: Copy + Send + 'static> Send for BlobProducer<M>
Auto Trait Implementations§
impl<M> !Sync for BlobProducer<M>
impl<M> Freeze for BlobProducer<M>
impl<M> RefUnwindSafe for BlobProducer<M>
impl<M> Unpin for BlobProducer<M>
impl<M> UnsafeUnpin for BlobProducer<M>
impl<M> UnwindSafe for BlobProducer<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more