PageCache

Struct PageCache 

Source
pub struct PageCache {
    pub root_pointer_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeRootPointerPage>>>,
    pub internal_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeInternalPage>>>,
    pub leaf_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeLeafPage>>>,
    pub header_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeHeaderPage>>>,
}

Fields§

§root_pointer_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeRootPointerPage>>>§internal_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeInternalPage>>>§leaf_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeLeafPage>>>§header_buffer: ConcurrentHashMap<BTreePageID, Arc<RwLock<BTreeHeaderPage>>>

Implementations§

Source§

impl PageCache

Source

pub fn new() -> Self

Source

pub fn clear(&self)

Source

pub fn get_root_ptr_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeRootPointerPage>

Source

pub fn get_header_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeHeaderPage>

Source

pub fn get_internal_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeInternalPage>

Source

pub fn get_leaf_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeLeafPage>

Source

pub fn discard_page(&self, pid: &BTreePageID)

Remove the specific page id from the buffer pool. Needed by the recovery manager to ensure that the buffer pool doesn’t keep a rolled back page in its cache.

Also used by B+ tree files to ensure that deleted pages are removed from the cache so they can be reused safely

Source

pub fn set_page_size(page_size: usize)

Source

pub fn get_page_size() -> usize

Source

pub fn flush_all_pages(&self, log_manager: &mut LogManager)

Flush all dirty pages to disk.

NB: Be careful using this routine – it writes dirty data to disk so will break small-db if running in NO STEAL mode.

TODO: does these pages belong to a single table?

Source

pub fn flush_pages(&self, tx: &Transaction, log_manager: &mut LogManager)

Write all pages of the specified transaction to disk.

TODO: protest this function (mut self / or global lock)

Source

pub fn tx_complete(&self, tx: &Transaction, commit: bool)

Source

pub fn recover_page<PAGE: BTreePage>( &self, pid: &BTreePageID, page: PAGE, buffer: &ConcurrentHashMap<BTreePageID, Arc<RwLock<PAGE>>>, )

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> 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, 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.