Struct PagePool

Source
pub struct PagePool { /* private fields */ }
Expand description

A page pool of currently unused pages available for use in Pages.

Implementations§

Source§

impl PagePool

Source

pub fn new_for_test() -> Self

Source

pub fn new(max_size: Option<usize>) -> Self

Returns a new page pool with max_size bytes rounded down to the nearest multiple of 64 KiB.

if no size is provided, a default of 1 page is used.

Source

pub fn put(&self, page: Box<Page>)

Puts back a Page into the pool.

Source

pub fn put_many(&self, pages: impl Iterator<Item = Box<Page>>)

Puts back a Page into the pool.

Source

pub fn take_with_fixed_row_size(&self, fixed_row_size: Size) -> Box<Page>

Takes a Page from the pool or creates a new one.

The returned page supports fixed rows of size fixed_row_size.

Source

pub fn take_deserialize_from( &self, buf: &[u8], ) -> Result<Box<Page>, DecodeError>

Deserialize a page from buf but reuse the allocations in the pool.

Source

pub fn dropped_pages_count(&self) -> usize

Returns the number of pages dropped by the pool because the pool was at capacity.

Source

pub fn new_pages_allocated_count(&self) -> usize

Returns the number of fresh pages allocated through the pool.

Source

pub fn pages_reused_count(&self) -> usize

Returns the number of pages reused from the pool.

Source

pub fn pages_returned_count(&self) -> usize

Returns the number of pages returned to the pool.

Trait Implementations§

Source§

impl Clone for PagePool

Source§

fn clone(&self) -> PagePool

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de> DeserializeSeed<'de> for &PagePool

Source§

type Output = Box<Page>

The type produced by using this seed.
Source§

fn deserialize<D: Deserializer<'de>>( self, de: D, ) -> Result<Self::Output, D::Error>

Equivalent to the more common Deserialize::deserialize associated function, except with some initial piece of data (the seed self) passed in.
Source§

impl MemoryUsage for PagePool

Source§

fn heap_usage(&self) -> usize

The heap memory usage of this type. The default implementation returns 0.
Source§

impl<'de> ProductVisitor<'de> for &PagePool

Source§

type Output = Box<Page>

The resulting product.
Source§

fn product_name(&self) -> Option<&str>

Returns the name of the product, if any.
Source§

fn product_len(&self) -> usize

Returns the length of the product.
Source§

fn visit_seq_product<A: SeqProductAccess<'de>>( self, prod: A, ) -> Result<Self::Output, A::Error>

The input contains an unnamed product.
Source§

fn visit_named_product<A: NamedProductAccess<'de>>( self, _: A, ) -> Result<Self::Output, A::Error>

The input contains a named product.
Source§

fn product_kind(&self) -> ProductKind

Returns the kind of the product.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.