Expand description
Functions to download or load directory objects, using the
state machines in the states module.
Re-exportsΒ§
use std::num::NonZeroUsize;πuse std::ops::Deref;πuse std::result::Result as StdResult;πuse std::collections::HashMap;πuse std::sync::Arc;πuse std::sync::Weak;πuse std::time::Duration;πuse std::time::SystemTime;πuse crate::DirMgrConfig;πuse crate::DocSource;πuse crate::err::BootstrapAction;πuse crate::state::DirState;πuse crate::state::PoisonedState;πuse crate::DirMgr;πuse crate::DocId;πuse crate::DocQuery;πuse crate::DocumentText;πuse crate::Error;πuse crate::Readiness;πuse crate::Result;πuse crate::docid;πuse crate::docid::ClientRequest;πuse crate::upgrade_weak_ref;πuse futures::FutureExt;πuse futures::StreamExt;πuse oneshot_fused_workaround as oneshot;πuse tor_dirclient::DirResponse;πuse tor_error::info_report;πuse tor_error::warn_report;πuse tor_rtcompat::Runtime;πuse tor_rtcompat::scheduler::TaskSchedule;πuse tracing::debug;πuse tracing::info;πuse tracing::instrument;πuse tracing::instrument;πuse tracing::trace;πuse tracing::warn;πuse crate::storage::Store;πuse tor_circmgr::CircMgr;πuse tor_circmgr::DirInfo;πuse tor_netdir::NetDir;πuse tor_netdir::NetDirProvider as _;πuse tor_netdoc::doc::netstatus::ConsensusFlavor;π
MacrosΒ§
- propagate_
fatal_ πerrors - Given a Result<()>, exit the current function if it is anything other than Ok(), or a nonfatal error.
StructsΒ§
- Attempt
Id π - Identifier for an attempt to bootstrap a directory.
EnumsΒ§
- Advance
State πError - Errors returned by
advance_state. - Download
Outcome π - Return value of
perform_download.
FunctionsΒ§
- advance π
- Replace
statewithstate.advance(). - advance_
state π - Advances the progress of the directory download.
- apply_
state π - Applies changes from
stateto the managerβs netdir. - download π
- Download information into a DirState state machine until it is βcompleteβ, or until we hit a non-recoverable error.
- download_
attempt π - Helper: Make a set of download attempts for the current directory state, and on success feed their results into the state object.
- fetch_
multiple π - Launch a set of download requests for a set of missing objects in
missing, and return each request along with the response it received. - fetch_
single π - Launch a single client request and get an associated response.
- load π
- Try to load as much state as possible for a provided
statefrom the cache indirmgr, advancing the state to the extent possible. - load_
and_ πapply_ documents - Load every document in
missingand try to apply it tostate. - load_
documents_ πfrom_ store - Load a set of documents from a
Store, returning all documents found in the store. Note that this may be less than the number of documents inmissing. - load_
once π - Try to update
stateby loading cached information fromdirmgr. - make_
consensus_ πrequest - Construct an appropriate ClientRequest to download a consensus of the given flavor.
- make_
requests_ πfor_ documents - Construct a set of
ClientRequests in order to fetch the documents indocs. - no_
more_ πthan_ a_ week_ from - Helper: Clamp
vso that it is no more than one week fromnow. - note_
cache_ πerror - Record that a problem has occurred because of a failure in an answer from
source. - note_
cache_ πsuccess - Record that
sourcehas successfully given us some directory info. - note_
request_ πoutcome - If there were errors from a peer in
outcome, record those errors by marking the circuit (if any) as needing retirement, and noting the peer (if any) as having failed. - perform_
download π - Attempts to download the current directoryβs state.
- reset π
- Replace
statewithstate.reset(). - update_
state π - Try to update
stateby loading cached information, on success returns the current wall-clock time.