Expand description
Implementation for the primary directory state machine.
There are three (active) states that a download can be in: looking
for a consensus (GetConsensusState
), looking for certificates
to validate that consensus (GetCertsState
), and looking for
microdescriptors (GetMicrodescsState
).
These states have no contact with the network, and are purely
reactive to other code that drives them. See the
bootstrap
module for functions that actually
load or download directory information.
Structs§
- GetCerts
State 🔒 - Second state: fetching or loading authority certificates.
- GetConsensus
State 🔒 - Initial state: fetching or loading a consensus directory.
- GetMicrodescs
State 🔒 - Final state: we’re fetching or loading microdescriptors
- Poisoned
State 🔒 - A dummy state implementation, used when we need to temporarily write a placeholder into a box.
Enums§
- GetCerts
Consensus 🔒 - One of two possible internal states for the consensus in a GetCertsState.
- NetDir
Change 🔒 - A change to the currently running
NetDir
, returned by the state machines in this module. - Pending
NetDir 🔒 - Information about a network directory that might not be ready to become the current network directory.
Traits§
- DirState 🔒
- A “state” object used to represent our progress in downloading a directory.
- Previous
NetDir 🔒 - An object that can provide a previous netdir for the bootstrapping state machines to use.
Functions§
- client_
download_ 🔒range - Based on the lifetime for a consensus, return the time range during which clients should fetch the next one.
- opt_
err_ 🔒to_ result - If
err
is some, returnErr(err)
. Otherwise return Ok(()). - pick_
download_ 🔒time - Choose a random download time to replace a consensus whose lifetime
is
lifetime
.