Skip to main content

Crate page_store

Crate page_store 

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

AccessPagedData
Access to shared paged data.
BlockPageStg
Implementation of PageStorage.
Limits
Memory limits.
PageInfo
Information for a page, including historic data.
SharedPagedData
Allows pages to be shared to allow concurrent readers.
Stash
Central store of data.

Enums§

SaveOp
Save or Rollback.

Traits§

PageStorage
Interface for page storage.
PageStorageInfo
Information about page sizes.

Type Aliases§

HashMap
Type alias for a hash map that uses the Fx hashing algorithm.
HashSet
Type alias for a hash set that uses the Fx hashing algorithm.