pub struct Magazine { /* private fields */ }Expand description
Pool of num_slots reusable slot buffers. Owned by the reader thread.
Implementations§
Source§impl Magazine
impl Magazine
Sourcepub fn new(num_slots: usize, slot_size: usize, num_workers: usize) -> Self
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.
Sourcepub fn from_plan(plan: PoolPlan) -> Self
pub fn from_plan(plan: PoolPlan) -> Self
Allocate the pool from a PoolPlan — the memory-bounded entry point.
Sourcepub fn with_slice_size(
num_slots: usize,
slot_size: usize,
slice_size: usize,
) -> Self
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.
pub fn slot_size(&self) -> usize
pub fn slice_size(&self) -> usize
pub fn num_slots(&self) -> usize
Auto Trait Implementations§
impl Freeze for Magazine
impl RefUnwindSafe for Magazine
impl Send for Magazine
impl Sync for Magazine
impl Unpin for Magazine
impl UnsafeUnpin for Magazine
impl UnwindSafe for Magazine
Blanket Implementations§
impl<T> Allocation for T
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