Skip to main content

Module bootstrap

Module bootstrap 

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

AttemptId πŸ”’
Identifier for an attempt to bootstrap a directory.

EnumsΒ§

AdvanceStateError πŸ”’
Errors returned by advance_state.
DownloadOutcome πŸ”’
Return value of perform_download.

FunctionsΒ§

advance πŸ”’
Replace state with state.advance().
advance_state πŸ”’
Advances the progress of the directory download.
apply_state πŸ”’
Applies changes from state to 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 state from the cache in dirmgr, advancing the state to the extent possible.
load_and_apply_documents πŸ”’
Load every document in missing and try to apply it to state.
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 in missing.
load_once πŸ”’
Try to update state by loading cached information from dirmgr.
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 in docs.
no_more_than_a_week_from πŸ”’
Helper: Clamp v so that it is no more than one week from now.
note_cache_error πŸ”’
Record that a problem has occurred because of a failure in an answer from source.
note_cache_success πŸ”’
Record that source has 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 state with state.reset().
update_state πŸ”’
Try to update state by loading cached information, on success returns the current wall-clock time.