Trait sanakirja::LoadPage[][src]

pub trait LoadPage {
    type Error;
    fn load_page(&self, off: u64) -> Result<CowPage, Self::Error>;

    fn rc(&self, _off: u64) -> Result<u64, Self::Error> { ... }
}
Expand description

Trait for loading a page.

Associated Types

Required methods

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

Loading a page.

Provided methods

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

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

impl<E: Borrow<Env>> LoadPage for Txn<E>[src]

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

Find the appropriate map segment

type Error = Error

fn rc(&self, _: u64) -> Result<u64, Self::Error>[src]

impl<E: Borrow<Env>, A> LoadPage for MutTxn<E, A>[src]

type Error = Error

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

fn rc(&self, page: u64) -> Result<u64, Self::Error>[src]