diff --git a/src/utils.rs b/src/utils.rs index 9c7e92a..6d6c334 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -22,9 +22,21 @@ use tokio::time::Duration; const GET_ID_CMD: &str = "hostname"; -/// # async func to run 3 main daemons (now it's more like tree-form than classical 0.1.0 form ) -/// > hint : give mpsc with capacity 1 to jump over potential errors during running process -/// > ** in [developing](https://github.com/prplV/runner-rs "REPOSITORY") ** +/// # Fn `run_daemons` +/// ## async func to run 3 main daemons: process, service and file monitors and manage process state according to given messages into channel +/// +/// *input* : `Arc`, `Arc>`, `&mut mpsc::Receiver`, +/// +/// *output* : () +/// +/// *initiator* : main thread +/// +/// *managing* : Arc to current process struct, Arc to managing channel writer, mut ref to managing channel reader +/// +/// *depends on* : all module `prcs`'s functions, fn `running_handler`, fn `utils::files::create_watcher` +/// +/// > *hint* : give mpsc with capacity 1 to jump over potential errors during running process +/// pub async fn run_daemons( proc: Arc, tx: Arc>, @@ -167,6 +179,19 @@ pub async fn run_daemons( tokio::task::yield_now().await; } // check process status daemon +/// # Fn `run_daemons` +/// ## func to async exec subjobs of checking process, services and files states +/// +/// *input* : `Arc`, `Arc>`, `Arc>>` +/// +/// *output* : () +/// +/// *initiator* : fn `run_daemons` +/// +/// *managing* : Arc to current process struct, Arc to Mutex to list of file watchers +/// +/// *depends on* : fn `utils::files::file_handler`, fn `utils::services::service_handler`, fn `utils::prcs::{is_active, is_frozen, start_process}` +/// pub async fn running_handler( prc: Arc, tx: Arc>, @@ -199,6 +224,19 @@ pub async fn running_handler( } // todo: cmd across cat /proc/self/mountinfo | grep "/docker/containers/" | head -1 | awk -F '/' '{print $5}' +/// # Fn `get_container_id` +/// ## for getting container id used in logs +/// +/// *input* : - +/// +/// *output* : Some(String) if cont-id was grubbed | None - if not +/// +/// *initiator* : fn `options::logger::setup_logger` +/// +/// *managing* : - +/// +/// *depends on* : - +/// pub fn get_container_id() -> Option { match Command::new(GET_ID_CMD).output() { Ok(output) => {