Trait Allocator

Source
pub trait Allocator<'l> {
    type LayerStream: Write + Read + Seek;

    // Required methods
    fn load_layers(&self) -> Result<Vec<Layer<'l, Self::LayerStream>>, Error>;
    fn add_layer(&mut self) -> Result<Layer<'l, Self::LayerStream>, Error>;
    fn drop_top_layer(&mut self) -> Result<(), Error>;
    fn rebase(&mut self, top_layer: usize) -> Result<(), Error>;
}
Expand description

The allocator for a StackDB that defines how or where the layers are stored and managed

Required Associated Types§

Source

type LayerStream: Write + Read + Seek

The type of data stream the layers read and write to

Required Methods§

Source

fn load_layers(&self) -> Result<Vec<Layer<'l, Self::LayerStream>>, Error>

Loads all the read-only layers in the database as Layers

Source

fn add_layer(&mut self) -> Result<Layer<'l, Self::LayerStream>, Error>

Adds a read-write layer to the database

Source

fn drop_top_layer(&mut self) -> Result<(), Error>

Removes the top layer from the database

Source

fn rebase(&mut self, top_layer: usize) -> Result<(), Error>

Removes all the bottom layers except for the one specified (and above)

Implementors§