pub struct PartialNetDir {
pub(crate) netdir: NetDir,
pub(crate) prev_netdir: Option<Arc<NetDir>>,
}
Expand description
A partially build NetDir – it can’t be unwrapped until it has enough information to build safe paths.
Fields§
§netdir: NetDir
The netdir that’s under construction.
prev_netdir: Option<Arc<NetDir>>
hs-common
only.The previous netdir, if we had one
Used as a cache, so we can reuse information
Implementations§
Source§impl PartialNetDir
impl PartialNetDir
Sourcepub fn new(
consensus: MdConsensus,
replacement_params: Option<&NetParams<i32>>,
) -> Self
pub fn new( consensus: MdConsensus, replacement_params: Option<&NetParams<i32>>, ) -> Self
Create a new PartialNetDir with a given consensus, and no microdescriptors loaded.
If replacement_params
is provided, override network parameters from
the consensus with those from replacement_params
.
Sourcepub fn new_with_geoip(
consensus: MdConsensus,
replacement_params: Option<&NetParams<i32>>,
geoip_db: &GeoipDb,
) -> Self
Available on crate feature geoip
only.
pub fn new_with_geoip( consensus: MdConsensus, replacement_params: Option<&NetParams<i32>>, geoip_db: &GeoipDb, ) -> Self
geoip
only.Create a new PartialNetDir with GeoIP support.
This does the same thing as new()
, except the provided GeoIP database is used to add
country codes to relays.
Sourcepub(crate) fn new_inner(
consensus: MdConsensus,
replacement_params: Option<&NetParams<i32>>,
geoip_db: Option<&GeoipDb>,
) -> Self
pub(crate) fn new_inner( consensus: MdConsensus, replacement_params: Option<&NetParams<i32>>, geoip_db: Option<&GeoipDb>, ) -> Self
Implementation of the new()
functions.
Sourcepub fn fill_from_previous_netdir(&mut self, prev: Arc<NetDir>)
pub fn fill_from_previous_netdir(&mut self, prev: Arc<NetDir>)
Record a previous netdir, which can be used for reusing cached information
Sourcepub(crate) fn compute_rings(&mut self)
Available on crate feature hs-common
only.
pub(crate) fn compute_rings(&mut self)
hs-common
only.Compute the hash ring(s) for this NetDir
Sourcepub fn have_enough_paths(&self) -> bool
pub fn have_enough_paths(&self) -> bool
Return true if this are enough information in this directory to build multihop paths.
Sourcepub fn unwrap_if_sufficient(self) -> Result<NetDir, PartialNetDir>
pub fn unwrap_if_sufficient(self) -> Result<NetDir, PartialNetDir>
If this directory has enough information to build multihop circuits, return it.
Trait Implementations§
Source§impl Clone for PartialNetDir
impl Clone for PartialNetDir
Source§fn clone(&self) -> PartialNetDir
fn clone(&self) -> PartialNetDir
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PartialNetDir
impl Debug for PartialNetDir
Source§impl MdReceiver for PartialNetDir
impl MdReceiver for PartialNetDir
Source§fn missing_microdescs(&self) -> Box<dyn Iterator<Item = &MdDigest> + '_>
fn missing_microdescs(&self) -> Box<dyn Iterator<Item = &MdDigest> + '_>
Source§fn add_microdesc(&mut self, md: Microdesc) -> bool
fn add_microdesc(&mut self, md: Microdesc) -> bool
Auto Trait Implementations§
impl Freeze for PartialNetDir
impl RefUnwindSafe for PartialNetDir
impl Send for PartialNetDir
impl Sync for PartialNetDir
impl Unpin for PartialNetDir
impl UnwindSafe for PartialNetDir
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more