v0.2.12-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/src/app_state.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Shared backend state owned by the SOL Prices Desk Tauri application.
|
||||
|
||||
@@ -73,6 +73,19 @@ impl crate::AppState {
|
||||
return self.market_price_runtime.refresh_one(provider_id).await;
|
||||
}
|
||||
|
||||
/// Refreshes a selected provider set in deterministic request order and returns only safe updated rows/counts.
|
||||
pub(crate) async fn refresh_market_prices(
|
||||
&self,
|
||||
request: crate::MarketPriceRefreshManyRequestDto,
|
||||
) -> ksp_core_lib::Result<crate::MarketPriceRefreshResultDto> {
|
||||
return self.market_price_runtime.refresh_many(request.into_provider_ids()).await;
|
||||
}
|
||||
|
||||
/// Refreshes every configured provider in the deterministic order owned by Off-chain Transport.
|
||||
pub(crate) async fn refresh_all_market_prices(&self) -> ksp_core_lib::Result<crate::MarketPriceRefreshResultDto> {
|
||||
return self.market_price_runtime.refresh_all().await;
|
||||
}
|
||||
|
||||
/// Builds the safe runtime status exposed by the SOL Prices Desk shell.
|
||||
pub(crate) fn runtime_status(&self) -> ksp_core_lib::Result<crate::MarketPriceRuntimeStatusDto> {
|
||||
let document_count = self.config_management.engine().registry().descriptors().count();
|
||||
@@ -116,7 +129,7 @@ impl crate::AppState {
|
||||
fallback_logging_active: runtime.fallback_active,
|
||||
provider_count,
|
||||
ready_provider_count,
|
||||
shell_phase: "pre.005-single-refresh".to_owned(),
|
||||
shell_phase: "pre.006-multi-refresh".to_owned(),
|
||||
startup_diagnostic: runtime.startup_diagnostic.clone(),
|
||||
unavailable_provider_count,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/src/errors.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Application-local error codes for SOL Prices Desk composition and desktop runtime surfaces.
|
||||
|
||||
@@ -16,6 +16,12 @@ pub(crate) const ERROR_CODE_FRONTEND_LOG_TARGET_INVALID: ksp_core_lib::ErrorCode
|
||||
ksp_core_lib::ErrorCode::new("solprices_desk", "frontend_log_target_invalid");
|
||||
/// SOL Prices Desk could not install the managed Logging runtime or its safe fallback.
|
||||
pub(crate) const ERROR_CODE_LOGGING_BOOTSTRAP_FAILED: ksp_core_lib::ErrorCode = ksp_core_lib::ErrorCode::new("solprices_desk", "logging_bootstrap_failed");
|
||||
/// One requested market-price provider already has an explicit refresh in flight.
|
||||
pub(crate) const ERROR_CODE_MARKET_PRICE_REFRESH_CONFLICT: ksp_core_lib::ErrorCode =
|
||||
ksp_core_lib::ErrorCode::new("solprices_desk", "market_price_refresh_conflict");
|
||||
/// A selected market-price refresh contains duplicate or unknown provider identifiers.
|
||||
pub(crate) const ERROR_CODE_MARKET_PRICE_SELECTION_INVALID: ksp_core_lib::ErrorCode =
|
||||
ksp_core_lib::ErrorCode::new("solprices_desk", "market_price_selection_invalid");
|
||||
/// Splash readiness was invoked from a window other than the splash window.
|
||||
pub(crate) const ERROR_CODE_SPLASH_ORIGIN_INVALID: ksp_core_lib::ErrorCode = ksp_core_lib::ErrorCode::new("solprices_desk", "splash_origin_invalid");
|
||||
/// A KSP desk splash environment duration is malformed or exceeds its safety bound.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/src/lib.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Tauri desktop application scaffold for provider-neutral SOL/USD price visualization.
|
||||
|
||||
@@ -74,6 +74,10 @@ pub(crate) use self::errors::ERROR_CODE_FRONTEND_LOG_LEVEL_INVALID;
|
||||
pub(crate) use self::errors::ERROR_CODE_FRONTEND_LOG_TARGET_INVALID;
|
||||
/// SOL Prices Desk could not install the managed Logging runtime or its safe fallback.
|
||||
pub(crate) use self::errors::ERROR_CODE_LOGGING_BOOTSTRAP_FAILED;
|
||||
/// One requested market-price provider already has an explicit refresh in flight.
|
||||
pub(crate) use self::errors::ERROR_CODE_MARKET_PRICE_REFRESH_CONFLICT;
|
||||
/// A selected market-price refresh contains duplicate or unknown provider identifiers.
|
||||
pub(crate) use self::errors::ERROR_CODE_MARKET_PRICE_SELECTION_INVALID;
|
||||
/// Splash readiness was invoked from a window other than the splash window.
|
||||
pub(crate) use self::errors::ERROR_CODE_SPLASH_ORIGIN_INVALID;
|
||||
/// A KSP desk splash environment duration is malformed or exceeds its safety bound.
|
||||
@@ -92,6 +96,10 @@ pub(crate) use self::frontend_logging::emit_frontend_log_event;
|
||||
pub(crate) use self::logging_runtime::launch_identity;
|
||||
/// Safe provider-neutral market-price row exposed to the frontend.
|
||||
pub(crate) use self::market_price_runtime::MarketPriceProviderRowDto;
|
||||
/// Bounded provider-neutral request used by the selected-provider refresh command.
|
||||
pub(crate) use self::market_price_runtime::MarketPriceRefreshManyRequestDto;
|
||||
/// Safe result returned by selected/global market-price refresh commands.
|
||||
pub(crate) use self::market_price_runtime::MarketPriceRefreshResultDto;
|
||||
/// Backend application runtime owning the Config-selected service and in-memory market-price presentation state.
|
||||
pub(crate) use self::market_price_runtime::MarketPriceRuntime;
|
||||
/// Resolved composite and Off-chain Transport configuration retained by SOL Prices Desk.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/src/market_price_runtime.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Provider-neutral market-price presentation runtime owned by SOL Prices Desk.
|
||||
|
||||
@@ -36,6 +36,35 @@ pub(crate) struct MarketPriceProviderRowDto {
|
||||
pub(crate) semantics: String,
|
||||
}
|
||||
|
||||
/// Bounded provider-neutral request used by the selected-provider refresh command.
|
||||
#[derive(Debug, serde::Deserialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_solprices_desk/market_price_runtime/MarketPriceRefreshManyRequestDto.ts")]
|
||||
pub(crate) struct MarketPriceRefreshManyRequestDto {
|
||||
/// Opaque provider identifiers requested by the frontend in deterministic row order.
|
||||
pub(crate) provider_ids: std::vec::Vec<String>,
|
||||
}
|
||||
|
||||
impl crate::MarketPriceRefreshManyRequestDto {
|
||||
/// Consumes the IPC DTO and returns the opaque provider identifiers for authoritative backend validation.
|
||||
pub(crate) fn into_provider_ids(self) -> std::vec::Vec<String> {
|
||||
return self.provider_ids;
|
||||
}
|
||||
}
|
||||
|
||||
/// Safe result of one selected/global refresh operation.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_solprices_desk/market_price_runtime/MarketPriceRefreshResultDto.ts")]
|
||||
pub(crate) struct MarketPriceRefreshResultDto {
|
||||
/// Number of provider refreshes that produced a new normalized observation.
|
||||
pub(crate) refreshed_count: u32,
|
||||
/// Number of providers included in the validated operation.
|
||||
pub(crate) requested_count: u32,
|
||||
/// Updated provider-neutral rows in the exact dispatch/outcome order.
|
||||
pub(crate) rows: std::vec::Vec<MarketPriceProviderRowDto>,
|
||||
}
|
||||
|
||||
/// Backend application runtime that owns the Config-selected Off-chain service and current in-memory presentation state.
|
||||
pub(crate) struct MarketPriceRuntime {
|
||||
presentation: std::sync::Mutex<MarketPricePresentationState>,
|
||||
@@ -128,7 +157,8 @@ impl crate::MarketPriceRuntime {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let loading = self.set_loading(&provider_id, true);
|
||||
let provider_ids = [provider_id.clone()];
|
||||
let loading = self.begin_refresh(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(error) = loading {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -142,7 +172,7 @@ impl crate::MarketPriceRuntime {
|
||||
let outcome = match outcome {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.set_loading(&provider_id, false);
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
@@ -152,7 +182,13 @@ impl crate::MarketPriceRuntime {
|
||||
let row = self.apply_outcome(&outcome);
|
||||
let row = match row {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
@@ -165,6 +201,101 @@ impl crate::MarketPriceRuntime {
|
||||
return std::result::Result::Ok(row);
|
||||
}
|
||||
|
||||
/// Refreshes a frontend-selected provider set in deterministic request order through the generic Off-chain service.
|
||||
pub(crate) async fn refresh_many(&self, provider_ids: std::vec::Vec<String>) -> ksp_core_lib::Result<crate::MarketPriceRefreshResultDto> {
|
||||
let provider_ids = parse_provider_ids(provider_ids);
|
||||
let provider_ids = match provider_ids {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let loading = self.begin_refresh(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(error) = loading {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_OFFCHAIN_TRANSPORT,
|
||||
provider_count = provider_ids.len(),
|
||||
"started SOL Prices Desk selected-provider market-price refresh"
|
||||
);
|
||||
let outcomes = self.startup.resolved().service().refresh_many(provider_ids.as_slice()).await;
|
||||
let outcomes = match outcomes {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
let result = self.apply_outcomes(outcomes.as_slice());
|
||||
let result = match result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_OFFCHAIN_TRANSPORT,
|
||||
provider_count = result.requested_count,
|
||||
refreshed_count = result.refreshed_count,
|
||||
"completed SOL Prices Desk selected-provider market-price refresh"
|
||||
);
|
||||
return std::result::Result::Ok(result);
|
||||
}
|
||||
|
||||
/// Refreshes every configured provider through the generic Off-chain service in its stable provider order.
|
||||
pub(crate) async fn refresh_all(&self) -> ksp_core_lib::Result<crate::MarketPriceRefreshResultDto> {
|
||||
let registry = self.startup.resolved().service().registry();
|
||||
let provider_ids = registry.entries().iter().map(|entry| return entry.descriptor().id().clone()).collect::<std::vec::Vec<_>>();
|
||||
let loading = self.begin_refresh(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(error) = loading {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_OFFCHAIN_TRANSPORT,
|
||||
provider_count = provider_ids.len(),
|
||||
"started SOL Prices Desk global market-price refresh"
|
||||
);
|
||||
let outcomes = self.startup.resolved().service().refresh_all().await;
|
||||
let outcomes = match outcomes {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
let result = self.apply_outcomes(outcomes.as_slice());
|
||||
let result = match result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
let cleared = self.clear_loading(provider_ids.as_slice());
|
||||
if let std::result::Result::Err(clear_error) = cleared {
|
||||
return std::result::Result::Err(clear_error);
|
||||
}
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
ksp_logging_lib::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_OFFCHAIN_TRANSPORT,
|
||||
provider_count = result.requested_count,
|
||||
refreshed_count = result.refreshed_count,
|
||||
"completed SOL Prices Desk global market-price refresh"
|
||||
);
|
||||
return std::result::Result::Ok(result);
|
||||
}
|
||||
|
||||
fn apply_outcome(&self, outcome: &ksp_offchain_transport_lib::MarketPriceRefreshOutcome) -> ksp_core_lib::Result<crate::MarketPriceProviderRowDto> {
|
||||
let registry = self.startup.resolved().service().registry();
|
||||
let registry_entry = registry.entry(outcome.provider_id());
|
||||
@@ -196,13 +327,86 @@ impl crate::MarketPriceRuntime {
|
||||
};
|
||||
}
|
||||
|
||||
fn set_loading(&self, provider_id: &ksp_offchain_transport_lib::MarketPriceProviderId, loading: bool) -> ksp_core_lib::Result<()> {
|
||||
fn apply_outcomes(&self, outcomes: &[ksp_offchain_transport_lib::MarketPriceRefreshOutcome]) -> ksp_core_lib::Result<crate::MarketPriceRefreshResultDto> {
|
||||
let registry = self.startup.resolved().service().registry();
|
||||
let presentation = lock_presentation(&self.presentation);
|
||||
let mut presentation = match presentation {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return set_loading_in_state(&mut presentation, provider_id.as_str(), loading);
|
||||
let mut rows = std::vec::Vec::with_capacity(outcomes.len());
|
||||
let mut refreshed_count = 0usize;
|
||||
for outcome in outcomes {
|
||||
let registry_entry = registry.entry(outcome.provider_id());
|
||||
let registry_entry = match registry_entry {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => {
|
||||
return std::result::Result::Err(
|
||||
ksp_core_lib::Error::new(
|
||||
crate::ERROR_CODE_APP_STATE_INVALID,
|
||||
"SOL Prices Desk refresh outcome references an unknown registry provider",
|
||||
)
|
||||
.with_context("provider_id", outcome.provider_id().as_str()),
|
||||
);
|
||||
},
|
||||
};
|
||||
let applied = apply_outcome_to_state(&mut presentation, outcome);
|
||||
if let std::result::Result::Err(error) = applied {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
if outcome.refreshed() {
|
||||
refreshed_count += 1;
|
||||
}
|
||||
let presentation_entry = presentation.entries.get(outcome.provider_id().as_str());
|
||||
let presentation_entry = match presentation_entry {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => {
|
||||
return std::result::Result::Err(
|
||||
ksp_core_lib::Error::new(
|
||||
crate::ERROR_CODE_APP_STATE_INVALID,
|
||||
"SOL Prices Desk market-price runtime is missing refreshed provider state",
|
||||
)
|
||||
.with_context("provider_id", outcome.provider_id().as_str()),
|
||||
);
|
||||
},
|
||||
};
|
||||
rows.push(project_registry_entry(registry_entry, presentation_entry));
|
||||
}
|
||||
let requested_count = count_to_u32(outcomes.len(), "refresh_requested_count");
|
||||
let requested_count = match requested_count {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let refreshed_count = count_to_u32(refreshed_count, "refresh_success_count");
|
||||
let refreshed_count = match refreshed_count {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return std::result::Result::Ok(crate::MarketPriceRefreshResultDto { refreshed_count, requested_count, rows });
|
||||
}
|
||||
|
||||
fn begin_refresh(&self, provider_ids: &[ksp_offchain_transport_lib::MarketPriceProviderId]) -> ksp_core_lib::Result<()> {
|
||||
let presentation = lock_presentation(&self.presentation);
|
||||
let mut presentation = match presentation {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return begin_refresh_in_state(&mut presentation, provider_ids);
|
||||
}
|
||||
|
||||
fn clear_loading(&self, provider_ids: &[ksp_offchain_transport_lib::MarketPriceProviderId]) -> ksp_core_lib::Result<()> {
|
||||
let presentation = lock_presentation(&self.presentation);
|
||||
let mut presentation = match presentation {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
for provider_id in provider_ids {
|
||||
let cleared = set_loading_in_state(&mut presentation, provider_id.as_str(), false);
|
||||
if let std::result::Result::Err(error) = cleared {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +462,53 @@ fn availability_code(availability: ksp_offchain_transport_lib::MarketPriceProvid
|
||||
};
|
||||
}
|
||||
|
||||
fn begin_refresh_in_state(
|
||||
presentation: &mut MarketPricePresentationState,
|
||||
provider_ids: &[ksp_offchain_transport_lib::MarketPriceProviderId],
|
||||
) -> ksp_core_lib::Result<()> {
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
for provider_id in provider_ids {
|
||||
if !seen.insert(provider_id.as_str().to_owned()) {
|
||||
return std::result::Result::Err(
|
||||
ksp_core_lib::Error::new(
|
||||
crate::ERROR_CODE_MARKET_PRICE_SELECTION_INVALID,
|
||||
"SOL Prices Desk market-price refresh selection contains a duplicate provider",
|
||||
)
|
||||
.with_context("provider_id", provider_id.as_str()),
|
||||
);
|
||||
}
|
||||
let entry = presentation.entries.get(provider_id.as_str());
|
||||
let entry = match entry {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => {
|
||||
return std::result::Result::Err(
|
||||
ksp_core_lib::Error::new(
|
||||
crate::ERROR_CODE_MARKET_PRICE_SELECTION_INVALID,
|
||||
"SOL Prices Desk market-price refresh selection contains an unknown provider",
|
||||
)
|
||||
.with_context("provider_id", provider_id.as_str()),
|
||||
);
|
||||
},
|
||||
};
|
||||
if entry.loading {
|
||||
return std::result::Result::Err(
|
||||
ksp_core_lib::Error::new(
|
||||
crate::ERROR_CODE_MARKET_PRICE_REFRESH_CONFLICT,
|
||||
"SOL Prices Desk market-price provider already has a refresh in flight",
|
||||
)
|
||||
.with_context("provider_id", provider_id.as_str()),
|
||||
);
|
||||
}
|
||||
}
|
||||
for provider_id in provider_ids {
|
||||
let updated = set_loading_in_state(presentation, provider_id.as_str(), true);
|
||||
if let std::result::Result::Err(error) = updated {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
|
||||
fn count_to_u32(value: usize, field: &'static str) -> ksp_core_lib::Result<u32> {
|
||||
let converted = u32::try_from(value);
|
||||
return match converted {
|
||||
@@ -282,6 +533,19 @@ fn lock_presentation(
|
||||
};
|
||||
}
|
||||
|
||||
fn parse_provider_ids(provider_ids: std::vec::Vec<String>) -> ksp_core_lib::Result<std::vec::Vec<ksp_offchain_transport_lib::MarketPriceProviderId>> {
|
||||
let mut parsed = std::vec::Vec::with_capacity(provider_ids.len());
|
||||
for provider_id in provider_ids {
|
||||
let provider_id = ksp_offchain_transport_lib::MarketPriceProviderId::new(provider_id);
|
||||
let provider_id = match provider_id {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
parsed.push(provider_id);
|
||||
}
|
||||
return std::result::Result::Ok(parsed);
|
||||
}
|
||||
|
||||
fn project_registry_entry(
|
||||
entry: &ksp_offchain_transport_lib::MarketPriceProviderRegistryEntry,
|
||||
presentation: &MarketPricePresentationEntry,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-solprices-desk/src/tauri.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Tauri runtime assembly for the KSP SOL prices desktop application.
|
||||
|
||||
@@ -76,7 +76,9 @@ fn configure_commands(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tau
|
||||
emit_frontend_log,
|
||||
get_runtime_status,
|
||||
list_market_prices,
|
||||
refresh_all_market_prices,
|
||||
refresh_market_price,
|
||||
refresh_market_prices,
|
||||
splash_frontend_ready,
|
||||
]);
|
||||
}
|
||||
@@ -128,6 +130,17 @@ fn list_market_prices(
|
||||
};
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn refresh_all_market_prices(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::MarketPriceRefreshResultDto, crate::CommandErrorDto> {
|
||||
let result = state.refresh_all_market_prices().await;
|
||||
return match result {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(crate::CommandErrorDto::from_error(&error)),
|
||||
};
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn refresh_market_price(
|
||||
provider_id: String,
|
||||
@@ -140,6 +153,18 @@ async fn refresh_market_price(
|
||||
};
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn refresh_market_prices(
|
||||
request: crate::MarketPriceRefreshManyRequestDto,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::MarketPriceRefreshResultDto, crate::CommandErrorDto> {
|
||||
let result = state.refresh_market_prices(request).await;
|
||||
return match result {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(crate::CommandErrorDto::from_error(&error)),
|
||||
};
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn splash_frontend_ready(
|
||||
app: tauri::AppHandle,
|
||||
|
||||
Reference in New Issue
Block a user