pub enum SessionState<T> {
Initializing {
participants: Vec<DeviceId>,
timeout_at: PhysicalTime,
created_at: PhysicalTime,
},
Active {
protocol_state: T,
started_at: PhysicalTime,
participants: Vec<DeviceId>,
timeout_at: PhysicalTime,
},
Terminating {
result: SessionResult,
cleanup_deadline: PhysicalTime,
},
Completed(SessionResult),
}Expand description
Unified session state machine following choreographic patterns
Time System: Uses PhysicalTime for timestamps per the unified time architecture.
Variants§
Initializing
Session initialization phase
Fields
timeout_at: PhysicalTimeTimeout timestamp (unified time system)
created_at: PhysicalTimeCreation timestamp (unified time system)
Active
Active session with protocol-specific state
Fields
protocol_state: Tstarted_at: PhysicalTimeStart timestamp (unified time system)
timeout_at: PhysicalTimeTimeout timestamp (unified time system)
Terminating
Session termination phase with results
Fields
result: SessionResultcleanup_deadline: PhysicalTimeCleanup deadline timestamp (unified time system)
Completed(SessionResult)
Session completed and cleaned up
Implementations§
Source§impl<T> SessionState<T>
impl<T> SessionState<T>
Sourcepub fn is_timed_out(&self, now: &PhysicalTime) -> bool
pub fn is_timed_out(&self, now: &PhysicalTime) -> bool
Check if session has timed out
Time System: Accepts PhysicalTime for comparison.
Sourcepub fn is_timed_out_ms(&self, now_ms: u64) -> bool
pub fn is_timed_out_ms(&self, now_ms: u64) -> bool
Check if session has timed out (from milliseconds)
Convenience method for backward compatibility.
Sourcepub fn participants(&self) -> &[DeviceId]
pub fn participants(&self) -> &[DeviceId]
Get session participants
Sourcepub fn duration_ms(&self, current_time: &PhysicalTime) -> Option<u64>
pub fn duration_ms(&self, current_time: &PhysicalTime) -> Option<u64>
Get session duration in milliseconds (if active or completed)
Time System: Accepts PhysicalTime for comparison.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if session is in a terminal state
Trait Implementations§
Source§impl<T: Clone> Clone for SessionState<T>
impl<T: Clone> Clone for SessionState<T>
Source§fn clone(&self) -> SessionState<T>
fn clone(&self) -> SessionState<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more