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)