pub struct GoalTracker { /* private fields */ }Expand description
A client-side view of every goal in flight, with the FSM enforced.
Implementations§
Source§impl GoalTracker
impl GoalTracker
Sourcepub fn track(&mut self, goal: GoalId)
pub fn track(&mut self, goal: GoalId)
Records a goal this node just sent, in GoalStatus::Accepted.
Sourcepub fn status(&self, goal: &GoalId) -> Option<GoalStatus>
pub fn status(&self, goal: &GoalId) -> Option<GoalStatus>
The status last seen for goal.
Sourcepub fn observe(&mut self, outcome: &ActionOutcome) -> Result<GoalStatus>
pub fn observe(&mut self, outcome: &ActionOutcome) -> Result<GoalStatus>
Applies a status update, checking the FSM (§9.4).
§Errors
NodeError::Pattern for a goal that was never tracked, a transition
the FSM does not allow, or any update after a terminal status.
Sourcepub fn prune_terminal(&mut self) -> usize
pub fn prune_terminal(&mut self) -> usize
Forgets every goal that has ended.
Returns how many were removed. A long-running client that never prunes grows one entry per goal forever, which is the sort of leak that only shows up after a week of uptime.
Trait Implementations§
Source§impl Debug for GoalTracker
impl Debug for GoalTracker
Auto Trait Implementations§
impl Freeze for GoalTracker
impl RefUnwindSafe for GoalTracker
impl Send for GoalTracker
impl Sync for GoalTracker
impl Unpin for GoalTracker
impl UnsafeUnpin for GoalTracker
impl UnwindSafe for GoalTracker
Blanket Implementations§
impl<T> Allocation for T
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