Skip to main content

MemoryManager

Struct MemoryManager 

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

Source

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.

Source

pub const fn acl_page(&self) -> Page

Returns the ACL page number.

Source

pub const fn schema_page(&self) -> Page

Returns the schema page.

Source

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,

Source§

fn page_size(&self) -> u64

Returns the size of a single memory page.
Source§

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,

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,

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,

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>

Reads raw bytes into buf at the specified page and offset. Read more

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