reifydb_core/interceptor/
transaction.rs1use std::marker::PhantomData;
5
6use crate::{
7 CommitVersion, define_api_function, define_closure_interceptor, define_interceptor, interface::TransactionId,
8};
9
10define_interceptor!(
12 context: PreCommitContext<T>,
13 trait: PreCommitInterceptor,
14 fields: {txn: &'a mut T}
15);
16
17define_closure_interceptor!(ClosurePreCommitInterceptor, PreCommitInterceptor, PreCommitContext, with_transaction);
18
19define_api_function!(
20 pre_commit,
21 ClosurePreCommitInterceptor<T, F>,
22 PreCommitContext<T>
23);
24
25define_interceptor!(
27 context: PostCommitContext,
28 trait: PostCommitInterceptor<T>,
29 fields: {
30 id: TransactionId,
31 version: CommitVersion,
32 changes: TransactionalDefChanges,
33 row_changes: Vec<RowChange>}
34);
35
36define_closure_interceptor!(
37 ClosurePostCommitInterceptor,
38 PostCommitInterceptor,
39 PostCommitContext,
40 no_transaction_param
41);
42
43define_api_function!(post_commit, ClosurePostCommitInterceptor<F>, PostCommitContext);
44
45use crate::{
46 impl_register_interceptor,
47 interface::{RowChange, TransactionalDefChanges},
48};
49
50impl_register_interceptor!(
51 ClosurePreCommitInterceptor<T, F>,
52 PreCommitContext<T>,
53 PreCommitInterceptor,
54 pre_commit
55);
56
57impl_register_interceptor!(ClosurePostCommitInterceptor<F>, PostCommitContext, PostCommitInterceptor<T>, post_commit);