pub trait LoadPage {
    type Error: Debug;

    // Required method
    unsafe fn load_page(&self, off: u64) -> Result<CowPage, Self::Error>;

    // Provided methods
    unsafe fn load_page_contiguous(
        &self,
        _off: u64,
        _len: u64
    ) -> Result<CowPage, Self::Error> { ... }
    fn rc(&self, _off: u64) -> Result<u64, Self::Error> { ... }
}
Expand description

Trait for loading a page.

Required Associated Types§

Required Methods§

source

unsafe fn load_page(&self, off: u64) -> Result<CowPage, Self::Error>

Loading a page.

Provided Methods§

source

unsafe fn load_page_contiguous( &self, _off: u64, _len: u64 ) -> Result<CowPage, Self::Error>

Loading multiple pages written contiguously in the underlying storage media.

If the type also implements AllocPage, attention must be paid to the compatibility with alloc_contiguous.

source

fn rc(&self, _off: u64) -> Result<u64, Self::Error>

Reference-counting. Since reference-counts are designed to be storable into B trees by external allocators, pages referenced once aren’t stored, and hence are indistinguishable from pages that are never referenced. The default implementation returns 0.

This has the extra benefit of requiring less disk space, and isn’t more unsafe than storing the reference count, since we aren’t supposed to hold a reference to a page with “logical RC” 0, so storing “1” for that page would be redundant anyway.

Implementors§