diff --git a/server/stat/src/app/user_app.rs b/server/stat/src/app/user_app.rs index 67e5ae3..728840b 100644 --- a/server/stat/src/app/user_app.rs +++ b/server/stat/src/app/user_app.rs @@ -3,9 +3,11 @@ use std::sync::Mutex; use crate::listener::WsListener; use crate::upstream::UpStreamMgr; use crate::common::types::DownStreamPack; +use crate::master::MasterMgr; use std::sync::OnceLock; pub struct UserApp { + pub _masterMgr: MasterMgr, down_stream_msg_queue: Arc::>>, } @@ -16,6 +18,7 @@ impl f9::app::UserApp for UserApp { } fn init(&self) { + MasterMgr::instance().init(); WsListener::instance().init(); UpStreamMgr::instance().borrow_mut().init(); } @@ -49,6 +52,7 @@ impl f9::app::UserApp for UserApp { fn uninit(&self) { WsListener::instance().uninit(); + MasterMgr::instance().uninit(); } fn get_http_listen_port(&self) -> i32 { @@ -66,6 +70,7 @@ impl UserApp { } pub fn new() -> Self { let p = UserApp{ + _masterMgr: MasterMgr::new(), down_stream_msg_queue: r9::QueueLock::::new(), }; return p; diff --git a/server/stat/src/main.rs b/server/stat/src/main.rs index 0820346..d32044a 100755 --- a/server/stat/src/main.rs +++ b/server/stat/src/main.rs @@ -7,6 +7,7 @@ mod downstream; mod ss; mod constant; mod common; +mod master; use crate::app::UserApp; diff --git a/server/stat/src/master.rs b/server/stat/src/master.rs new file mode 100644 index 0000000..8948080 --- /dev/null +++ b/server/stat/src/master.rs @@ -0,0 +1,4 @@ + +pub mod mastermgr; + +pub use mastermgr::*; \ No newline at end of file diff --git a/server/stat/src/master/master.rs b/server/stat/src/master/master.rs new file mode 100644 index 0000000..e69de29 diff --git a/server/stat/src/master/mastermgr.rs b/server/stat/src/master/mastermgr.rs new file mode 100644 index 0000000..9056d4d --- /dev/null +++ b/server/stat/src/master/mastermgr.rs @@ -0,0 +1,33 @@ +use std::collections::HashMap; +use crate::app::UserApp; + +pub struct MasterMgr { + curr_context_id: i64, + mastersvr_hash: HashMap, +} + + +impl MasterMgr { + + + pub fn instance() -> &'static Self { + return &UserApp::instance()._masterMgr; + } + + pub fn new() -> Self { + let p = Self{ + curr_context_id: 0, + mastersvr_hash: Default::default(), + }; + return p; + } + + pub fn init(&self) { + + } + + pub fn uninit(&self) { + + } + +} \ No newline at end of file