diff --git a/tor-dirmgr/Cargo.toml b/tor-dirmgr/Cargo.toml index 73bc6bae3..2af61b4ba 100644 --- a/tor-dirmgr/Cargo.toml +++ b/tor-dirmgr/Cargo.toml @@ -6,6 +6,10 @@ edition = "2018" license = "MIT OR Apache-2.0" publish = false +[features] +default = [] +legacy-store = [] + [dependencies] tor-chanmgr = { path="../tor-chanmgr", version= "*" } tor-checkable = { path="../tor-checkable", version= "*" } diff --git a/tor-dirmgr/src/config.rs b/tor-dirmgr/src/config.rs index 3e2250fc0..ad229f7ac 100644 --- a/tor-dirmgr/src/config.rs +++ b/tor-dirmgr/src/config.rs @@ -3,10 +3,10 @@ //! Directory configuration tells us where to load and store directory //! information ,where to fetch it from, and how to validate it. +#[cfg(feature = "legacy-storage")] use crate::storage::legacy::LegacyStore; use crate::storage::sqlite::SqliteStore; use crate::Authority; -use crate::PartialNetDir; use crate::{Error, Result}; use tor_netdir::fallback::{FallbackDir, FallbackSet}; @@ -266,8 +266,9 @@ impl Default for NetDirConfigBuilder { } impl NetDirConfig { + #[cfg(feature = "legacy-storage")] /// Read directory information from the configured storage location. - pub fn load_legacy(&self) -> Result { + pub fn load_legacy(&self) -> Result { let store = LegacyStore::new(self.legacy_cache_path.as_ref().unwrap().clone()); store.load_legacy(&self.authorities[..]) } diff --git a/tor-dirmgr/src/storage.rs b/tor-dirmgr/src/storage.rs index bb678f88b..071b6089b 100644 --- a/tor-dirmgr/src/storage.rs +++ b/tor-dirmgr/src/storage.rs @@ -3,6 +3,7 @@ //! We have code implemented for two methods: the legacy format used by //! the C Tor implementation, and a more flexible format based on sqlite. +#[cfg(feature = "legacy-storage")] pub(crate) mod legacy; pub(crate) mod sqlite;