Fix broken internal names. (#1711)

This commit is contained in:
Gav Wood 2016-07-25 17:45:55 +02:00 committed by GitHub
parent 226fe8e0bb
commit b220e07feb
2 changed files with 11 additions and 1 deletions

View File

@ -56,7 +56,7 @@ impl Directories {
pub fn client_path(&self, genesis_hash: H256, fork_name: Option<&String>, pruning: Algorithm) -> PathBuf { 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(); 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!("{:?}{}", 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 dir
} }
} }

View File

@ -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 /// Returns true if pruning strategy is stable
pub fn is_stable(&self) -> bool { pub fn is_stable(&self) -> bool {
match *self { match *self {