Trait tor_netdir::NetDirProvider
source · pub trait NetDirProvider: UpcastArcNetDirProvider + Send + Sync {
fn netdir(&self, timeliness: Timeliness) -> Result<Arc<NetDir>>;
fn events(&self) -> BoxStream<'static, DirEvent>;
fn params(&self) -> Arc<dyn AsRef<NetParameters>>;
fn timely_netdir(&self) -> Result<Arc<NetDir>> { ... }
}Expand description
An object that can provide NetDirs, as well as inform consumers when
they might have changed.
Required Methods§
sourcefn netdir(&self, timeliness: Timeliness) -> Result<Arc<NetDir>>
fn netdir(&self, timeliness: Timeliness) -> Result<Arc<NetDir>>
Return a network directory that’s live according to the provided
timeliness.
sourcefn events(&self) -> BoxStream<'static, DirEvent>
fn events(&self) -> BoxStream<'static, DirEvent>
Return a new asynchronous stream that will receive notification whenever the consensus has changed.
Multiple events may be batched up into a single item: each time this stream yields an event, all you can assume is that the event has occurred at least once.
sourcefn params(&self) -> Arc<dyn AsRef<NetParameters>>
fn params(&self) -> Arc<dyn AsRef<NetParameters>>
Return the latest network parameters.
If we have no directory, return a reasonable set of defaults.
Provided Methods§
sourcefn timely_netdir(&self) -> Result<Arc<NetDir>>
fn timely_netdir(&self) -> Result<Arc<NetDir>>
Return a reasonable netdir for general usage.
This is an alias for
NetDirProvider::netdir(Timeliness::Timely).
Implementations on Foreign Types§
source§impl<T> NetDirProvider for Arc<T>where
T: NetDirProvider,
impl<T> NetDirProvider for Arc<T>where
T: NetDirProvider,
Implementors§
impl NetDirProvider for TestNetDirProvider
Available on crate feature
testing only.