pub struct BufferPoolConfig {
pub min_size: NonZeroUsize,
pub max_size: NonZeroUsize,
pub max_per_class: NonZeroUsize,
pub prefill: bool,
pub alignment: NonZeroUsize,
}Expand description
Configuration for a buffer pool.
Fields§
§min_size: NonZeroUsizeMinimum buffer size. Must be >= alignment and a power of two.
max_size: NonZeroUsizeMaximum buffer size. Must be a power of two and >= min_size.
max_per_class: NonZeroUsizeMaximum number of buffers per size class.
prefill: boolWhether to pre-allocate all buffers on pool creation.
alignment: NonZeroUsizeBuffer alignment. Must be a power of two.
Use page_size() for storage I/O, cache_line_size() for network I/O.
Implementations§
Source§impl BufferPoolConfig
impl BufferPoolConfig
Sourcepub const fn for_network() -> Self
pub const fn for_network() -> Self
Network I/O preset: cache-line aligned, cache_line_size to 64KB buffers, 4096 per class, not prefilled.
Network operations typically need multiple concurrent buffers per connection (message, encoding, encryption) so we allow 4096 buffers per size class. Cache-line alignment is used because network buffers don’t require page alignment for DMA, and smaller alignment reduces internal fragmentation.
Sourcepub fn for_storage() -> Self
pub fn for_storage() -> Self
Storage I/O preset: page-aligned, page_size to 64KB buffers, 32 per class, not prefilled.
Page alignment is required for direct I/O and efficient DMA transfers.
Trait Implementations§
Source§impl Clone for BufferPoolConfig
impl Clone for BufferPoolConfig
Source§fn clone(&self) -> BufferPoolConfig
fn clone(&self) -> BufferPoolConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BufferPoolConfig
impl Debug for BufferPoolConfig
Auto Trait Implementations§
impl Freeze for BufferPoolConfig
impl RefUnwindSafe for BufferPoolConfig
impl Send for BufferPoolConfig
impl Sync for BufferPoolConfig
impl Unpin for BufferPoolConfig
impl UnwindSafe for BufferPoolConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more