pub struct MemoryManager<P>where
P: MemoryProvider,{ /* private fields */ }Expand description
The memory manager handles page-level memory operations on top of a
MemoryProvider.
Implementations§
Source§impl<P> MemoryManager<P>where
P: MemoryProvider,
impl<P> MemoryManager<P>where
P: MemoryProvider,
Sourcepub fn init(provider: P) -> Self
pub fn init(provider: P) -> Self
Initializes the memory manager and allocates the header and reserved pages.
§Panics
Panics if the memory provider fails to initialize.
Sourcepub const fn schema_page(&self) -> Page
pub const fn schema_page(&self) -> Page
Returns the schema page.
Sourcepub fn write_at_raw(
&mut self,
page: Page,
offset: PageOffset,
buf: &[u8],
) -> MemoryResult<()>
pub fn write_at_raw( &mut self, page: Page, offset: PageOffset, buf: &[u8], ) -> MemoryResult<()>
Writes raw bytes at the specified page and offset, bypassing alignment and encoding checks.
This is used by the journal rollback path which already holds pre-captured byte buffers.
Trait Implementations§
Source§impl<P> MemoryAccess for MemoryManager<P>where
P: MemoryProvider,
impl<P> MemoryAccess for MemoryManager<P>where
P: MemoryProvider,
Source§fn allocate_page(&mut self) -> MemoryResult<Page>
fn allocate_page(&mut self) -> MemoryResult<Page>
Allocates an additional page in memory and returns its number.
Source§fn read_at<D>(&self, page: Page, offset: PageOffset) -> MemoryResult<D>where
D: Encode,
fn read_at<D>(&self, page: Page, offset: PageOffset) -> MemoryResult<D>where
D: Encode,
Reads a typed value from the specified page and offset.
Source§fn write_at<E>(
&mut self,
page: Page,
offset: PageOffset,
data: &E,
) -> MemoryResult<()>where
E: Encode,
fn write_at<E>(
&mut self,
page: Page,
offset: PageOffset,
data: &E,
) -> MemoryResult<()>where
E: Encode,
Writes a typed value at the specified page and offset.
Source§fn zero<E>(
&mut self,
page: Page,
offset: PageOffset,
data: &E,
) -> MemoryResult<()>where
E: Encode,
fn zero<E>(
&mut self,
page: Page,
offset: PageOffset,
data: &E,
) -> MemoryResult<()>where
E: Encode,
Zeros out the region occupied by
data at the specified page
and offset.Source§fn read_at_raw(
&self,
page: Page,
offset: PageOffset,
buf: &mut [u8],
) -> MemoryResult<usize>
fn read_at_raw( &self, page: Page, offset: PageOffset, buf: &mut [u8], ) -> MemoryResult<usize>
Reads raw bytes into
buf at the specified page and offset. Read moreAuto Trait Implementations§
impl<P> Freeze for MemoryManager<P>where
P: Freeze,
impl<P> RefUnwindSafe for MemoryManager<P>where
P: RefUnwindSafe,
impl<P> Send for MemoryManager<P>where
P: Send,
impl<P> Sync for MemoryManager<P>where
P: Sync,
impl<P> Unpin for MemoryManager<P>where
P: Unpin,
impl<P> UnsafeUnpin for MemoryManager<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for MemoryManager<P>where
P: UnwindSafe,
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