pub struct WorkflowLog { /* private fields */ }Expand description
An in-memory log that accumulates WorkflowEvents for one or more
workflows and exposes query helpers.
Implementations§
Source§impl WorkflowLog
impl WorkflowLog
Sourcepub fn append(
&mut self,
event_type: WorkflowEventType,
workflow_id: impl Into<String>,
message: impl Into<String>,
)
pub fn append( &mut self, event_type: WorkflowEventType, workflow_id: impl Into<String>, message: impl Into<String>, )
Appends an event to the log, assigning it the next sequence number.
Sourcepub fn append_task(
&mut self,
event_type: WorkflowEventType,
workflow_id: impl Into<String>,
task_id: impl Into<String>,
message: impl Into<String>,
)
pub fn append_task( &mut self, event_type: WorkflowEventType, workflow_id: impl Into<String>, task_id: impl Into<String>, message: impl Into<String>, )
Appends a task-scoped event to the log.
Sourcepub fn all(&self) -> &[WorkflowEvent]
pub fn all(&self) -> &[WorkflowEvent]
Returns a slice of all events in insertion order.
Sourcepub fn recent_errors(&self, n: usize) -> Vec<&WorkflowEvent>
pub fn recent_errors(&self, n: usize) -> Vec<&WorkflowEvent>
Returns the n most recently appended error events (TaskFailed or
Error), newest first.
Sourcepub fn events_for_workflow<'a>(
&'a self,
workflow_id: &str,
) -> Vec<&'a WorkflowEvent>
pub fn events_for_workflow<'a>( &'a self, workflow_id: &str, ) -> Vec<&'a WorkflowEvent>
Returns all events for the given workflow ID.
Sourcepub fn events_of_type(
&self,
event_type: WorkflowEventType,
) -> Vec<&WorkflowEvent>
pub fn events_of_type( &self, event_type: WorkflowEventType, ) -> Vec<&WorkflowEvent>
Returns all events matching the given event type.
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Returns the number of error-type events in the log.
Trait Implementations§
Source§impl Clone for WorkflowLog
impl Clone for WorkflowLog
Source§fn clone(&self) -> WorkflowLog
fn clone(&self) -> WorkflowLog
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 WorkflowLog
impl Debug for WorkflowLog
Source§impl Default for WorkflowLog
impl Default for WorkflowLog
Source§fn default() -> WorkflowLog
fn default() -> WorkflowLog
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WorkflowLog
impl RefUnwindSafe for WorkflowLog
impl Send for WorkflowLog
impl Sync for WorkflowLog
impl Unpin for WorkflowLog
impl UnsafeUnpin for WorkflowLog
impl UnwindSafe for WorkflowLog
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