From 939bdc6676f0ac8196699d3ba4ed93fe8176bac0 Mon Sep 17 00:00:00 2001 From: prplV Date: Mon, 23 Dec 2024 14:07:22 +0300 Subject: [PATCH] added preboot doc-comms --- noxis-rs/src/options/preboot.rs | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/noxis-rs/src/options/preboot.rs b/noxis-rs/src/options/preboot.rs index 90c8102..47f2d79 100644 --- a/noxis-rs/src/options/preboot.rs +++ b/noxis-rs/src/options/preboot.rs @@ -4,6 +4,18 @@ use anyhow::{Result, Ok, Error}; use clap::Parser; use std::path::PathBuf; +/// # Enum `MetricsPrebootParams` +/// ## for setting up metrics mode as preboot param from command prompt +/// +/// examples: +/// ``` +/// noxis-rs ... --metrics full +/// noxis-rs ... --metrics system +/// noxis-rs ... --metrics processes +/// noxis-rs ... --metrics net +/// noxis-rs ... --metrics none +/// ``` +/// #[derive(clap::ValueEnum, Debug, Clone)] pub enum MetricsPrebootParams { Full, @@ -13,6 +25,8 @@ pub enum MetricsPrebootParams { None, } +/// # `std::fmt::Display` implementation for `MetricsPrebootParams` +/// ## to enable parsing object to String impl std::fmt::Display for MetricsPrebootParams { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { @@ -25,6 +39,71 @@ impl std::fmt::Display for MetricsPrebootParams { } } +/// # struct `PrebootParams` +/// ## to parse and set up all modes as preboot params from command prompt +/// +/// ### args : +/// +/// `--no-hagent` - to disable hagent work module and set up work mode as autonomous +/// ### usage : +/// ``` +/// noxis-rs ... --no-hagent ... +/// ``` +/// +/// +/// `--no-logs` - to disable logging at all +/// ### usage : +/// ``` +/// noxis-rs ... --no-logs ... +/// ``` +/// +/// `--refresh-logs` - to truncate logs directory +/// ### usage : +/// ``` +/// noxis-rs ... --refresh-logs ... +/// ``` +/// +/// `--no-remote-config` - to disable work with Redis as config producer +/// ### usage : +/// ``` +/// noxis-rs ... --no-remote-config ... +/// ``` +/// +/// `--no-sub` - to disable Redis subscribtion mechanism +/// ### usage : +/// ``` +/// noxis-rs ... --no-sub ... +/// ``` +/// +/// `--socket-path` - to set Unix Domain Socket file's directory +/// ### usage : +/// ``` +/// noxis-rs ... --no-sub ... +/// ``` +/// +/// `--log-to` - to set directory for logs +/// ### usage : +/// ``` +/// noxis-rs ... --log-to /dir/to/logs/ ... +/// ``` +/// +/// `--remote-server-url` - to set Redis Server +/// ### usage : +/// ``` +/// noxis-rs ... --remote-server-url 192.168.28.12 ... +/// ``` +/// +/// `--config` - to set Noxis' config full path +/// ### usage : +/// ``` +/// noxis-rs ... --config /etc/enode/settings.json ... +/// ``` +/// +/// `--metrics` - to set metrics mode +/// ### usage : +/// ``` +/// noxis-rs ... --metrics full ... +/// ``` #[derive(Debug, Parser)] pub struct PrebootParams { // actions @@ -102,6 +181,8 @@ pub struct PrebootParams { pub metrics: MetricsPrebootParams, } +/// # implementation for `MetricsPrebootParams` +/// ## to enable validation mechanism impl PrebootParams { pub fn validate(mut self) -> Result { if !self.socket_path.exists() && !self.no_hostagent {