Add separate database directory for light client (#8927) (#9064)

* Add seperate default DB path for light client (#8927)

* Improve readability
This commit is contained in:
Matthew Martin 2018-07-11 07:17:35 -07:00 committed by 5chdn
parent 137e8deab6
commit 3f53e0e8b1
No known key found for this signature in database
GPG Key ID: 1A40871B597F5F80
2 changed files with 13 additions and 3 deletions

View File

@ -939,7 +939,13 @@ impl Configuration {
let is_using_base_path = self.args.arg_base_path.is_some(); let is_using_base_path = self.args.arg_base_path.is_some();
// If base_path is set and db_path is not we default to base path subdir instead of LOCAL. // If base_path is set and db_path is not we default to base path subdir instead of LOCAL.
let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() { let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() {
if self.args.flag_light {
"$BASE/chains_light"
} else {
"$BASE/chains" "$BASE/chains"
}
} else if self.args.flag_light {
self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH_LIGHT, |s| &s)
} else { } else {
self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH, |s| &s) self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH, |s| &s)
}; };

View File

@ -34,10 +34,14 @@ use platform::*;
pub use dirs::home_dir; pub use dirs::home_dir;
/// Platform-specific chains path - Windows only /// Platform-specific chains path for standard client - Windows only
#[cfg(target_os = "windows")] pub const CHAINS_PATH: &str = "$LOCAL/chains"; #[cfg(target_os = "windows")] pub const CHAINS_PATH: &str = "$LOCAL/chains";
/// Platform-specific chains path /// Platform-specific chains path for light client - Windows only
#[cfg(target_os = "windows")] pub const CHAINS_PATH_LIGHT: &str = "$LOCAL/chains_light";
/// Platform-specific chains path for standard client
#[cfg(not(target_os = "windows"))] pub const CHAINS_PATH: &str = "$BASE/chains"; #[cfg(not(target_os = "windows"))] pub const CHAINS_PATH: &str = "$BASE/chains";
/// Platform-specific chains path for light client
#[cfg(not(target_os = "windows"))] pub const CHAINS_PATH_LIGHT: &str = "$BASE/chains_light";
/// Platform-specific cache path - Windows only /// Platform-specific cache path - Windows only
#[cfg(target_os = "windows")] pub const CACHE_PATH: &str = "$LOCAL/cache"; #[cfg(target_os = "windows")] pub const CACHE_PATH: &str = "$LOCAL/cache";