v0.1.0-pre.049
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/app_state.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Shared Tauri application state and startup initialization.
|
||||
|
||||
@@ -10,6 +10,8 @@ pub(crate) struct AppState {
|
||||
active_profile: kb_config::ProfileConfig,
|
||||
logging_guard: std::sync::Mutex<kb_logging::LoggingGuard>,
|
||||
http_pool: kb_onchain_transport::HttpEndpointPool,
|
||||
ws_pool: kb_onchain_transport::WsEndpointPool,
|
||||
demo_ws_session: tokio::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>>,
|
||||
demo_backfill_running: std::sync::atomic::AtomicBool,
|
||||
demo_backfill_cancel_requested: std::sync::atomic::AtomicBool,
|
||||
}
|
||||
@@ -31,8 +33,11 @@ impl crate::AppState {
|
||||
std::result::Result::Ok(guard) => guard,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&active_profile)
|
||||
{
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&active_profile) {
|
||||
std::result::Result::Ok(pool) => pool,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let ws_pool = match kb_onchain_transport::WsEndpointPool::from_profile(&active_profile) {
|
||||
std::result::Result::Ok(pool) => pool,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
@@ -42,6 +47,8 @@ impl crate::AppState {
|
||||
active_profile,
|
||||
logging_guard: std::sync::Mutex::new(logging_guard),
|
||||
http_pool,
|
||||
ws_pool,
|
||||
demo_ws_session: tokio::sync::Mutex::new(std::option::Option::None),
|
||||
demo_backfill_running: std::sync::atomic::AtomicBool::new(false),
|
||||
demo_backfill_cancel_requested: std::sync::atomic::AtomicBool::new(false),
|
||||
});
|
||||
@@ -67,6 +74,20 @@ impl crate::AppState {
|
||||
return &self.http_pool;
|
||||
}
|
||||
|
||||
/// Returns the configured WebSocket endpoint pool.
|
||||
pub(crate) fn ws_pool(&self) -> &kb_onchain_transport::WsEndpointPool {
|
||||
return &self.ws_pool;
|
||||
}
|
||||
|
||||
/// Returns the persistent WebSocket demo session slot.
|
||||
pub(crate) fn demo_ws_session(
|
||||
&self,
|
||||
) -> &tokio::sync::Mutex<
|
||||
std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>,
|
||||
> {
|
||||
return &self.demo_ws_session;
|
||||
}
|
||||
|
||||
/// Returns the single-campaign execution flag used by the backfill window.
|
||||
pub(crate) fn demo_backfill_running(&self) -> &std::sync::atomic::AtomicBool {
|
||||
return &self.demo_backfill_running;
|
||||
|
||||
Reference in New Issue
Block a user