v0.3.7-pre.007
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/app_state.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Shared backend state owned by the Backfill Desk Tauri application.
|
||||
|
||||
@@ -121,7 +121,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.006-mainnet-http-routing".to_owned(),
|
||||
shell_phase: "pre.007-request-mapping".to_owned(),
|
||||
startup_diagnostic: runtime.startup_diagnostic.clone(),
|
||||
});
|
||||
}
|
||||
@@ -131,17 +131,27 @@ impl crate::AppState {
|
||||
let runtime = self.transport_runtime.as_ref();
|
||||
let options = match runtime {
|
||||
std::option::Option::Some(value) => value.options(),
|
||||
std::option::Option::None => std::result::Result::Ok(crate::BackfillDeskOptionsDto {
|
||||
http_routes: std::vec::Vec::new(),
|
||||
composition_ready: false,
|
||||
configured_networks: std::vec::Vec::new(),
|
||||
network_coherent: false,
|
||||
store_diagnostic: std::option::Option::None,
|
||||
store_network: std::option::Option::None,
|
||||
store_ready: false,
|
||||
transport_diagnostic: self.transport_startup_diagnostic.clone(),
|
||||
transport_ready: false,
|
||||
}),
|
||||
std::option::Option::None => {
|
||||
let limits = crate::backfill_request_limits();
|
||||
let limits = match limits {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
std::result::Result::Ok(crate::BackfillDeskOptionsDto {
|
||||
commitments: crate::backfill_commitment_codes(),
|
||||
composition_ready: false,
|
||||
configured_networks: std::vec::Vec::new(),
|
||||
http_routes: std::vec::Vec::new(),
|
||||
limits,
|
||||
network_coherent: false,
|
||||
scope_kinds: crate::backfill_scope_kind_codes(),
|
||||
store_diagnostic: std::option::Option::None,
|
||||
store_network: std::option::Option::None,
|
||||
store_ready: false,
|
||||
transport_diagnostic: self.transport_startup_diagnostic.clone(),
|
||||
transport_ready: false,
|
||||
})
|
||||
},
|
||||
};
|
||||
let mut options = match options {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -151,6 +161,39 @@ impl crate::AppState {
|
||||
return std::result::Result::Ok(options);
|
||||
}
|
||||
|
||||
/// Validates and maps one frontend campaign request without starting a Backfill Job.
|
||||
pub(crate) fn validate_backfill_request(&self, request: crate::BackfillStartRequestDto) -> ksp_core_lib::Result<crate::BackfillRequestPreviewDto> {
|
||||
let options = self.backfill_options();
|
||||
let options = match options {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let job_id = ksp_job_api::JobId::new("backfill-desk-validation");
|
||||
let job_id = match job_id {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let mapped = crate::map_backfill_request(request, &options, job_id);
|
||||
let mapped = match mapped {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let preview = crate::project_backfill_request(&mapped);
|
||||
let preview = match preview {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_REQUEST,
|
||||
commitment = preview.commitment.as_str(),
|
||||
http_role = preview.http_role.as_str(),
|
||||
scope_kind = preview.scope_kind.as_str(),
|
||||
"validated Backfill Desk campaign request without starting a Job"
|
||||
);
|
||||
return std::result::Result::Ok(preview);
|
||||
}
|
||||
|
||||
/// Marks graceful application shutdown as started and reports whether this caller won the one-shot transition.
|
||||
pub(crate) fn begin_shutdown(&self) -> bool {
|
||||
return self.shutdown_started.compare_exchange(false, true, std::sync::atomic::Ordering::AcqRel, std::sync::atomic::Ordering::Acquire).is_ok();
|
||||
|
||||
Reference in New Issue
Block a user