v0.3.7-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/app_state.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! 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.005-store-readiness".to_owned(),
|
||||
shell_phase: "pre.006-mainnet-http-routing".to_owned(),
|
||||
startup_diagnostic: runtime.startup_diagnostic.clone(),
|
||||
});
|
||||
}
|
||||
@@ -132,7 +132,7 @@ impl crate::AppState {
|
||||
let options = match runtime {
|
||||
std::option::Option::Some(value) => value.options(),
|
||||
std::option::Option::None => std::result::Result::Ok(crate::BackfillDeskOptionsDto {
|
||||
compatible_roles: std::vec::Vec::new(),
|
||||
http_routes: std::vec::Vec::new(),
|
||||
composition_ready: false,
|
||||
configured_networks: std::vec::Vec::new(),
|
||||
network_coherent: false,
|
||||
|
||||
@@ -1,20 +1,35 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/dto_common.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Common Tauri DTOs shared by the Backfill Desk shell.
|
||||
|
||||
use ts_rs::TS; // rust-rules: trait-import
|
||||
|
||||
/// Safe Transport-readiness subset of the Backfill Desk options contract.
|
||||
/// Safe HTTP route exposed for operator selection before a Backfill run.
|
||||
///
|
||||
/// Campaign scopes, commitments and backend-owned bounds are added in the dedicated request/DTO slice. Endpoint URLs, provider identities and credentials
|
||||
/// are intentionally absent.
|
||||
/// The route is identified only by the logical Transport role. Provider labels are safe metadata used for operator choice; endpoint URLs and credentials never
|
||||
/// cross IPC.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_backfill_desk/dto_common/BackfillHttpRouteOptionDto.ts")]
|
||||
pub(crate) struct BackfillHttpRouteOptionDto {
|
||||
/// Whether more than one configured provider participates in this logical route.
|
||||
pub(crate) pooled: bool,
|
||||
/// Safe provider labels participating in the route, sorted and deduplicated.
|
||||
pub(crate) providers: std::vec::Vec<String>,
|
||||
/// Logical Transport role later passed to the Backfill runtime.
|
||||
pub(crate) role: String,
|
||||
}
|
||||
|
||||
/// Safe Transport-and-Store readiness subset of the Backfill Desk options contract.
|
||||
///
|
||||
/// Campaign scopes, commitments and backend-owned bounds are added in the dedicated request/DTO slice. Endpoint URLs and credentials are intentionally absent.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_backfill_desk/dto_common/BackfillDeskOptionsDto.ts")]
|
||||
pub(crate) struct BackfillDeskOptionsDto {
|
||||
/// Logical roles that can route both RPC methods required by the Backfill runtime.
|
||||
pub(crate) compatible_roles: std::vec::Vec<String>,
|
||||
/// Selectable logical HTTP routes that support both RPC methods required by the Backfill runtime.
|
||||
pub(crate) http_routes: std::vec::Vec<BackfillHttpRouteOptionDto>,
|
||||
/// Whether the Transport and Store readiness gates jointly permit later Backfill composition.
|
||||
pub(crate) composition_ready: bool,
|
||||
/// Distinct enabled HTTP cluster labels selected by the active Transport profile.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/lib.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Tauri desktop application scaffold for controlling and inspecting KSP RAW backfill jobs.
|
||||
|
||||
@@ -62,8 +62,10 @@ pub(crate) use self::constants::TRACING_TARGET_FRONTEND;
|
||||
pub(crate) use self::constants::TRACING_TARGET_FRONTEND_MAIN;
|
||||
/// Owning target for splash-window frontend events.
|
||||
pub(crate) use self::constants::TRACING_TARGET_FRONTEND_SPLASH;
|
||||
/// Safe Transport-readiness subset of the Backfill Desk options contract.
|
||||
/// Safe Transport-and-Store readiness subset of the Backfill Desk options contract.
|
||||
pub(crate) use self::dto_common::BackfillDeskOptionsDto;
|
||||
/// Safe logical HTTP route exposed for operator selection.
|
||||
pub(crate) use self::dto_common::BackfillHttpRouteOptionDto;
|
||||
/// Safe command error projection exposed to Tauri commands.
|
||||
pub(crate) use self::dto_common::CommandErrorDto;
|
||||
/// Safe scaffold/runtime snapshot exposed to the shell.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// file: crates/ksp-app-backfill-desk/src/transport_runtime.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Composite-selected HTTP Transport readiness owned by Backfill Desk.
|
||||
//! Composite-selected HTTP Transport readiness and route inventory owned by Backfill Desk.
|
||||
|
||||
/// Safe and executable Transport runtime retained by the application state.
|
||||
pub(crate) struct TransportRuntime {
|
||||
@@ -30,16 +30,16 @@ impl TransportRuntime {
|
||||
pub(crate) fn options(&self) -> ksp_core_lib::Result<crate::BackfillDeskOptionsDto> {
|
||||
let snapshot = self.pool.snapshot();
|
||||
let configured_networks = configured_networks(&snapshot);
|
||||
let compatible_roles = compatible_backfill_roles(&self.pool, &snapshot);
|
||||
let compatible_roles = match compatible_roles {
|
||||
let http_routes = compatible_backfill_http_routes(&self.pool, &snapshot);
|
||||
let http_routes = match http_routes {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let transport_ready = configured_networks.len() == 1 && !compatible_roles.is_empty() && snapshot.available_endpoint_count() > 0;
|
||||
let transport_ready = configured_networks.len() == 1 && !http_routes.is_empty() && snapshot.available_endpoint_count() > 0;
|
||||
return std::result::Result::Ok(crate::BackfillDeskOptionsDto {
|
||||
compatible_roles,
|
||||
composition_ready: false,
|
||||
configured_networks,
|
||||
http_routes,
|
||||
network_coherent: false,
|
||||
store_diagnostic: std::option::Option::None,
|
||||
store_network: std::option::Option::None,
|
||||
@@ -89,17 +89,17 @@ pub(crate) fn initialize_transport(management: &ksp_config_lib::ConfigManagement
|
||||
domain = crate::TRACING_DOMAIN_TRANSPORT,
|
||||
transport_profile = runtime.profile_id(),
|
||||
network_count = options.configured_networks.len(),
|
||||
compatible_role_count = options.compatible_roles.len(),
|
||||
http_route_count = options.http_routes.len(),
|
||||
transport_ready = options.transport_ready,
|
||||
"initialized Backfill Desk HTTP Transport readiness from composite-managed configuration"
|
||||
);
|
||||
return std::result::Result::Ok(runtime);
|
||||
}
|
||||
|
||||
fn compatible_backfill_roles(
|
||||
fn compatible_backfill_http_routes(
|
||||
pool: &ksp_onchain_transport_lib::HttpTransportPool,
|
||||
snapshot: &ksp_onchain_transport_lib::HttpTransportPoolSnapshot,
|
||||
) -> ksp_core_lib::Result<std::vec::Vec<String>> {
|
||||
) -> ksp_core_lib::Result<std::vec::Vec<crate::BackfillHttpRouteOptionDto>> {
|
||||
let signatures = required_http_rpc_method("getSignaturesForAddress");
|
||||
let signatures = match signatures {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -110,22 +110,23 @@ fn compatible_backfill_roles(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let mut candidates = std::collections::BTreeSet::new();
|
||||
let mut candidates = std::collections::BTreeMap::<String, std::collections::BTreeSet<String>>::new();
|
||||
for endpoint in snapshot.endpoints() {
|
||||
if !endpoint.enabled() {
|
||||
continue;
|
||||
}
|
||||
for role in endpoint.roles() {
|
||||
if role.enabled() {
|
||||
candidates.insert(role.role().to_owned());
|
||||
candidates.entry(role.role().to_owned()).or_default().insert(endpoint.provider().to_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut compatible = std::vec::Vec::new();
|
||||
for candidate in candidates {
|
||||
for (candidate, providers) in candidates {
|
||||
let role = ksp_onchain_transport_lib::HttpRoleName::new(candidate.clone());
|
||||
if pool.select_for_method(&role, signatures).is_ok() && pool.select_for_method(&role, transaction).is_ok() {
|
||||
compatible.push(candidate);
|
||||
let providers = providers.into_iter().collect::<std::vec::Vec<_>>();
|
||||
compatible.push(crate::BackfillHttpRouteOptionDto { pooled: providers.len() > 1, providers, role: candidate });
|
||||
}
|
||||
}
|
||||
return std::result::Result::Ok(compatible);
|
||||
|
||||
Reference in New Issue
Block a user