Fix purge-chain and print DB info on startup (#5840)

* purge-chain accepts --db option

* print DB info on startup

* Small refactoring

* Added back &self

* Add DatabaseParams for PurgeChain, ImportParams and ExportBlocks

* Don't force default value

* Remove unused fields

* Update client/cli/src/commands/export_blocks_cmd.rs

* Fix stuff

Co-authored-by: Cecile Tonglet <cecile@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Arkadiy Paronyan
2020-04-30 14:53:04 +02:00
committed by GitHub
parent db2e916904
commit c3a6d8a881
10 changed files with 142 additions and 93 deletions
@@ -14,10 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use sc_service::config::DatabaseConfig;
use std::path::PathBuf;
use structopt::StructOpt;
use crate::arg_enums::Database;
/// Shared parameters used by all `CoreParams`.
#[derive(Debug, StructOpt, Clone)]
@@ -72,27 +70,6 @@ impl SharedParams {
}
}
/// Get the database configuration object for the parameters provided
pub fn database_config(
&self,
base_path: &PathBuf,
cache_size: usize,
database: Database,
) -> DatabaseConfig {
match database {
Database::RocksDb => DatabaseConfig::RocksDb {
path: base_path.join("db"),
cache_size,
},
Database::SubDb => DatabaseConfig::SubDb {
path: base_path.join("subdb"),
},
Database::ParityDb => DatabaseConfig::ParityDb {
path: base_path.join("paritydb"),
},
}
}
/// Get the filters for the logging
pub fn log_filters(&self) -> Option<String> {
self.log.clone()