pub struct ConversationState {
pub received_messages: HashSet<String>,
pub in_progress: HashSet<String>,
pub completed_steps: HashMap<(String, u32), Vec<u8>>,
pub finished_messages: HashSet<String>,
pub errored_messages: HashMap<String, String>,
}Expand description
Replay-derived durable conversation processing state.
Fields§
§received_messages: HashSet<String>Messages that have MessageReceived events.
in_progress: HashSet<String>Messages with ProcessingStarted and no later terminal event.
completed_steps: HashMap<(String, u32), Vec<u8>>Completed step outputs indexed by (message_id, step_index).
finished_messages: HashSet<String>Messages that have ProcessingFinished events.
errored_messages: HashMap<String, String>Messages that have ErrorOccurred events, mapped to the recorded error.
Implementations§
Source§impl ConversationState
impl ConversationState
Sourcepub fn replay(events: &[ConversationEvent]) -> Self
pub fn replay(events: &[ConversationEvent]) -> Self
Replays events into a fresh conversation state.
Sourcepub fn apply(&mut self, event: &ConversationEvent)
pub fn apply(&mut self, event: &ConversationEvent)
Applies one event to this state using idempotent set/map updates.
Sourcepub fn is_fully_processed(&self, message_id: &str) -> bool
pub fn is_fully_processed(&self, message_id: &str) -> bool
Returns true when the replayed log contains ProcessingFinished for the message.
Sourcepub fn last_completed_step(&self, message_id: &str) -> Option<u32>
pub fn last_completed_step(&self, message_id: &str) -> Option<u32>
Returns the highest completed step for message_id, if any.
Trait Implementations§
Source§impl Clone for ConversationState
impl Clone for ConversationState
Source§fn clone(&self) -> ConversationState
fn clone(&self) -> ConversationState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConversationState
impl Debug for ConversationState
Source§impl Default for ConversationState
impl Default for ConversationState
Source§fn default() -> ConversationState
fn default() -> ConversationState
Returns the “default value” for a type. Read more
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
Tests for
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.