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§
Sourcetype LayerStream: Write + Read + Seek
type LayerStream: Write + Read + Seek
The type of data stream the layers read and write to
Required Methods§
Sourcefn load_layers(&self) -> Result<Vec<Layer<'l, Self::LayerStream>>, Error>
fn load_layers(&self) -> Result<Vec<Layer<'l, Self::LayerStream>>, Error>
Loads all the read-only layers in the database as Layers
Sourcefn add_layer(&mut self) -> Result<Layer<'l, Self::LayerStream>, Error>
fn add_layer(&mut self) -> Result<Layer<'l, Self::LayerStream>, Error>
Adds a read-write layer to the database
Sourcefn drop_top_layer(&mut self) -> Result<(), Error>
fn drop_top_layer(&mut self) -> Result<(), Error>
Removes the top layer from the database