Struct holochain_sqlite::db::DbWrite [−][src]
pub struct DbWrite<Kind: DbKindT>(_);
Expand description
The canonical representation of a (singleton) database. The wrapper contains methods for managing transactions and database connections,
Implementations
Create or open an existing database reference,
pub fn open_with_sync_level(
path_prefix: &Path,
kind: Kind,
sync_level: DbSyncLevel
) -> DatabaseResult<Self>
Create a unique db in a temp dir with no static management of the connection pool, useful for testing.
👎 Deprecated: is this used?
is this used?
Remove the db and directory
pub async fn async_commit<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError> + Send + 'static,
F: FnOnce(&mut Transaction<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
pub async fn async_commit_in_place<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError>,
F: FnOnce(&mut Transaction<'_>) -> Result<R, E>,
R: Send,
pub async fn async_commit_in_place<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError>,
F: FnOnce(&mut Transaction<'_>) -> Result<R, E>,
R: Send,
If possible prefer async_commit as this is slower and can starve chained futures.
Methods from Deref<Target = DbRead<Kind>>
pub async fn async_reader<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError> + Send + 'static,
F: FnOnce(Transaction<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
Trait Implementations
fn async_reader<'life0, 'async_trait, E, R, F>(
&'life0 self,
f: F
) -> Pin<Box<dyn Future<Output = Result<R, E>> + Send + 'async_trait>> where
E: From<DatabaseError> + Send + 'static,
F: FnOnce(Transaction<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
E: 'async_trait,
R: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn async_reader<'life0, 'async_trait, E, R, F>(
&'life0 self,
f: F
) -> Pin<Box<dyn Future<Output = Result<R, E>> + Send + 'async_trait>> where
E: From<DatabaseError> + Send + 'static,
F: FnOnce(Transaction<'_>) -> Result<R, E> + Send + 'static,
R: Send + 'static,
E: 'async_trait,
R: 'async_trait,
F: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Run an async read transaction on a background thread.
fn sync_reader<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError>,
F: FnOnce(Transaction<'_>) -> Result<R, E>,
fn sync_reader<E, R, F>(&self, f: F) -> Result<R, E> where
E: From<DatabaseError>,
F: FnOnce(Transaction<'_>) -> Result<R, E>,
Run an sync read transaction on a the current thread.
Auto Trait Implementations
impl<Kind> !RefUnwindSafe for DbWrite<Kind>
impl<Kind> !UnwindSafe for DbWrite<Kind>
Blanket Implementations
Mutably borrows from an owned value. Read more
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more