pub struct RenewalTracker {
current_expiry: OffsetDateTime,
last_attempt: Option<OffsetDateTime>,
last_success: Option<OffsetDateTime>,
consecutive_failures: u32,
}Expand description
Tracks renewal attempts against one certificate’s expiry, so that a caller can ask two questions without touching the network: is a renewal due right now, and how loudly should its recent history be surfaced.
Fields§
§current_expiry: OffsetDateTime§last_attempt: Option<OffsetDateTime>§last_success: Option<OffsetDateTime>§consecutive_failures: u32Implementations§
Source§impl RenewalTracker
impl RenewalTracker
Sourcepub fn new(current_expiry: OffsetDateTime) -> Self
pub fn new(current_expiry: OffsetDateTime) -> Self
A tracker for a certificate that expires at current_expiry and has
no renewal history yet — the state right after loading a certificate
from storage or completing first issuance.
Sourcepub fn current_expiry(&self) -> OffsetDateTime
pub fn current_expiry(&self) -> OffsetDateTime
The expiry this tracker is currently measuring against.
Sourcepub fn consecutive_failures(&self) -> u32
pub fn consecutive_failures(&self) -> u32
How many renewal attempts have failed since the last success (or since this tracker was created, if none has succeeded yet).
Sourcepub fn record_success(&mut self, at: OffsetDateTime, new_expiry: OffsetDateTime)
pub fn record_success(&mut self, at: OffsetDateTime, new_expiry: OffsetDateTime)
Records a successful renewal: resets the failure count and moves the tracked expiry to the new certificate’s.
Sourcepub fn record_failure(&mut self, at: OffsetDateTime)
pub fn record_failure(&mut self, at: OffsetDateTime)
Records a failed attempt. The expiry this tracker measures against is unchanged — the old certificate is still what is being served.
Sourcepub fn due(&self, now: OffsetDateTime, policy: &RenewalPolicy) -> bool
pub fn due(&self, now: OffsetDateTime, policy: &RenewalPolicy) -> bool
Whether a renewal attempt should be made now.
True once inside the policy’s renewal window and, if the last attempt
failed, only again once retry_interval has passed — so a caller can
poll this on a short, fixed tick without hammering the CA on every
tick once renewal is due.
Sourcepub fn alert_level(&self, now: OffsetDateTime) -> AlertLevel
pub fn alert_level(&self, now: OffsetDateTime) -> AlertLevel
How loudly the current state should be surfaced.
Trait Implementations§
Source§impl Clone for RenewalTracker
impl Clone for RenewalTracker
Source§fn clone(&self) -> RenewalTracker
fn clone(&self) -> RenewalTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more