pub enum BPBackend {
Dynamic,
Prealloc {
capacity: usize,
},
}Expand description
Available allocation backends for BufPool
Variants§
Dynamic
All slots are dynamically constructed at runtime, avoids waiting for slot availablity under high contention at cost of runtime allocations
§When to use
- burst workloads
- low-contention code paths
- requests that may exceed the configured pool capacity
Prealloc
Uses a pre-allocated freelist w/ the given capacity
All the chunks are allocated upfront, avoiding runtime allocations, while providing lower and more
predicatble latency compared to BPBackend::Dynamic
§When to use
- hot IO paths
- write pipelines
- storage engines
- workloads where allocation latency must remain stable
If all buffers are currently in use, BufPool::allocate blocks until another Allocation
is dropped and buffers return to the pool
§Fallback
For BPBackend::Prealloc backend, f n exceeds the pool capacity, the allocation is performed using the
BPBackend::Dynamic
Trait Implementations§
impl Copy for BPBackend
impl StructuralPartialEq for BPBackend
Auto Trait Implementations§
impl Freeze for BPBackend
impl RefUnwindSafe for BPBackend
impl Send for BPBackend
impl Sync for BPBackend
impl Unpin for BPBackend
impl UnsafeUnpin for BPBackend
impl UnwindSafe for BPBackend
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