pub struct ModuleDb { /* private fields */ }Expand description
Standard module database.
Single entry point for all module storage. Opens DB at {data_dir}/db/,
runs migrations, provides named trees.
Implementations§
Source§impl ModuleDb
impl ModuleDb
Sourcepub fn open<P: AsRef<Path>>(data_dir: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(data_dir: P) -> Result<Self>
Open the module database at {data_dir}/db/.
Uses the same backend as the node when MODULE_CONFIG_DATABASE_BACKEND is set.
Sourcepub fn open_with_migrations<P: AsRef<Path>>(
data_dir: P,
migrations: &[(u32, MigrationUp)],
) -> Result<Self>
pub fn open_with_migrations<P: AsRef<Path>>( data_dir: P, migrations: &[(u32, MigrationUp)], ) -> Result<Self>
Open and run migrations. Convention for modules that use migrations.
Sourcepub fn open_or_temp<P: AsRef<Path>>(
data_dir: P,
module_name: &str,
) -> Result<Self>
pub fn open_or_temp<P: AsRef<Path>>( data_dir: P, module_name: &str, ) -> Result<Self>
Open at data_dir, or fallback to temp dir when primary open fails.
Both attempts use open_module_db (Sled/TidesDB).
Avoids a hard-coded Redb fallback, which fails when blvm-node is built without redb.
Sourcepub fn open_or_temp_with_migrations<P: AsRef<Path>>(
data_dir: P,
module_name: &str,
migrations: &[(u32, MigrationUp)],
) -> Result<Self>
pub fn open_or_temp_with_migrations<P: AsRef<Path>>( data_dir: P, module_name: &str, migrations: &[(u32, MigrationUp)], ) -> Result<Self>
Like open_or_temp but runs migrations when the primary data_dir succeeds.
Sourcepub fn run_migrations(&self, migrations: &[(u32, MigrationUp)]) -> Result<()>
pub fn run_migrations(&self, migrations: &[(u32, MigrationUp)]) -> Result<()>
Run pending migrations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModuleDb
impl !RefUnwindSafe for ModuleDb
impl Send for ModuleDb
impl Sync for ModuleDb
impl Unpin for ModuleDb
impl UnsafeUnpin for ModuleDb
impl !UnwindSafe for ModuleDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more