Struct redb::WriteTransaction
source · [−]pub struct WriteTransaction<'db> { /* private fields */ }
Expand description
A read/write transaction
Only a single WriteTransaction
may exist at a time
Implementations
sourceimpl<'db> WriteTransaction<'db>
impl<'db> WriteTransaction<'db>
sourcepub fn set_durability(&mut self, durability: Durability)
pub fn set_durability(&mut self, durability: Durability)
Set the desired durability level for writes made in this transaction
Defaults to Durability::Immediate
sourcepub fn open_table<'txn, K: RedbKey + ?Sized, V: RedbValue + ?Sized>(
&'txn self,
definition: TableDefinition<'_, K, V>
) -> Result<Table<'db, 'txn, K, V>, Error>
pub fn open_table<'txn, K: RedbKey + ?Sized, V: RedbValue + ?Sized>(
&'txn self,
definition: TableDefinition<'_, K, V>
) -> Result<Table<'db, 'txn, K, V>, Error>
Open the given table
The table will be created if it does not exist
sourcepub fn open_multimap_table<'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized>(
&'txn self,
definition: MultimapTableDefinition<'_, K, V>
) -> Result<MultimapTable<'db, 'txn, K, V>, Error>
pub fn open_multimap_table<'txn, K: RedbKey + ?Sized, V: RedbKey + ?Sized>(
&'txn self,
definition: MultimapTableDefinition<'_, K, V>
) -> Result<MultimapTable<'db, 'txn, K, V>, Error>
Open the given table
The table will be created if it does not exist
sourcepub fn delete_table<K: RedbKey + ?Sized, V: RedbValue + ?Sized>(
&self,
definition: TableDefinition<'_, K, V>
) -> Result<bool, Error>
pub fn delete_table<K: RedbKey + ?Sized, V: RedbValue + ?Sized>(
&self,
definition: TableDefinition<'_, K, V>
) -> Result<bool, Error>
Delete the given table
Returns a bool indicating whether the table existed
sourcepub fn delete_multimap_table<K: RedbKey + ?Sized, V: RedbKey + ?Sized>(
&self,
definition: MultimapTableDefinition<'_, K, V>
) -> Result<bool, Error>
pub fn delete_multimap_table<K: RedbKey + ?Sized, V: RedbKey + ?Sized>(
&self,
definition: MultimapTableDefinition<'_, K, V>
) -> Result<bool, Error>
Delete the given table
Returns a bool indicating whether the table existed
sourcepub fn list_tables(&self) -> Result<impl Iterator<Item = String> + '_, Error>
pub fn list_tables(&self) -> Result<impl Iterator<Item = String> + '_, Error>
List all the tables
sourcepub fn list_multimap_tables(
&self
) -> Result<impl Iterator<Item = String> + '_, Error>
pub fn list_multimap_tables(
&self
) -> Result<impl Iterator<Item = String> + '_, Error>
List all the multimap tables
sourcepub fn commit(self) -> Result<(), Error>
pub fn commit(self) -> Result<(), Error>
Commit the transaction
All writes performed in this transaction will be visible to future transactions, and are
durable as consistent with the Durability
level set by Self::set_durability
sourcepub fn abort(self) -> Result<(), Error>
pub fn abort(self) -> Result<(), Error>
Abort the transaction
All writes performed in this transaction will be rolled back
sourcepub fn stats(&self) -> Result<DatabaseStats, Error>
pub fn stats(&self) -> Result<DatabaseStats, Error>
Retrieves information about storage usage in the database
Trait Implementations
Auto Trait Implementations
impl<'db> !RefUnwindSafe for WriteTransaction<'db>
impl<'db> !Send for WriteTransaction<'db>
impl<'db> !Sync for WriteTransaction<'db>
impl<'db> Unpin for WriteTransaction<'db>
impl<'db> !UnwindSafe for WriteTransaction<'db>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more