pub struct BufferPool { /* private fields */ }Expand description
Static Buffer pool managing multiple memory arenas
of which [ArenaBuffer]s are returned for requested allocations
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub const DEFAULT_ARENA_SIZE: usize
pub const DEFAULT_ARENA_SIZE: usize
3MB Default size for each Arena. Any higher and
it will fail to register the second arena with io_uring due
to RL_MEMLOCK limit for un-privileged processes being 8MB total.
Sourcepub const TEST_ARENA_SIZE: usize
pub const TEST_ARENA_SIZE: usize
1MB size For testing/CI
Sourcepub const DEFAULT_PAGE_SIZE: usize = 4096
pub const DEFAULT_PAGE_SIZE: usize = 4096
4KB default page_size
Sourcepub fn get_page(&self) -> Buffer
pub fn get_page(&self) -> Buffer
Request a Buffer the size of the db_page_size the BufferPool was initialized with.
Sourcepub fn get_wal_frame(&self) -> Buffer
pub fn get_wal_frame(&self) -> Buffer
Request a Buffer for use with a WAL frame,
[Database::page_size] + WAL_FRAME_HEADER_SIZE`
Sourcepub fn begin_init(io: &Arc<dyn IO>, arena_size: usize) -> Arc<Self> ⓘ
pub fn begin_init(io: &Arc<dyn IO>, arena_size: usize) -> Arc<Self> ⓘ
Create a static BufferPool initialize the pool to the default page size, without
populating the Arenas. Arenas will not be created until [BufferPool::finalize_page_size],
and the pool will temporarily return temporary buffers to prevent reallocation of the
arena if the page size is set to something other than the default value.
Sourcepub fn finalize_with_page_size(&self, page_size: usize) -> Result<()>
pub fn finalize_with_page_size(&self, page_size: usize) -> Result<()>
Call when [Database::db_state] is initialized, providing the page_size to allocate
an arena for the pool. Before this call, the pool will use temporary buffers which are
cached in thread local storage.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BufferPool
impl !RefUnwindSafe for BufferPool
impl !UnwindSafe for BufferPool
impl Unpin for BufferPool
impl UnsafeUnpin for BufferPool
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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