v0.1.0-pre.052
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/app_state.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Shared Tauri application state and startup initialization.
|
||||
|
||||
@@ -10,10 +10,17 @@ 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: std::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsEndpointPool>>>,
|
||||
demo_ws_session: tokio::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>>,
|
||||
ws_pool:
|
||||
std::sync::Mutex<std::option::Option<std::sync::Arc<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,
|
||||
demo_core_extraction_running: std::sync::atomic::AtomicBool,
|
||||
demo_core_extraction_cancel_requested: std::sync::atomic::AtomicBool,
|
||||
demo_decode_replay_running: std::sync::atomic::AtomicBool,
|
||||
demo_decode_replay_cancel_requested: std::sync::atomic::AtomicBool,
|
||||
demo_decode_replay_campaign_id: std::sync::Mutex<std::option::Option<std::string::String>>,
|
||||
}
|
||||
|
||||
impl crate::AppState {
|
||||
@@ -33,7 +40,8 @@ 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),
|
||||
};
|
||||
@@ -47,6 +55,11 @@ impl crate::AppState {
|
||||
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),
|
||||
demo_core_extraction_running: std::sync::atomic::AtomicBool::new(false),
|
||||
demo_core_extraction_cancel_requested: std::sync::atomic::AtomicBool::new(false),
|
||||
demo_decode_replay_running: std::sync::atomic::AtomicBool::new(false),
|
||||
demo_decode_replay_cancel_requested: std::sync::atomic::AtomicBool::new(false),
|
||||
demo_decode_replay_campaign_id: std::sync::Mutex::new(std::option::Option::None),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,9 +110,8 @@ impl crate::AppState {
|
||||
/// 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>>,
|
||||
> {
|
||||
) -> &tokio::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>>
|
||||
{
|
||||
return &self.demo_ws_session;
|
||||
}
|
||||
|
||||
@@ -113,6 +125,33 @@ impl crate::AppState {
|
||||
return &self.demo_backfill_cancel_requested;
|
||||
}
|
||||
|
||||
/// Returns the core extraction running flag.
|
||||
pub(crate) fn demo_core_extraction_running(&self) -> &std::sync::atomic::AtomicBool {
|
||||
return &self.demo_core_extraction_running;
|
||||
}
|
||||
|
||||
/// Returns the core extraction cancellation flag.
|
||||
pub(crate) fn demo_core_extraction_cancel_requested(&self) -> &std::sync::atomic::AtomicBool {
|
||||
return &self.demo_core_extraction_cancel_requested;
|
||||
}
|
||||
|
||||
/// Returns the decode replay running flag.
|
||||
pub(crate) fn demo_decode_replay_running(&self) -> &std::sync::atomic::AtomicBool {
|
||||
return &self.demo_decode_replay_running;
|
||||
}
|
||||
|
||||
/// Returns the decode replay cancellation flag.
|
||||
pub(crate) fn demo_decode_replay_cancel_requested(&self) -> &std::sync::atomic::AtomicBool {
|
||||
return &self.demo_decode_replay_cancel_requested;
|
||||
}
|
||||
|
||||
/// Returns the active decode replay campaign slot.
|
||||
pub(crate) fn demo_decode_replay_campaign_id(
|
||||
&self,
|
||||
) -> &std::sync::Mutex<std::option::Option<std::string::String>> {
|
||||
return &self.demo_decode_replay_campaign_id;
|
||||
}
|
||||
|
||||
/// Returns the number of logging routes held by the logging guard.
|
||||
pub(crate) fn logging_route_count(&self) -> usize {
|
||||
let lock_result = self.logging_guard.lock();
|
||||
|
||||
Reference in New Issue
Block a user