Skip to main content

Builder

Struct Builder 

Source
pub struct Builder<S> { /* private fields */ }
Expand description

Builds a queue over a Store.

Implementations§

Source§

impl<S: Store> Builder<S>

Source

pub fn new(store: S) -> Self

Start a builder over store (1024 items, unbounded bytes, Durability::Sync).

Source

pub fn capacity(self, capacity: usize) -> Self

Set the maximum number of unacked items before push blocks. Must be > 0.

Source

pub fn max_bytes(self, max_bytes: usize) -> Self

Also bound the queue by the total bytes of unacked items (default: unbounded). push blocks when either this or the item-count capacity would be exceeded. An item larger than max_bytes is still admitted into an empty queue, so one large item cannot deadlock. Must be > 0.

Source

pub fn durability(self, durability: Durability) -> Self

Set the durability policy.

Source

pub fn durable_acks(self, durable_acks: bool) -> Self

Set whether acks are made durable (fsync’d). Defaults to true.

At-least-once delivery does not need the ack itself to be durable: if an ack is lost to a crash, the item is simply redelivered. Setting this to false skips the ack fsync - roughly halving the per-message fsync cost under Durability::Sync - in exchange for redelivering the items whose acks had not reached disk when the process crashed. It never weakens the delivery guarantee, and has no effect under Durability::None (nothing fsyncs).

Source

pub fn open(self) -> Result<Ends<S>, OpenError<S::Error>>

Open the queue, recovering any items already in the store.

Source§

impl<S: Store> Builder<S>

Source

pub fn open_typed<T, C>( self, codec: C, ) -> Result<TypedEnds<S, T, C>, OpenError<S::Error>>
where C: Codec<T> + Clone,

Open a typed queue that encodes values with codec.

Returns a typed producer/consumer pair over the same backend as open; the configured capacity and durability apply unchanged.

Auto Trait Implementations§

§

impl<S> Freeze for Builder<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Builder<S>
where S: RefUnwindSafe,

§

impl<S> Send for Builder<S>
where S: Send,

§

impl<S> Sync for Builder<S>
where S: Sync,

§

impl<S> Unpin for Builder<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Builder<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for Builder<S>
where S: 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, 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, <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.