pub trait CachePager: Send {
// Required methods
fn meta(&self) -> CacheMeta;
fn pause(&mut self) -> Result<()>;
fn resume(&mut self) -> Result<()>;
fn occupied_pages(&self) -> Vec<u32>;
fn logical_seqs(&self) -> Vec<LogicalSeq>;
fn read_page(&self, ix: u32) -> Result<PageBytes>;
fn allocate_pages(&mut self, n: usize) -> Result<Vec<u32>>;
fn write_page(&mut self, ix: u32, page: &PageBytes) -> Result<()>;
fn install_logical_seqs(&mut self, seqs: &[LogicalSeq]) -> Result<()>;
}Expand description
Engine-agnostic paged-cache interface. Implementations are not required
to be thread-safe for read_page / write_page — the snapshot
orchestrator holds a &mut self for the duration of capture/restore.
Required Methods§
Sourcefn pause(&mut self) -> Result<()>
fn pause(&mut self) -> Result<()>
Pause the engine so the page table is stable. May be a no-op for adapters that already hold a write-lock during snapshot.
Sourcefn occupied_pages(&self) -> Vec<u32>
fn occupied_pages(&self) -> Vec<u32>
List physical-page indices that currently hold valid data.
Sourcefn logical_seqs(&self) -> Vec<LogicalSeq>
fn logical_seqs(&self) -> Vec<LogicalSeq>
Snapshot of every live logical sequence’s page-table mapping.
Sourcefn read_page(&self, ix: u32) -> Result<PageBytes>
fn read_page(&self, ix: u32) -> Result<PageBytes>
Read one (K, V) page out of the engine. Implementations return raw
bytes of length meta.page_bytes() for each.
Sourcefn allocate_pages(&mut self, n: usize) -> Result<Vec<u32>>
fn allocate_pages(&mut self, n: usize) -> Result<Vec<u32>>
Allocate n fresh physical-page slots and return their indices in
the order they should be filled. Restore writes pages in this order.
Sourcefn write_page(&mut self, ix: u32, page: &PageBytes) -> Result<()>
fn write_page(&mut self, ix: u32, page: &PageBytes) -> Result<()>
Write one (K, V) page into the engine at the given physical-page
index. The index MUST have been returned by a recent
Self::allocate_pages call.
Sourcefn install_logical_seqs(&mut self, seqs: &[LogicalSeq]) -> Result<()>
fn install_logical_seqs(&mut self, seqs: &[LogicalSeq]) -> Result<()>
Re-install the per-request logical-seq → page-list mapping after restore. Called once, after all pages have been written.