pub struct Frame { /* private fields */ }Expand description
A buffer frame: a PAGE_SIZE block of memory with metadata for buffer management.
§Safety
The data pointer is allocated via std::alloc and must be freed via Frame::drop.
Access to the data must be coordinated through:
pin_count > 0(frame is in use, cannot be evicted)latch(read/write access to the page data)
Implementations§
Source§impl Frame
impl Frame
Sourcepub unsafe fn data(&self) -> &[u8] ⓘ
pub unsafe fn data(&self) -> &[u8] ⓘ
Get a shared (read-only) reference to the page data.
§Safety
Caller must hold a shared latch or pin and ensure no writer exists.
Sourcepub unsafe fn data_mut(&self) -> &mut [u8] ⓘ
pub unsafe fn data_mut(&self) -> &mut [u8] ⓘ
Get an exclusive (mutable) reference to the page data.
§Safety
Caller must hold an exclusive latch. The &self signature is
intentional: Frame uses interior mutability via a raw pointer,
coordinated by pin_count and latch.
Sourcepub fn set_page_id(&self, pid: PageId)
pub fn set_page_id(&self, pid: PageId)
Set the page ID for this frame.
Sourcepub fn clear_dirty(&self)
pub fn clear_dirty(&self)
Clear the dirty flag.
Sourcepub fn is_recently_used(&self) -> bool
pub fn is_recently_used(&self) -> bool
Check if the frame was recently used.
Sourcepub fn set_recently_used(&self)
pub fn set_recently_used(&self)
Mark the frame as recently used.
Sourcepub fn clear_recently_used(&self)
pub fn clear_recently_used(&self)
Clear the recently-used flag (second-chance eviction).
Sourcepub fn has_valid_page(&self) -> bool
pub fn has_valid_page(&self) -> bool
Check if this frame holds a valid page.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Frame
impl RefUnwindSafe for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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
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