Compare commits
No commits in common. "939bdc6676f0ac8196699d3ba4ed93fe8176bac0" and "7be46d437309c2e6b925b7499257f384c697f921" have entirely different histories.
939bdc6676
...
7be46d4373
|
|
@ -6,19 +6,7 @@ use std::{borrow::BorrowMut, net::{IpAddr, Ipv4Addr}};
|
|||
// use std::io::BufReader;
|
||||
use tokio::io::{BufReader, AsyncWriteExt, AsyncBufReadExt};
|
||||
|
||||
/// # Fn `init_cli_pipeline`
|
||||
/// ## for catching all input requests from CLI
|
||||
///
|
||||
/// *input* : -
|
||||
///
|
||||
/// *output* : `anyhow::Result<()>` to wrap errors
|
||||
///
|
||||
/// *initiator* : fn `main`
|
||||
///
|
||||
/// *managing* : `TcpListener` object to handle requests
|
||||
///
|
||||
/// *depends on* : -
|
||||
///
|
||||
|
||||
pub async fn init_cli_pipeline() -> DynResult<()> {
|
||||
return match init_listener().await {
|
||||
Some(list) => {
|
||||
|
|
@ -39,19 +27,6 @@ pub async fn init_cli_pipeline() -> DynResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// # Fn `init_listener`
|
||||
/// ## for creating TCP-listener for communicating with CLI
|
||||
///
|
||||
/// *input* : -
|
||||
///
|
||||
/// *output* : `Some<TcpListener>` if port 7753 was opened | None if not
|
||||
///
|
||||
/// *initiator* : fn `init_cli_pipeline`
|
||||
///
|
||||
/// *managing* : `TcpListener` object to handle requests
|
||||
///
|
||||
/// *depends on* : `tokio::net::TcpListener`
|
||||
///
|
||||
async fn init_listener() -> Option<TcpListener> {
|
||||
return match TcpListener::bind("127.0.0.1:7753").await {
|
||||
Ok(listener) => {
|
||||
|
|
@ -65,19 +40,6 @@ async fn init_listener() -> Option<TcpListener> {
|
|||
}
|
||||
}
|
||||
|
||||
/// # Fn `process_connection`
|
||||
/// ## for processing input CLI requests
|
||||
///
|
||||
/// *input* : mut stream: `TcpStream`
|
||||
///
|
||||
/// *output* : -
|
||||
///
|
||||
/// *initiator* : fn `init_cli_pipeline`
|
||||
///
|
||||
/// *managing* : mutable object of `TcpStream`
|
||||
///
|
||||
/// *depends on* : `tokio::net::TcpStream`
|
||||
///
|
||||
async fn process_connection(mut stream: TcpStream) {
|
||||
// loop{
|
||||
// stream.
|
||||
|
|
|
|||
|
|
@ -4,18 +4,6 @@ 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,
|
||||
|
|
@ -25,8 +13,6 @@ 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 {
|
||||
|
|
@ -39,71 +25,6 @@ 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
|
||||
|
|
@ -181,8 +102,6 @@ pub struct PrebootParams {
|
|||
pub metrics: MetricsPrebootParams,
|
||||
}
|
||||
|
||||
/// # implementation for `MetricsPrebootParams`
|
||||
/// ## to enable validation mechanism
|
||||
impl PrebootParams {
|
||||
pub fn validate(mut self) -> Result<Self> {
|
||||
if !self.socket_path.exists() && !self.no_hostagent {
|
||||
|
|
|
|||
Loading…
Reference in New Issue