pub struct TxWrite<I: DatabaseIdentifier>(/* private fields */);Expand description
A read-write database transaction handle.
Obtained from DbWrite::begin. Exposes the same operations as
DbWrite and DbRead, but every operation runs on a single
connection inside a real SQL transaction. Call TxWrite::commit
to persist the changes, TxWrite::rollback to discard them, or
drop without committing to roll back.
Implementations§
Source§impl<I: DatabaseIdentifier> TxWrite<I>
impl<I: DatabaseIdentifier> TxWrite<I>
Source§impl TxWrite<Conductor>
impl TxWrite<Conductor>
Sourcepub async fn set_conductor_tag(&mut self, tag: &str) -> Result<()>
pub async fn set_conductor_tag(&mut self, tag: &str) -> Result<()>
Set the conductor tag.
Sourcepub async fn put_app_interface(
&mut self,
port: i64,
id: &str,
model: &AppInterfaceModel,
) -> Result<()>
pub async fn put_app_interface( &mut self, port: i64, id: &str, model: &AppInterfaceModel, ) -> Result<()>
Insert or update an app interface.
Sourcepub async fn put_signal_subscription(
&mut self,
interface_port: i64,
interface_id: &str,
app_id: &str,
filters_blob: &[u8],
) -> Result<()>
pub async fn put_signal_subscription( &mut self, interface_port: i64, interface_id: &str, app_id: &str, filters_blob: &[u8], ) -> Result<()>
Save a signal subscription for an app interface.
Sourcepub async fn delete_signal_subscriptions(
&mut self,
interface_port: i64,
interface_id: &str,
) -> Result<()>
pub async fn delete_signal_subscriptions( &mut self, interface_port: i64, interface_id: &str, ) -> Result<()>
Delete all signal subscriptions for an app interface.
Sourcepub async fn delete_app_interface(&mut self, port: i64, id: &str) -> Result<()>
pub async fn delete_app_interface(&mut self, port: i64, id: &str) -> Result<()>
Delete an app interface.
Sourcepub async fn put_installed_app(
&mut self,
app_id: &str,
app: &InstalledAppCommon,
status: &AppStatus,
) -> Result<()>
pub async fn put_installed_app( &mut self, app_id: &str, app: &InstalledAppCommon, status: &AppStatus, ) -> Result<()>
Insert or update an installed app.
Sourcepub async fn delete_installed_app(&mut self, app_id: &str) -> Result<()>
pub async fn delete_installed_app(&mut self, app_id: &str) -> Result<()>
Delete an installed app.
Sourcepub async fn witness_nonce(
&mut self,
agent: AgentPubKey,
nonce: Nonce256Bits,
now: Timestamp,
expires: Timestamp,
) -> Result<WitnessNonceResult, Error>
pub async fn witness_nonce( &mut self, agent: AgentPubKey, nonce: Nonce256Bits, now: Timestamp, expires: Timestamp, ) -> Result<WitnessNonceResult, Error>
Witness a nonce (check if it’s fresh and record it).
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
Sourcepub async fn insert_action(
&mut self,
action: &SignedActionHashed,
record_validity: Option<RecordValidity>,
) -> Result<()>
pub async fn insert_action( &mut self, action: &SignedActionHashed, record_validity: Option<RecordValidity>, ) -> Result<()>
Insert an Action row, storing its signature and pre-computed hash.
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_cap_claim( &mut self, author: &AgentPubKey, tag: &str, grantor: &AgentPubKey, secret: &[u8], ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_cap_grant( &mut self, action_hash: &ActionHash, cap_access: i64, tag: Option<&str>, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
Sourcepub async fn acquire_chain_lock(
&mut self,
author: &AgentPubKey,
subject: &[u8],
expires_at: Timestamp,
now: Timestamp,
) -> Result<bool>
pub async fn acquire_chain_lock( &mut self, author: &AgentPubKey, subject: &[u8], expires_at: Timestamp, now: Timestamp, ) -> Result<bool>
Try to acquire the chain lock for author. See the inner
chain_lock::acquire_chain_lock for the full rule set. Returns true
when the caller now holds the lock.
pub async fn release_chain_lock(&mut self, author: &AgentPubKey) -> Result<()>
pub async fn prune_expired_chain_locks(&mut self, now: Timestamp) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_chain_op(&mut self, op: InsertChainOp<'_>) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_deleted_link_index( &mut self, action_hash: &ActionHash, create_link_hash: &ActionHash, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_deleted_record_index( &mut self, action_hash: &ActionHash, deletes_action_hash: &ActionHash, deletes_entry_hash: &EntryHash, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_entry( &mut self, hash: &EntryHash, entry: &Entry, ) -> Result<()>
pub async fn insert_private_entry( &mut self, hash: &EntryHash, author: &AgentPubKey, entry: &Entry, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_limbo_chain_op( &mut self, op: InsertLimboChainOp<'_>, ) -> Result<()>
pub async fn delete_limbo_chain_op(&mut self, hash: DhtOpHash) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_limbo_warrant( &mut self, w: InsertLimboWarrant<'_>, ) -> Result<()>
pub async fn delete_limbo_warrant(&mut self, hash: DhtOpHash) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_link_index( &mut self, action_hash: &ActionHash, base_hash: &AnyLinkableHash, zome_index: u8, link_type: u8, tag: Option<&[u8]>, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_updated_record_index( &mut self, action_hash: &ActionHash, original_action_hash: &ActionHash, original_entry_hash: &EntryHash, ) -> Result<()>
Source§impl TxWrite<Dht>
impl TxWrite<Dht>
pub async fn insert_warrant(&mut self, w: InsertWarrant<'_>) -> Result<()>
Source§impl TxWrite<PeerMetaStore>
impl TxWrite<PeerMetaStore>
Sourcepub async fn put(
&mut self,
peer_url: &str,
meta_key: &str,
meta_value: &[u8],
expires_at_secs: Option<i64>,
) -> Result<()>
pub async fn put( &mut self, peer_url: &str, meta_key: &str, meta_value: &[u8], expires_at_secs: Option<i64>, ) -> Result<()>
Insert or replace a peer metadata entry.
expires_at is seconds since the Unix epoch.
Source§impl TxWrite<Wasm>
impl TxWrite<Wasm>
Sourcepub async fn put_wasm(&mut self, wasm: DnaWasmHashed) -> Result<()>
pub async fn put_wasm(&mut self, wasm: DnaWasmHashed) -> Result<()>
Store WASM bytecode.
Sourcepub async fn put_dna_def(
&mut self,
agent: &AgentPubKey,
dna_def: &DnaDef,
) -> Result<()>
pub async fn put_dna_def( &mut self, agent: &AgentPubKey, dna_def: &DnaDef, ) -> Result<()>
Store a DNA definition and its associated zomes.
Within a TxWrite, this runs as a SAVEPOINT nested inside the
outer transaction — it is atomic with the rest of the transaction.
Trait Implementations§
Source§impl<I: DatabaseIdentifier> AsMut<TxRead<I>> for TxWrite<I>
impl<I: DatabaseIdentifier> AsMut<TxRead<I>> for TxWrite<I>
Auto Trait Implementations§
impl<I> Freeze for TxWrite<I>where
I: Freeze,
impl<I> !RefUnwindSafe for TxWrite<I>
impl<I> Send for TxWrite<I>where
I: Send,
impl<I> Sync for TxWrite<I>where
I: Sync,
impl<I> Unpin for TxWrite<I>where
I: Unpin,
impl<I> UnsafeUnpin for TxWrite<I>where
I: UnsafeUnpin,
impl<I> !UnwindSafe for TxWrite<I>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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