aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/remake/mod.rs')
-rw-r--r--src/remake/mod.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/remake/mod.rs b/src/remake/mod.rs
index b16b8a3..67fa77b 100644
--- a/src/remake/mod.rs
+++ b/src/remake/mod.rs
@@ -94,12 +94,19 @@ pub(crate) struct Current {
pub(crate) switch_delay_ms: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) switch_in_ms: Option<u64>,
+ /// Proposed: how long votes are collected (`Proposal::settle_ms`), and how much of
+ /// that is left by this node's clock (ms; 0 once past).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) settle_ms: Option<u64>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) settle_in_ms: Option<u64>,
}
/// The remakes of `epoch` in `doc`, with their phase at `now` (expiry by `grace`, this
/// node's `dormant_after`, for records without their own: `Record::phase`), and for one
/// committed, this node's wait to switch (`remake`: when it saw the commit; as
-/// `switch::check` waits: the proposal's delay, or a quarter of `grace`).
+/// `switch::check` waits: the proposal's delay, or a quarter of `grace`); for one
+/// proposed, how long it settles and how much of that is left.
#[cfg_attr(not(feature = "dashboard"), allow(dead_code))]
pub(crate) fn current(
remake: &RemakeState,
@@ -120,7 +127,16 @@ pub(crate) fn current(
let seen = remake.seen_for(&id)?;
Some(delay.saturating_sub(seen.as_millis() as u64))
});
+ let settling = phase == records::Phase::Proposed;
Current {
+ settle_ms: settling.then_some(record.proposal.settle_ms),
+ settle_in_ms: settling.then(|| {
+ record
+ .proposal
+ .settle_until
+ .as_u64()
+ .saturating_sub(now.as_u64())
+ }),
phase,
coordinator: record.proposal.coordinator.clone(),
voters: record.votes.keys().cloned().collect(),