Skip to main content

reifydb_transaction/multi/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use std::time::Duration;
5
6use reifydb_core::common::CommitVersion;
7use reifydb_type::Result;
8
9use crate::multi::transaction::{MultiTransaction, read::MultiReadTransaction, write::MultiWriteTransaction};
10
11pub mod conflict;
12pub mod marker;
13pub mod multi;
14pub(crate) mod oracle;
15pub mod pending;
16pub mod transaction;
17pub mod types;
18pub mod watermark;
19
20impl MultiTransaction {
21	/// Get the current version from the transaction manager
22	pub fn current_version(&self) -> Result<CommitVersion> {
23		self.tm.version()
24	}
25
26	/// Returns the highest version where ALL prior versions have completed.
27	/// This is useful for CDC polling to know the safe upper bound for fetching
28	/// CDC events - all events up to this version are guaranteed to be in storage.
29	pub fn done_until(&self) -> CommitVersion {
30		self.tm.done_until()
31	}
32
33	/// Wait for the watermark to reach the given version with a timeout.
34	/// Returns true if the watermark reached the target, false if timeout occurred.
35	pub fn wait_for_mark_timeout(&self, version: CommitVersion, timeout: Duration) -> bool {
36		self.tm.wait_for_mark_timeout(version, timeout)
37	}
38}