pub struct LazyDB { /* private fields */ }
Implementations§
Source§impl LazyDB
impl LazyDB
Sourcepub fn init(path: impl AsRef<Path>) -> Result<Self, LDBError>
pub fn init(path: impl AsRef<Path>) -> Result<Self, LDBError>
Initialises a new LazyDB directory at a specified path.
It will create the path if it doesn’t already exist and initialise a metadata file with the current version of lazy-db
if one doesn’t exist already.
WARNING: if you initialise the database this way, you cannot compile it in future without errors being thrown!
If you want to compile it, then use LazyDB::init_db
instead.
Sourcepub fn init_db(path: impl AsRef<Path>) -> Result<Self, LDBError>
pub fn init_db(path: impl AsRef<Path>) -> Result<Self, LDBError>
Initialise a new compiled LazyDB
(compressed tarball) at the specified path.
It will create the path if it doesn’t already exist and initialise a metadata file with the current version of lazy-db
if one doesn’t exist already.
Sourcepub fn load_dir(path: impl AsRef<Path>) -> Result<Self, LDBError>
pub fn load_dir(path: impl AsRef<Path>) -> Result<Self, LDBError>
Loads a pre-existing LazyDB directory at a specified path.
Loads LazyDB as read-write
allowing for modification of the data within it.
If the LazyDB is invalid, it will return an error.
Sourcepub fn load_db(path: impl AsRef<Path>) -> Result<Self, LDBError>
pub fn load_db(path: impl AsRef<Path>) -> Result<Self, LDBError>
Loads a pre-existing LazyDB file (compressed tarball) at a specified path
Loads LazyDB as read-write
allowing for modification of the data within it.
If a directory version of the LazyDatabase exists, it will load the directory version instead of decompiling.
If the LazyDB is invalid, it will return an error.
Sourcepub fn as_container(&self) -> Result<LazyContainer, LDBError>
pub fn as_container(&self) -> Result<LazyContainer, LDBError>
Gets the ‘root’ container of the LazyDB