Remove unused DirMgr::netdir method, make opt_netdir private.

This commit is contained in:
Nick Mathewson 2022-07-25 11:06:35 -04:00 committed by Ian Jackson
parent c39aa5de73
commit de460b0668
2 changed files with 2 additions and 11 deletions

View File

@ -1,2 +1,3 @@
BREAKING: Changes to error variants.
BREAKING: Renamed DirSkewTolerance to DirTolerance.
BREAKING: Removed `netdir` method from DirMgr, and make `opt_netdir` private.

View File

@ -860,20 +860,10 @@ impl<R: Runtime> DirMgr<R> {
}
/// Return an Arc handle to our latest directory, if we have one.
pub fn opt_netdir(&self) -> Option<Arc<NetDir>> {
fn opt_netdir(&self) -> Option<Arc<NetDir>> {
self.netdir.get()
}
/// Return an Arc handle to our latest directory, returning an error if there is none.
///
/// # Errors
///
/// Errors with [`Error::DirectoryNotPresent`] if the `DirMgr` hasn't been bootstrapped yet.
// TODO: Add variants of this that make sure that it's up-to-date?
pub fn netdir(&self) -> Result<Arc<NetDir>> {
self.opt_netdir().ok_or(Error::DirectoryNotPresent)
}
/// Return a new asynchronous stream that will receive notification
/// whenever the consensus has changed.
///