Make legacy-store code disabled by default.

In the long run we might not want it at all.
This commit is contained in:
Nick Mathewson 2020-11-24 10:43:16 -05:00
parent 2fd2c27ee5
commit ea27328c67
3 changed files with 8 additions and 2 deletions

View File

@ -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= "*" }

View File

@ -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<PartialNetDir> {
pub fn load_legacy(&self) -> Result<tor_netdir::PartialNetDir> {
let store = LegacyStore::new(self.legacy_cache_path.as_ref().unwrap().clone());
store.load_legacy(&self.authorities[..])
}

View File

@ -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;