0.3.15-pre.012
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-raw-transaction-ingest-desk/src/app_state.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Shared backend state owned by the Raw Transaction Ingest Desk Tauri application.
|
||||
|
||||
@@ -117,23 +117,26 @@ impl crate::AppState {
|
||||
|
||||
/// Starts one independent route Worker after repeating complete Start-time revalidation, sharing Store only on an exact network match.
|
||||
pub(crate) async fn start_route(&self, request: &crate::RawIngestRouteStartRequestDto) -> ksp_core_lib::Result<crate::RouteRuntimeLaunch> {
|
||||
let generation = {
|
||||
let generation = self.inventory_generation.lock();
|
||||
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 admission = self.route_runtime.ensure_start_admission_open();
|
||||
if let std::result::Result::Err(error) = admission {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
let generation = self.inventory_generation.lock();
|
||||
let 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 prepared = crate::prepare_route_start(&self.config_management, generation, request);
|
||||
let prepared = crate::prepare_route_start(&self.config_management, *generation, request);
|
||||
let prepared = match prepared {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
std::mem::drop(generation);
|
||||
return crate::start_route_runtime(std::sync::Arc::clone(&self.route_runtime), prepared).await;
|
||||
}
|
||||
|
||||
@@ -147,6 +150,16 @@ impl crate::AppState {
|
||||
return self.route_runtime.stop_and_wait(request).await;
|
||||
}
|
||||
|
||||
/// Closes route Start admission once and requests cooperative Stop for all routes during application shutdown.
|
||||
pub(crate) fn begin_shutdown(&self) -> ksp_core_lib::Result<bool> {
|
||||
return self.route_runtime.begin_shutdown();
|
||||
}
|
||||
|
||||
/// Waits for bounded cleanup of all route Workers and the shared Store during application shutdown.
|
||||
pub(crate) async fn shutdown_routes(&self) -> ksp_core_lib::Result<()> {
|
||||
return self.route_runtime.shutdown_and_wait().await;
|
||||
}
|
||||
|
||||
/// 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();
|
||||
|
||||
Reference in New Issue
Block a user