mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
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:
@@ -38,7 +38,7 @@ use sc_transaction_pool_api::OffchainTransactionPoolFactory;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_core::crypto::Pair;
|
||||
use sp_runtime::{generic, traits::Block as BlockT, SaturatedConversion};
|
||||
use std::sync::Arc;
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
/// Host functions required for kitchensink runtime and Substrate node.
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
@@ -769,16 +769,18 @@ pub fn new_full_base(
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(config: Configuration, cli: Cli) -> Result<TaskManager, ServiceError> {
|
||||
let mixnet_config = cli.mixnet_params.config(config.role.is_authority());
|
||||
let database_source = config.database.clone();
|
||||
let database_path = config.database.path().map(Path::to_path_buf);
|
||||
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,
|
||||
&task_manager.spawn_essential_handle(),
|
||||
)
|
||||
.map_err(|e| ServiceError::Application(e.into()))?;
|
||||
if let Some(database_path) = database_path {
|
||||
sc_storage_monitor::StorageMonitorService::try_spawn(
|
||||
cli.storage_monitor,
|
||||
database_path,
|
||||
&task_manager.spawn_essential_handle(),
|
||||
)
|
||||
.map_err(|e| ServiceError::Application(e.into()))?;
|
||||
}
|
||||
|
||||
Ok(task_manager)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user