Struct tor_netdoc::doc::netstatus::Lifetime
source · pub struct Lifetime { /* private fields */ }
Expand description
The lifetime of a networkstatus document.
In a consensus, this type describes when the consensus may safely be used. In a vote, this type describes the proposed lifetime for a consensus.
Implementations§
source§impl Lifetime
impl Lifetime
sourcepub fn new(
valid_after: SystemTime,
fresh_until: SystemTime,
valid_until: SystemTime
) -> Result<Self>
pub fn new( valid_after: SystemTime, fresh_until: SystemTime, valid_until: SystemTime ) -> Result<Self>
Construct a new Lifetime.
sourcepub fn valid_after(&self) -> SystemTime
pub fn valid_after(&self) -> SystemTime
Return time when this consensus first becomes valid.
(You might see a consensus a little while before this time, since voting tries to finish up before the.)
sourcepub fn fresh_until(&self) -> SystemTime
pub fn fresh_until(&self) -> SystemTime
Return time when this consensus is no longer fresh.
You can use the consensus after this time, but there is (or is supposed to be) a better one by this point.
sourcepub fn valid_until(&self) -> SystemTime
pub fn valid_until(&self) -> SystemTime
Return the time when this consensus is no longer valid.
You should try to get a better consensus after this time, though it’s okay to keep using this one if no more recent one can be found.
sourcepub fn valid_at(&self, when: SystemTime) -> bool
pub fn valid_at(&self, when: SystemTime) -> bool
Return true if this consensus is officially valid at the provided time.
sourcepub fn voting_period(&self) -> Duration
pub fn voting_period(&self) -> Duration
Return the voting period implied by this lifetime.
(The “voting period” is the amount of time in between when a consensus first becomes valid, and when the next consensus is expected to become valid)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lifetime
impl RefUnwindSafe for Lifetime
impl Send for Lifetime
impl Sync for Lifetime
impl Unpin for Lifetime
impl UnwindSafe for Lifetime
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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