Skip to main content

Module state

Module state 

Source
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Β§

GetCertsState πŸ”’
Second state: fetching or loading authority certificates.
GetConsensusState πŸ”’
Initial state: fetching or loading a consensus directory.
GetMicrodescsState πŸ”’
Final state: we’re fetching or loading microdescriptors
PoisonedState πŸ”’
A dummy state implementation, used when we need to temporarily write a placeholder into a box.

EnumsΒ§

GetCertsConsensus πŸ”’
One of two possible internal states for the consensus in a GetCertsState.
NetDirChange πŸ”’
A change to the currently running NetDir, returned by the state machines in this module.
PendingNetDir πŸ”’
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.
PreviousNetDir πŸ”’
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, return Err(err). Otherwise return Ok(()).
pick_download_time πŸ”’
Choose a random download time to replace a consensus whose lifetime is lifetime.