pub struct BufPoolCfg {
pub buffer_size: BufferSize,
pub max_memory: usize,
}Expand description
All the available configrations for BufPool
§Example
use frozen_core::{bufpool::BufPoolCfg, utils::BufferSize};
const BUF_SIZE: BufferSize = BufferSize::S64;
let cfg = BufPoolCfg {
buffer_size: BUF_SIZE,
max_memory: BUF_SIZE as usize * 0x1000,
};
assert_ne!(cfg.max_memory, 0);
assert!(cfg.max_memory > cfg.buffer_size.bytes());Fields§
§buffer_size: BufferSizeSize (in bytes) of an indivdual buffer unit allocated
max_memory: usizeMaximum allowed memory (in bytes) to be simultaneosuly allocated by BufPool
IMPORTANT: When trying to allocate more memory then BufPoolCfg::max_memory via
BufPool::allocate, a deadlock will happen due to memory budgeting in place. The caller
must make sure the max_meory is high enough to avoid this scenerio.
NOTE: To avoid backpressure, set the max_memory to an arbitrary large value. This
would not have any direct impact on performance or resource usage, and will avoid
backpressure under heavy workload.
Trait Implementations§
Source§impl Clone for BufPoolCfg
impl Clone for BufPoolCfg
Source§fn clone(&self) -> BufPoolCfg
fn clone(&self) -> BufPoolCfg
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BufPoolCfg
Source§impl Debug for BufPoolCfg
impl Debug for BufPoolCfg
impl Eq for BufPoolCfg
Source§impl PartialEq for BufPoolCfg
impl PartialEq for BufPoolCfg
Source§fn eq(&self, other: &BufPoolCfg) -> bool
fn eq(&self, other: &BufPoolCfg) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BufPoolCfg
Auto Trait Implementations§
impl Freeze for BufPoolCfg
impl RefUnwindSafe for BufPoolCfg
impl Send for BufPoolCfg
impl Sync for BufPoolCfg
impl Unpin for BufPoolCfg
impl UnsafeUnpin for BufPoolCfg
impl UnwindSafe for BufPoolCfg
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