Expand description
SharedPagedData manages numbered Data pages, which can be shared by multiple processes.
PageStorageInfo has information about the page sizes available. The default maximum page size is 4612.
A cache ( Stash ) of pages is maintained, including a history of each modified page ( where necessary ).
If the cache size exceeds a limit, the least used pages are discarded to reduce memory usage.
§Test example
use page_store::{SharedPagedData,SaveOp};
use atom_file::{MemFile,Data};
use std::sync::Arc;
let spd = SharedPagedData::new(MemFile::new());
println!( "Number of page sizes={}", spd.psi.sizes() );
println!( "Max page size={}", spd.psi.max_size_page() );
let w = spd.new_writer();
let pnum : u64 = w.alloc_page();
w.set_data( pnum, Arc::new( vec![1,2,3,4] ) );
w.save( SaveOp::Save );
let r = spd.new_reader();
let mut d : Data = w.get_data( pnum );
assert!( *d == vec![1,2,3,4] );
let md = Arc::make_mut(&mut d);
md[0] = 2;
w.set_data( pnum, d );
w.save( SaveOp::Save );
let d : Data = w.get_data( pnum );
assert!( *d == vec![2,2,3,4] );
let d : Data = r.get_data( pnum );
assert!( *d == vec![1,2,3,4] ); // Reader still sees "old" data.Structs§
- Access
Paged Data - Access to shared paged data.
- Block
Page Stg - Implementation of PageStorage.
- Limits
- Memory limits.
- Page
Info - Information for a page, including historic data.
- Shared
Paged Data - Allows pages to be shared to allow concurrent readers.
- Stash
- Central store of data.
Enums§
- SaveOp
- Save or Rollback.
Traits§
- Page
Storage - Interface for page storage.
- Page
Storage Info - Information about page sizes.