mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
service: storage monitor added (#13082)
* service: storage monitor added Storage monitor added. It uses `notify` create to get notifications about any changes to monitored path (which is database path). Notifications are consumed in essential task which terminates when available storage space drops below given threshold. Closes: #12399 * Cargo.lock updated * misspell * fs events throttling added * minor updates * filter out non mutating events * misspell * ".git/.scripts/commands/fmt/fmt.sh" * Update client/service/src/storage_monitor.rs Co-authored-by: Anton <anton.kalyaev@gmail.com> * storage-monitor crate added * cleanup: configuration + service builder * storage_monitor in custom service (wip) * copy-paste bad desc fixed * notify removed * storage_monitor added to node * fix for clippy * publish = false * Update bin/node/cli/src/command.rs Co-authored-by: Dmitry Markin <dmitry@markin.tech> * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * crate name: storage-monitor -> sc-storage-monitor * error handling improved * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * publish=false removed Co-authored-by: command-bot <> Co-authored-by: Anton <anton.kalyaev@gmail.com> Co-authored-by: Dmitry Markin <dmitry@markin.tech> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
025f9d9ba3
commit
14a4eed2aa
@@ -36,6 +36,10 @@ pub struct Cli {
|
||||
/// telemetry, if telemetry is enabled.
|
||||
#[arg(long)]
|
||||
pub no_hardware_benchmarks: bool,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[clap(flatten)]
|
||||
pub storage_monitor: sc_storage_monitor::StorageMonitorParams,
|
||||
}
|
||||
|
||||
/// Possible subcommands of the main binary.
|
||||
|
||||
@@ -87,8 +87,7 @@ pub fn run() -> Result<()> {
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run)?;
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
service::new_full(config, cli.no_hardware_benchmarks)
|
||||
.map_err(sc_cli::Error::Service)
|
||||
service::new_full(config, cli).map_err(sc_cli::Error::Service)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::Inspect(cmd)) => {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
//! Service implementation. Specialized wrapper over substrate service.
|
||||
|
||||
use crate::Cli;
|
||||
use codec::Encode;
|
||||
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
|
||||
use frame_system_rpc_runtime_api::AccountNonceApi;
|
||||
@@ -556,12 +557,18 @@ pub fn new_full_base(
|
||||
}
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(
|
||||
config: Configuration,
|
||||
disable_hardware_benchmarks: bool,
|
||||
) -> Result<TaskManager, ServiceError> {
|
||||
new_full_base(config, disable_hardware_benchmarks, |_, _| ())
|
||||
.map(|NewFullBase { task_manager, .. }| task_manager)
|
||||
pub fn new_full(config: Configuration, cli: Cli) -> Result<TaskManager, ServiceError> {
|
||||
let database_source = config.database.clone();
|
||||
let task_manager = new_full_base(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(),
|
||||
)?;
|
||||
|
||||
Ok(task_manager)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user