pub struct StallWatch { /* private fields */ }Expand description
Per-task progress clock and one-shot freeze reporting.
Implementations§
Source§impl StallWatch
impl StallWatch
pub fn new() -> Self
Sourcepub fn note_assigned(&mut self, task_id: impl Into<String>, now: Instant)
pub fn note_assigned(&mut self, task_id: impl Into<String>, now: Instant)
Start the clock when a task is assigned. A later assign of the same task keeps the original instant.
Sourcepub fn note_applied(&mut self, task_id: &str, now: Instant)
pub fn note_applied(&mut self, task_id: &str, now: Instant)
An Applied persist refreshes the clock of an assigned task and clears
the freeze report bit so a later freeze can be reported again. Clock
creation belongs to Self::note_assigned.
Sourcepub fn note_beat_seq(
&mut self,
task_id: &str,
generation: u64,
seq: u64,
) -> bool
pub fn note_beat_seq( &mut self, task_id: &str, generation: u64, seq: u64, ) -> bool
Record one heartbeat’s version, answering whether it is the newest one this task’s reporter has been seen at.
The version orders the reporter’s own frames: the same rule the stored row’s watermark used to apply, kept here because a beat that observed nothing no longer moves the row. A reporter that came back with a new generation reads as newer, which is what a rebase is for.
Sourcepub fn due(&self, now: Instant, threshold_secs: u64) -> Vec<String>
pub fn due(&self, now: Instant, threshold_secs: u64) -> Vec<String>
Task ids whose freeze exceeds threshold_secs and have not been
reported in this freeze episode. A threshold of zero reports nothing.
Sourcepub fn mark_reported(&mut self, task_id: &str)
pub fn mark_reported(&mut self, task_id: &str)
Remember that this freeze episode has been reported.