diff --git a/Cargo.lock b/Cargo.lock index c3e5e2ff41bc1..68ff028fa4ade 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16585,7 +16585,6 @@ dependencies = [ "clap 4.4.14", "fs4", "log", - "sc-client-db", "sp-core", "thiserror", "tokio", diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index 9290ec584e470..2e472b26aa807 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -258,7 +258,7 @@ where sc_storage_monitor::StorageMonitorService::try_spawn( cli.storage_monitor, - database_source, + database_source.path(), &task_manager.spawn_essential_handle(), )?; diff --git a/substrate/bin/node/cli/src/service.rs b/substrate/bin/node/cli/src/service.rs index 5e6e794f73283..763c9091361d6 100644 --- a/substrate/bin/node/cli/src/service.rs +++ b/substrate/bin/node/cli/src/service.rs @@ -769,13 +769,12 @@ pub fn new_full_base( /// Builds a new service for a full client. pub fn new_full(config: Configuration, cli: Cli) -> Result { let mixnet_config = cli.mixnet_params.config(config.role.is_authority()); - let database_source = config.database.clone(); let task_manager = new_full_base(config, mixnet_config, cli.no_hardware_benchmarks, |_, _| ()) .map(|NewFullBase { task_manager, .. }| task_manager)?; sc_storage_monitor::StorageMonitorService::try_spawn( cli.storage_monitor, - database_source, + config.database.path(), &task_manager.spawn_essential_handle(), ) .map_err(|e| ServiceError::Application(e.into()))?; diff --git a/substrate/client/storage-monitor/Cargo.toml b/substrate/client/storage-monitor/Cargo.toml index 2b46ccbcdc154..c20cdd0067b20 100644 --- a/substrate/client/storage-monitor/Cargo.toml +++ b/substrate/client/storage-monitor/Cargo.toml @@ -15,7 +15,6 @@ workspace = true clap = { version = "4.4.14", features = ["derive", "string"] } log = "0.4.17" fs4 = "0.7.0" -sc-client-db = { path = "../db", default-features = false } sp-core = { path = "../../primitives/core" } tokio = "1.22.0" thiserror = "1.0.48" diff --git a/substrate/client/storage-monitor/src/lib.rs b/substrate/client/storage-monitor/src/lib.rs index b88b66d2d60d4..1021090262ad4 100644 --- a/substrate/client/storage-monitor/src/lib.rs +++ b/substrate/client/storage-monitor/src/lib.rs @@ -17,7 +17,6 @@ // along with this program. If not, see . use clap::Args; -use sc_client_db::DatabaseSource; use sp_core::traits::SpawnEssentialNamed; use std::{ io, @@ -70,10 +69,10 @@ impl StorageMonitorService { /// Creates new StorageMonitorService for given client config pub fn try_spawn( parameters: StorageMonitorParams, - database: DatabaseSource, + path: Option<&Path>, spawner: &impl SpawnEssentialNamed, ) -> Result<()> { - Ok(match (parameters.threshold, database.path()) { + Ok(match (parameters.threshold, path) { (0, _) => { log::info!( target: LOG_TARGET, @@ -89,10 +88,11 @@ impl StorageMonitorService { (threshold, Some(path)) => { log::debug!( target: LOG_TARGET, - "Initializing StorageMonitorService for db path: {path:?}", + "Initializing StorageMonitorService for db path: {}", + path.display() ); - Self::check_free_space(&path, threshold)?; + Self::check_free_space(path, threshold)?; let storage_monitor_service = StorageMonitorService { path: path.to_path_buf(),