Skip to main content

Magazine

Struct Magazine 

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

Pool of num_slots reusable slot buffers. Owned by the reader thread.

Implementations§

Source§

impl Magazine

Source

pub fn new(num_slots: usize, slot_size: usize, num_workers: usize) -> Self

Allocate the pool. slice_size = slot_size / num_workers (≥1), the granularity at which the reader cuts big files. All slots start FREE.

Source

pub fn from_plan(plan: PoolPlan) -> Self

Allocate the pool from a PoolPlan — the memory-bounded entry point.

Source

pub fn with_slice_size( num_slots: usize, slot_size: usize, slice_size: usize, ) -> Self

Allocate the pool with slice_size given explicitly rather than derived from slot_size.

This is the seam that lets the reservation shrink without moving a single output byte: slice_size is the cut length (output-affecting — it lands in chunk boundaries and checksums), slot_size × num_slots is only how much buffer is held in flight. See PoolPlan.

Source

pub fn slot_size(&self) -> usize

Source

pub fn slice_size(&self) -> usize

Source

pub fn num_slots(&self) -> usize

Source

pub fn returner(&self) -> Ejector

Handle workers use to release slots. Clone it into each worker thread.

Source

pub fn claim(&self) -> Option<Clip<'_>>

Reader: claim a free slot to fill. Blocks until one is free — this block is the ONLY backpressure in the pipeline. Returns None once the pool is shut down and drained (all return senders gone).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.