1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Effect transaction system for coordinating complex operations.
use crate::effects::Effect;
use std::thread::ThreadId;
use std::time::{SystemTime, Duration};
/// Transaction for coordinating effects.
#[derive(Debug, Clone)]
pub struct EffectTransaction {
/// Unique transaction ID
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
pub id: u64,
/// Thread that initiated the transaction
pub initiator_thread: ThreadId,
/// Participating threads
pub participating_threads: Vec<ThreadId>,
/// Effects involved in this transaction
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
pub effects: Vec<Effect>,
/// Transaction state
pub state: TransactionState,
/// Creation timestamp
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
pub created_at: SystemTime,
/// Timeout for this transaction
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
pub timeout: Duration,
}
/// State of an effect transaction.
#[derive(Debug, Clone, PartialEq)]
pub enum TransactionState {
/// Transaction is being prepared
Preparing,
/// Transaction is active
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
Active,
/// Transaction is committing
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
Committing,
/// Transaction committed successfully
Committed,
/// Transaction is aborting
#[allow(dead_code)] // Part of Stage 3 effect coordination infrastructure
Aborting,
/// Transaction was aborted
Aborted,
}