v0.3.15-pre.006

This commit is contained in:
2026-09-13 11:30:56 +02:00
parent 9ee3cd4a53
commit 0a8ce6e5f9
23 changed files with 1298 additions and 112 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-raw-transaction-ingest-desk/src/app_state.rs
// version: 1
// version: 2
//! Shared backend state owned by the Raw Transaction Ingest Desk Tauri application.
@@ -7,6 +7,7 @@
pub(crate) struct AppState {
active_composite_profile: std::option::Option<String>,
config_management: ksp_config_lib::ConfigManagement,
inventory_generation: std::sync::Mutex<u32>,
logging_runtime: std::sync::Mutex<LoggingRuntimeState>,
splash_settings: crate::SplashSettings,
splash_sequence_started: std::sync::atomic::AtomicBool,
@@ -47,6 +48,7 @@ impl crate::AppState {
return std::result::Result::Ok(Self {
active_composite_profile,
config_management,
inventory_generation: std::sync::Mutex::new(0),
logging_runtime: std::sync::Mutex::new(LoggingRuntimeState {
guard: logging_startup.guard,
active_profile_id: logging_startup.active_profile_id,
@@ -65,6 +67,37 @@ impl crate::AppState {
return crate::RawIngestRouteFoundationDto::scaffold();
}
/// Rebuilds the complete Config-only route inventory and publishes a fresh monotonic generation.
pub(crate) fn route_inventory(&self) -> ksp_core_lib::Result<crate::RawIngestRouteInventoryDto> {
let generation = self.inventory_generation.lock();
let mut generation = match generation {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_APP_STATE_LOCK_FAILED,
"Raw Transaction Ingest Desk route inventory generation lock is poisoned",
));
},
};
let next_generation = generation.checked_add(1);
let next_generation = match next_generation {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_ROUTE_INVENTORY_INVALID,
"Raw Transaction Ingest Desk route inventory generation is exhausted",
));
},
};
let inventory = crate::build_route_inventory(&self.config_management, next_generation);
let inventory = match inventory {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
*generation = next_generation;
return std::result::Result::Ok(inventory);
}
/// Builds the safe scaffold status exposed by the shell.
pub(crate) fn shell_status(&self) -> ksp_core_lib::Result<crate::ShellStatusDto> {
let document_count = self.config_management.engine().registry().descriptors().count();
@@ -98,7 +131,7 @@ impl crate::AppState {
application_version: env!("CARGO_PKG_VERSION").to_owned(),
config_document_count: document_count,
fallback_logging_active: runtime.fallback_active,
shell_phase: "pre.005-scaffold".to_owned(),
shell_phase: "pre.006-route-inventory".to_owned(),
startup_diagnostic: runtime.startup_diagnostic.clone(),
});
}