pub struct SyntheticCachePager { /* private fields */ }Expand description
In-memory CachePager used by every test in this crate and by
examples/02-twelve-way-parallel/ (when that lands).
Stores pages in a BTreeMap<u32, PageBytes> keyed by physical-page index.
allocate_pages returns monotonically increasing indices; write_page
inserts; read_page reads.
Clone-able — the inner state is Arc<Mutex<…>> so two clones share the
same logical engine. Useful for “fork the in-memory engine; mutate one
branch; serialize each; assert dedup.”
Implementations§
Source§impl SyntheticCachePager
impl SyntheticCachePager
Sourcepub fn populate_synthetic(&mut self, n_pages: u32, seed: u64) -> Result<()>
pub fn populate_synthetic(&mut self, n_pages: u32, seed: u64) -> Result<()>
Pre-populate the engine with n_pages deterministic pages and one
logical sequence covering them all. Useful for tests / benches.
seed mixes into the per-page fill so different seeds produce
different pages (driving CAS divergence) while the same seed produces
byte-identical pages (driving CAS dedup).
Trait Implementations§
Source§impl CachePager for SyntheticCachePager
impl CachePager for SyntheticCachePager
Source§fn pause(&mut self) -> Result<()>
fn pause(&mut self) -> Result<()>
Source§fn occupied_pages(&self) -> Vec<u32>
fn occupied_pages(&self) -> Vec<u32>
Source§fn logical_seqs(&self) -> Vec<LogicalSeq>
fn logical_seqs(&self) -> Vec<LogicalSeq>
Source§fn read_page(&self, ix: u32) -> Result<PageBytes>
fn read_page(&self, ix: u32) -> Result<PageBytes>
meta.page_bytes() for each.Source§fn allocate_pages(&mut self, n: usize) -> Result<Vec<u32>>
fn allocate_pages(&mut self, n: usize) -> Result<Vec<u32>>
n fresh physical-page slots and return their indices in
the order they should be filled. Restore writes pages in this order.Source§fn write_page(&mut self, ix: u32, page: &PageBytes) -> Result<()>
fn write_page(&mut self, ix: u32, page: &PageBytes) -> Result<()>
Self::allocate_pages call.Source§fn install_logical_seqs(&mut self, seqs: &[LogicalSeq]) -> Result<()>
fn install_logical_seqs(&mut self, seqs: &[LogicalSeq]) -> Result<()>
Source§impl Clone for SyntheticCachePager
impl Clone for SyntheticCachePager
Source§fn clone(&self) -> SyntheticCachePager
fn clone(&self) -> SyntheticCachePager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more