Skip to main content

reifydb_transaction/multi/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use reifydb_core::common::CommitVersion;
5use reifydb_store_commit::MultiVersionScope;
6use reifydb_value::{Result, value::duration::Duration};
7
8use crate::multi::transaction::{MultiTransaction, read::MultiReadTransaction, write::MultiWriteTransaction};
9
10#[derive(Debug, Copy, Clone, PartialEq, Eq)]
11pub enum RangeScope {
12	All,
13	After(CommitVersion),
14}
15
16impl RangeScope {
17	#[inline]
18	pub fn into_multi(self, read: CommitVersion) -> MultiVersionScope {
19		match self {
20			Self::All => MultiVersionScope::AsOf {
21				read,
22			},
23			Self::After(after) => MultiVersionScope::Between {
24				after,
25				read,
26			},
27		}
28	}
29}
30
31pub mod conflict;
32pub mod lease;
33pub mod marker;
34#[allow(clippy::module_inception)]
35pub mod multi;
36pub(crate) mod oracle;
37pub mod pending;
38pub mod transaction;
39pub mod types;
40pub mod watermark;
41
42impl MultiTransaction {
43	pub fn current_version(&self) -> Result<CommitVersion> {
44		self.tm.version()
45	}
46
47	pub fn done_until(&self) -> CommitVersion {
48		self.tm.done_until()
49	}
50
51	pub fn wait_for_mark_timeout(&self, version: CommitVersion, timeout: Duration) -> bool {
52		self.tm.wait_for_mark_timeout(version, timeout)
53	}
54
55	pub fn notify_on_mark(&self, version: CommitVersion, callback: Box<dyn FnOnce() + Send>) {
56		self.tm.notify_on_mark(version, callback);
57	}
58}