mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
New database trait (#5549)
* Introduce trait * The trait * Generic * Basic impls. * Remove unneeded bounds * Minor changes * Switch over to the new DB trait * Integrated parity-db and added CLI for db selection * Default impl. * Fix logs. * Started integrating subdb * Apply suggestions from code review Co-Authored-By: Cecile Tonglet <cecile@parity.io> * Apply suggestions from code review Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Enable subdb * Bump parity-db * Fixed CLI macro * Fixed browser build * Fixed features * Sort out features * Use parity-db from crates.io * Typo Co-authored-by: arkpar <arkady.paronyan@gmail.com> Co-authored-by: Cecile Tonglet <cecile@parity.io> Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -74,7 +74,7 @@ impl ExportBlocksCmd {
|
||||
<<<BB as BlockT>::Header as HeaderT>::Number as std::str::FromStr>::Err: std::fmt::Debug,
|
||||
<BB as BlockT>::Hash: std::str::FromStr,
|
||||
{
|
||||
if let DatabaseConfig::Path { ref path, .. } = &config.database {
|
||||
if let DatabaseConfig::RocksDb { ref path, .. } = &config.database {
|
||||
info!("DB path: {}", path.display());
|
||||
}
|
||||
|
||||
|
||||
@@ -204,9 +204,16 @@ macro_rules! substrate_cli_subcommands {
|
||||
&self,
|
||||
base_path: &::std::path::PathBuf,
|
||||
cache_size: usize,
|
||||
database: $crate::Database,
|
||||
) -> $crate::Result<::sc_service::config::DatabaseConfig> {
|
||||
match self {
|
||||
$($enum::$variant(cmd) => cmd.database_config(base_path, cache_size)),*
|
||||
$($enum::$variant(cmd) => cmd.database_config(base_path, cache_size, database)),*
|
||||
}
|
||||
}
|
||||
|
||||
fn database(&self) -> $crate::Result<::std::option::Option<$crate::Database>> {
|
||||
match self {
|
||||
$($enum::$variant(cmd) => cmd.database()),*
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ impl PurgeChainCmd {
|
||||
/// Run the purge command
|
||||
pub fn run(&self, config: Configuration) -> error::Result<()> {
|
||||
let db_path = match &config.database {
|
||||
DatabaseConfig::Path { path, .. } => path,
|
||||
DatabaseConfig::RocksDb { path, .. } => path,
|
||||
_ => {
|
||||
eprintln!("Cannot purge custom database implementation");
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user