Trait holochain_state::prelude::WriteManager
source · [−]pub trait WriteManager<'e> {
fn with_commit_sync<E, R, F>(&'e mut self, f: F) -> Result<R, E>
where
E: From<DatabaseError>,
F: 'e + FnOnce(&mut Transaction<'_>) -> Result<R, E>;
fn with_commit_test<R, F>(&'e mut self, f: F) -> Result<R, DatabaseError>
where
F: 'e + FnOnce(&mut Transaction<'_>) -> R,
{ ... }
}
Expand description
Implementors are able to create a new read-write DB transaction
Required Methods
sourcefn with_commit_sync<E, R, F>(&'e mut self, f: F) -> Result<R, E>where
E: From<DatabaseError>,
F: 'e + FnOnce(&mut Transaction<'_>) -> Result<R, E>,
fn with_commit_sync<E, R, F>(&'e mut self, f: F) -> Result<R, E>where
E: From<DatabaseError>,
F: 'e + FnOnce(&mut Transaction<'_>) -> Result<R, E>,
Run a closure, passing in a mutable reference to a read-write transaction, and commit the transaction after the closure has run. If there is a SQLite error, recover from it and re-run the closure.