pub struct VirtualMemory { /* private fields */ }Expand description
Virtual memory manager providing unified access to tiered storage
Implementations§
Source§impl VirtualMemory
impl VirtualMemory
Sourcepub fn new(config: VirtualMemoryConfig) -> Result<Self, VirtualMemoryError>
pub fn new(config: VirtualMemoryConfig) -> Result<Self, VirtualMemoryError>
Create a new virtual memory manager
Sourcepub fn allocate(
&self,
size: usize,
home_tier: MemoryTier,
) -> Result<VMemHandle, VirtualMemoryError>
pub fn allocate( &self, size: usize, home_tier: MemoryTier, ) -> Result<VMemHandle, VirtualMemoryError>
Allocate virtual memory
The home_tier specifies where data is persisted. For Disk tier,
data is written to disk; for Host tier, data stays in RAM.
Sourcepub fn free(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
pub fn free(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
Free a virtual memory allocation
Sourcepub fn write(
&self,
handle: &VMemHandle,
data: &[u8],
) -> Result<(), VirtualMemoryError>
pub fn write( &self, handle: &VMemHandle, data: &[u8], ) -> Result<(), VirtualMemoryError>
Write data to a virtual memory allocation
Sourcepub fn read(&self, handle: &VMemHandle) -> Result<Vec<u8>, VirtualMemoryError>
pub fn read(&self, handle: &VMemHandle) -> Result<Vec<u8>, VirtualMemoryError>
Read data from a virtual memory allocation
Sourcepub fn migrate(
&self,
handle: &VMemHandle,
target_tier: MemoryTier,
) -> Result<(), VirtualMemoryError>
pub fn migrate( &self, handle: &VMemHandle, target_tier: MemoryTier, ) -> Result<(), VirtualMemoryError>
Migrate data to a different tier
Sourcepub fn pin(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
pub fn pin(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
Pin an allocation (prevent eviction)
Sourcepub fn unpin(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
pub fn unpin(&self, handle: &VMemHandle) -> Result<(), VirtualMemoryError>
Unpin an allocation (allow eviction)
Sourcepub fn stats(&self) -> VirtualMemoryStats
pub fn stats(&self) -> VirtualMemoryStats
Get statistics about virtual memory usage
Sourcepub fn flush(&self) -> Result<(), VirtualMemoryError>
pub fn flush(&self) -> Result<(), VirtualMemoryError>
Flush all dirty allocations to their home tier
Auto Trait Implementations§
impl !Freeze for VirtualMemory
impl RefUnwindSafe for VirtualMemory
impl Send for VirtualMemory
impl Sync for VirtualMemory
impl Unpin for VirtualMemory
impl UnwindSafe for VirtualMemory
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