From b220e07feb8591b97cc88bc565d6a765254e84a9 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 25 Jul 2016 17:45:55 +0200 Subject: [PATCH] Fix broken internal names. (#1711) --- parity/dir.rs | 2 +- util/src/journaldb/mod.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/parity/dir.rs b/parity/dir.rs index 7cee88cee..e1400e8e8 100644 --- a/parity/dir.rs +++ b/parity/dir.rs @@ -56,7 +56,7 @@ impl Directories { pub fn client_path(&self, genesis_hash: H256, fork_name: Option<&String>, pruning: Algorithm) -> PathBuf { let mut dir = Path::new(&self.db).to_path_buf(); dir.push(format!("{:?}{}", H64::from(genesis_hash), fork_name.map(|f| format!("-{}", f)).unwrap_or_default())); - dir.push(format!("v{}-sec-{}", LEGACY_CLIENT_DB_VER_STR, pruning)); + dir.push(format!("v{}-sec-{}", LEGACY_CLIENT_DB_VER_STR, pruning.as_internal_name_str())); dir } } diff --git a/util/src/journaldb/mod.rs b/util/src/journaldb/mod.rs index 20b22c8d0..567f6100d 100644 --- a/util/src/journaldb/mod.rs +++ b/util/src/journaldb/mod.rs @@ -85,6 +85,16 @@ impl Algorithm { } } + /// Returns static str describing journal database algorithm. + pub fn as_internal_name_str(&self) -> &'static str { + match *self { + Algorithm::Archive => "archive", + Algorithm::EarlyMerge => "earlymerge", + Algorithm::OverlayRecent => "overlayrecent", + Algorithm::RefCounted => "refcounted", + } + } + /// Returns true if pruning strategy is stable pub fn is_stable(&self) -> bool { match *self {