diff --git a/crates/engine/src/relational_db.rs b/crates/engine/src/relational_db.rs index 7edb9fe20fc..ba03f59b177 100644 --- a/crates/engine/src/relational_db.rs +++ b/crates/engine/src/relational_db.rs @@ -469,6 +469,19 @@ impl RelationalDB { Ok(self.with_read_only(Workload::Internal, |tx| self.inner.program(tx))?) } + /// Obtain the module associated with this database and the transaction + /// offset visible to the read. + /// + /// Waiting for the returned offset to become durable proves that the + /// `st_module` row observed by this read is durable. + pub fn program_with_tx_offset(&self) -> Result<(Option, TxOffset), DBError> { + self.with_read_only(Workload::Internal, |tx| { + let program = self.inner.program(tx)?; + let tx_offset = tx.tx_offset().into_inner().saturating_sub(1); + Ok((program, tx_offset)) + }) + } + /// Read the set of clients currently connected to the database. pub fn connected_clients(&self) -> Result { self.with_read_only(Workload::Internal, |tx| {