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
impl PageCache
pub fn new() -> Self
pub fn clear(&self)
pub fn get_root_ptr_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeRootPointerPage>
pub fn get_header_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeHeaderPage>
pub fn get_internal_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeInternalPage>
pub fn get_leaf_page( &self, tx: &Transaction, perm: Permission, key: &BTreePageID, ) -> ResultPod<BTreeLeafPage>
Sourcepub fn discard_page(&self, pid: &BTreePageID)
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
pub fn set_page_size(page_size: usize)
pub fn get_page_size() -> usize
Sourcepub fn flush_all_pages(&self, log_manager: &mut LogManager)
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?
Sourcepub fn flush_pages(&self, tx: &Transaction, log_manager: &mut LogManager)
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)
pub fn tx_complete(&self, tx: &Transaction, commit: bool)
pub fn recover_page<PAGE: BTreePage>( &self, pid: &BTreePageID, page: PAGE, buffer: &ConcurrentHashMap<BTreePageID, Arc<RwLock<PAGE>>>, )
Auto Trait Implementations§
impl Freeze for PageCache
impl RefUnwindSafe for PageCache
impl Send for PageCache
impl Sync for PageCache
impl Unpin for PageCache
impl UnwindSafe for PageCache
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