pub struct StagedRollout { /* private fields */ }Expand description
Staged rollout configuration and delay calculation.
Implementations§
Source§impl StagedRollout
impl StagedRollout
Sourcepub fn new(node_id: &[u8], max_delay_hours: u64) -> Self
pub fn new(node_id: &[u8], max_delay_hours: u64) -> Self
Create a new staged rollout calculator.
§Arguments
node_id- The node’s unique identifier (typically a public key)max_delay_hours- Maximum rollout window (default: 24 hours)
Sourcepub fn calculate_delay(&self) -> Duration
pub fn calculate_delay(&self) -> Duration
Calculate the delay before this node should apply an upgrade.
The delay is deterministically derived from the node ID, ensuring:
- Each node gets a consistent delay on every check
- Nodes are evenly distributed across the rollout window
- The delay is reproducible (same node ID = same delay)
Sourcepub fn max_delay_hours(&self) -> u64
pub fn max_delay_hours(&self) -> u64
Get the maximum rollout window in hours.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if staged rollout is enabled (max_delay_hours > 0).
Sourcepub fn calculate_delay_for_version(&self, version: &Version) -> Duration
pub fn calculate_delay_for_version(&self, version: &Version) -> Duration
Calculate the delay for a specific version upgrade.
This includes the version in the hash to ensure different versions get different delays for the same node (useful for critical updates that should be spread differently).
Trait Implementations§
Source§impl Clone for StagedRollout
impl Clone for StagedRollout
Source§fn clone(&self) -> StagedRollout
fn clone(&self) -> StagedRollout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StagedRollout
impl RefUnwindSafe for StagedRollout
impl Send for StagedRollout
impl Sync for StagedRollout
impl Unpin for StagedRollout
impl UnsafeUnpin for StagedRollout
impl UnwindSafe for StagedRollout
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more