init_config_mechanism 50%

feature/configv2
prplV 2025-02-05 17:50:37 +03:00
parent 3d88967281
commit a8a7fd8a72
1 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,7 @@ use super::preboot::PrebootParams;
use tokio::time::{Duration, sleep}; use tokio::time::{Duration, sleep};
// use redis::PubSub; // use redis::PubSub;
use tokio::sync::{ use tokio::sync::{
oneshot,
oneshot::{ Receiver as OneShotReciever, Sender as OneShotSender }, oneshot::{ Receiver as OneShotReciever, Sender as OneShotSender },
broadcast::Sender as BroadcastSender, broadcast::Receiver as BroadcastReceiver }; broadcast::Sender as BroadcastSender, broadcast::Receiver as BroadcastReceiver };
use crate::utils::files::create_watcher; use crate::utils::files::create_watcher;
@ -36,7 +37,20 @@ pub mod v2 {
) { ) {
// channel for pubsub to handle local config pulling // channel for pubsub to handle local config pulling
let _local_config_brd_reciever = brd_tx.subscribe(); let _local_config_brd_reciever = brd_tx.subscribe();
/* local + pubsub + cli oneshot check */ // channel between pub-sub mech and local config mech
let (tx_pb_lc, rx_pb_lc) = oneshot::channel::<bool>();
// channel between cli mech and local config mech
let (tx_cli_lc, rx_cli_lc) = oneshot::channel::<bool>();
// future to init work with local config
let lc_future = local_config_reciever(
params,
rx_pb_lc,
rx_cli_lc,
Arc::new(brd_tx)
);
// TODO! futures + select!
// TODO! tests config
} }
pub async fn get_redis_connection(params: Arc<PrebootParams>) -> Option<Connection> { pub async fn get_redis_connection(params: Arc<PrebootParams>) -> Option<Connection> {
if params.no_sub { if params.no_sub {