pub struct ShadowFile { /* private fields */ }Expand description
Manages shadow pages for copy-on-write during a transaction.
Implementations§
Source§impl ShadowFile
impl ShadowFile
pub fn new() -> Self
Sourcepub fn set_file_name(&mut self, name: &str)
pub fn set_file_name(&mut self, name: &str)
Set the BufferManager file name that this shadow file tracks.
pub fn create_shadow(&mut self, page_id: u64, data: Vec<u8>)
pub fn get_shadow(&self, page_id: u64) -> Option<&ShadowEntry>
pub fn has_shadow(&self, page_id: u64) -> bool
pub fn is_empty(&self) -> bool
Sourcepub fn apply(&self, buffer_manager: &Arc<Mutex<BufferManager>>) -> Result<()>
pub fn apply(&self, buffer_manager: &Arc<Mutex<BufferManager>>) -> Result<()>
Apply all dirty shadow pages to the BufferManager.
For each shadow entry, pins the page, writes the shadow data, marks it dirty, and unpins. This makes the transaction’s writes visible.
Call this on commit after the WAL has been flushed.
Sourcepub fn discard(&mut self)
pub fn discard(&mut self)
Discard all shadow entries (rollback).
Simply clears the entries — the original pages in the BufferManager were never modified, so no undo is needed at the page level.
pub fn dirty_pages(&self) -> impl Iterator<Item = &ShadowEntry>
Trait Implementations§
Source§impl Debug for ShadowFile
impl Debug for ShadowFile
Source§impl Default for ShadowFile
impl Default for ShadowFile
Source§fn default() -> ShadowFile
fn default() -> ShadowFile
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ShadowFile
impl RefUnwindSafe for ShadowFile
impl Send for ShadowFile
impl Sync for ShadowFile
impl Unpin for ShadowFile
impl UnsafeUnpin for ShadowFile
impl UnwindSafe for ShadowFile
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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