diff --git a/noxis-rs/src/options/config.rs b/noxis-rs/src/options/config.rs index 35ed603..dd53611 100644 --- a/noxis-rs/src/options/config.rs +++ b/noxis-rs/src/options/config.rs @@ -10,15 +10,21 @@ use std::{env, fs}; use super::preboot::PrebootParams; use tokio::time::{Duration, sleep}; // use redis::PubSub; -use tokio::sync::oneshot::Receiver; +use tokio::sync::oneshot::Receiver as OneShotReciever; +use tokio::sync::broadcast::Sender as BroadcastSender; // const CONFIG_PATH: &str = "settings.json"; pub mod v2 { - use std::ops::Deref; - use super::*; - pub async fn init_config_mechanism(cli_oneshot: Arc> /*...*/) { + + pub async fn init_config_mechanism( + // to handle cli config changes + _cli_oneshot: OneShotReciever, + // to share local config with PRCS and CLI_PIPELINE modules + _brd_tx : Arc> + /*...*/ + ) { /* local + pubsub + cli oneshot check */ } pub async fn get_redis_connection(params: Arc) -> Option { @@ -54,12 +60,30 @@ pub mod v2 { None } - pub async fn get_local_config_watcher(params: Arc /*...*/) { + + // + pub async fn local_config_reciever( + params : Arc, + pubsub_oneshot : OneShotReciever, + brd_tx : Arc>, + /*...*/ + ) { /*...*/ + + // {:1} if local config is not exist -> cannot create watcher -> None + // {:2} if local config exists -> load_processes + // | + // | [Ok(Processes)] + // -> 1) broadcast sending parsed config to PRCS and CLI_PIPELINE + // 2) watcher in loop to deny local changes + // | + // | Err(_) + // -> + // ???? } // [:IN-TEST] - pub async fn cli_config_reciever(cli_oneshot: Receiver) -> Option { + pub async fn cli_config_reciever(cli_oneshot: OneShotReciever) -> Option { /* match awaits til channel*/ match cli_oneshot.await { Ok(config_from_cli) => return Some(config_from_cli),