Struct SkdbDirAlloc

Source
pub struct SkdbDirAlloc {
    pub path: PathBuf,
    pub layers: Vec<PathBuf>,
    pub cursor: u32,
}
Expand description

§Directory Allocator


Allocates within a directory that lives on the file-system with the layer order determined by the layer file names

Fields§

§path: PathBuf

the path of the directory database

§layers: Vec<PathBuf>

the (sorted) paths of the layers in the database

§cursor: u32

Implementations§

Source§

impl SkdbDirAlloc

Source

pub fn new(path: impl AsRef<Path>) -> Result<Self, Error>

Creates a new SkDB

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self, Error>

Loads a Skdb from a directory

Trait Implementations§

Source§

impl<'a> Allocator<'a> for SkdbDirAlloc

Source§

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

Loads the layer files from the directory

Source§

type LayerStream = File

The type of data stream the layers read and write to
Source§

fn add_layer(&mut self) -> Result<Layer<'a, 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)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.