pub struct ConversationState {
pub current_phase: ConversationPhase,
pub context: Vec<ConversationContextEntry>,
pub deadline: Option<Instant>,
pub participants: Vec<ParticipantStatus>,
pub mode: ChannelMode,
}Expand description
Queryable state snapshot owned by a conversation actor.
Fields§
§current_phase: ConversationPhaseCurrent lifecycle phase.
context: Vec<ConversationContextEntry>Accumulated exchanged messages and lifecycle references.
deadline: Option<Instant>Optional in-memory deadline.
participants: Vec<ParticipantStatus>Last known participant liveness.
mode: ChannelModeDurability mode marker retained for diagnostics and future resume work.
Implementations§
Source§impl ConversationState
impl ConversationState
Sourcepub fn from_config(config: &ConversationConfig, now: Instant) -> Self
pub fn from_config(config: &ConversationConfig, now: Instant) -> Self
Creates initial state for a conversation config.
Sourcepub fn activate(&mut self) -> Result<(), LiminalError>
pub fn activate(&mut self) -> Result<(), LiminalError>
Transitions Created to Active. Active is accepted as idempotent.
§Errors
Returns LiminalError::ConversationFailed when the state cannot become active.
Sourcepub fn begin_completing(&mut self) -> Result<(), LiminalError>
pub fn begin_completing(&mut self) -> Result<(), LiminalError>
Transitions Active to Completing.
§Errors
Returns LiminalError::ConversationFailed when the state is not active.
Sourcepub fn close(&mut self) -> Result<(), LiminalError>
pub fn close(&mut self) -> Result<(), LiminalError>
Transitions Completing to Closed.
§Errors
Returns LiminalError::ConversationFailed when completion has not begun.
Sourcepub fn record_sent(&mut self, envelope: Envelope)
pub fn record_sent(&mut self, envelope: Envelope)
Records an envelope sent into the conversation.
Sourcepub fn record_received(&mut self, envelope: Envelope)
pub fn record_received(&mut self, envelope: Envelope)
Records an envelope received from the conversation.
Sourcepub fn record_participant_crash(
&mut self,
participant: ParticipantPid,
policy: CrashPolicy,
exited_at: Instant,
)
pub fn record_participant_crash( &mut self, participant: ParticipantPid, policy: CrashPolicy, exited_at: Instant, )
Records participant crash handling and marks that participant dead,
stamping exited_at as the instant the EXIT signal was observed.
Trait Implementations§
Source§impl Clone for ConversationState
impl Clone for ConversationState
Source§fn clone(&self) -> ConversationState
fn clone(&self) -> ConversationState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConversationState
impl Debug for ConversationState
impl Eq for ConversationState
Source§impl PartialEq for ConversationState
impl PartialEq for ConversationState
Source§fn eq(&self, other: &ConversationState) -> bool
fn eq(&self, other: &ConversationState) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConversationState
Auto Trait Implementations§
impl Freeze for ConversationState
impl RefUnwindSafe for ConversationState
impl Send for ConversationState
impl Sync for ConversationState
impl Unpin for ConversationState
impl UnsafeUnpin for ConversationState
impl UnwindSafe for ConversationState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.