MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / commit_procedure_tx

Method commit_procedure_tx

crates/core/src/host/instance_env.rs:782–804  ·  view source on GitHub ↗

Commit an anonymous procedure tx and broadcast resulting updates.

(&mut self, tx: MutTxId)

Source from the content-addressed store, hash-verified

780
781 /// Commit an anonymous procedure tx and broadcast resulting updates.
782 pub fn commit_procedure_tx(&mut self, tx: MutTxId) -> Result<(), NodesError> {
783 let stdb = self.relational_db().clone();
784 let subs = self.replica_ctx.subscriptions.clone();
785
786 let event = ModuleEvent {
787 timestamp: Timestamp::now(),
788 caller_identity: stdb.database_identity(),
789 caller_connection_id: None,
790 function_call: ModuleFunctionCall::default(),
791 status: EventStatus::Committed(DatabaseUpdate::default()),
792 reducer_return_value: None,
793 request_id: None,
794 timer: None,
795 // The procedure will pick up the tab for the energy.
796 execution_budget_used: FunctionBudget::ZERO,
797 host_execution_duration: Duration::from_millis(0),
798 };
799 // Commit the tx and broadcast it.
800 let event = commit_and_broadcast_event(&subs, None, event, tx);
801 self.procedure_last_tx_offset = Some(event.tx_offset);
802
803 Ok(())
804 }
805
806 pub fn abort_mutable_tx(&mut self) -> Result<(), NodesError> {
807 self.finish_anon_tx()?;

Callers 3

commit_mutable_txMethod · 0.80
procedure_commit_mut_txFunction · 0.80

Calls 6

CommittedClass · 0.50
OkFunction · 0.50
cloneMethod · 0.45
relational_dbMethod · 0.45
database_identityMethod · 0.45

Tested by

no test coverage detected