Improve storage monitor API (#2899)

This removes the need to unnecessarily provide a very specific data
structure `DatabaseSource` and removes huge `sc-client-db` dependency
from storage monitor. It is now possible to use storage monitor with any
path.

P.S. I still strongly dislike that it pulls `clap` dependency for such a
small feature, but many other crates do as well, so nothing special
here.
This commit is contained in:
Nazar Mokrynskyi
2024-01-10 13:56:44 +02:00
committed by GitHub
parent a56ad80a38
commit af2e30e383
6 changed files with 54 additions and 49 deletions
+7 -5
View File
@@ -256,11 +256,13 @@ where
)
.map(|full| full.task_manager)?;
sc_storage_monitor::StorageMonitorService::try_spawn(
cli.storage_monitor,
database_source,
&task_manager.spawn_essential_handle(),
)?;
if let Some(path) = database_source.path() {
sc_storage_monitor::StorageMonitorService::try_spawn(
cli.storage_monitor,
path.to_path_buf(),
&task_manager.spawn_essential_handle(),
)?;
}
Ok(task_manager)
})