v0.1.0-pre.052
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/tauri.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
//! Tauri runtime assembly and private command wrappers.
|
||||
|
||||
@@ -64,6 +64,16 @@ pub fn run() -> kb_core::Result<()> {
|
||||
load_demo_sql_replay_programs,
|
||||
load_demo_sql_replay_entities,
|
||||
export_demo_sql_replay_csv,
|
||||
open_demo_core_extraction_window,
|
||||
demo_core_extraction_options,
|
||||
demo_core_extraction_execute,
|
||||
demo_core_extraction_cancel,
|
||||
open_demo_decode_replay_window,
|
||||
demo_decode_replay_options,
|
||||
demo_decode_replay_execute,
|
||||
demo_decode_replay_cancel,
|
||||
demo_decode_replay_diagnostics,
|
||||
demo_decode_replay_annotations,
|
||||
open_demo_config_window,
|
||||
load_demo_config,
|
||||
]);
|
||||
@@ -164,9 +174,9 @@ pub fn run() -> kb_core::Result<()> {
|
||||
let run_result = builder.run(tauri::generate_context!());
|
||||
return match run_result {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::tauri(format!(
|
||||
"cannot run desktop demo application: {error:?}"
|
||||
))),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::tauri(
|
||||
format!("cannot run desktop demo application: {error:?}"),
|
||||
)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -182,6 +192,436 @@ fn install_default_rustls_provider() -> kb_core::Result<()> {
|
||||
)),
|
||||
};
|
||||
}
|
||||
/// Opens or focuses the canonical to core extraction demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_core_extraction_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
tracing::info!(target: crate::TRACING_TARGET, "open core extraction demo window");
|
||||
let existing_window = app_handle.get_webview_window("demo_core_extraction");
|
||||
if let std::option::Option::Some(window) = existing_window {
|
||||
let show_result = window.show();
|
||||
if let std::result::Result::Err(error) = show_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
"demo_core_extraction",
|
||||
tauri::WebviewUrl::App("demo_core_extraction.html".into()),
|
||||
)
|
||||
.title("Khadhroony Bot2 - Extraction canonical vers core")
|
||||
.inner_size(1280.0, 860.0)
|
||||
.min_inner_size(960.0, 620.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.build();
|
||||
return match build_result {
|
||||
std::result::Result::Ok(window) => {
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the initial core extraction demo options.
|
||||
#[tauri::command]
|
||||
fn demo_core_extraction_options(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> crate::DemoCoreExtractionOptionsPayload {
|
||||
return crate::DemoCoreExtractionOptionsPayload {
|
||||
processor_version: kb_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(),
|
||||
default_limit: 100,
|
||||
default_max_concurrent_extractions: 4,
|
||||
running: state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire),
|
||||
};
|
||||
}
|
||||
|
||||
/// Executes one bounded canonical transaction to core extraction campaign.
|
||||
#[tauri::command]
|
||||
async fn demo_core_extraction_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoCoreExtractionRequest,
|
||||
) -> std::result::Result<crate::DemoCoreExtractionSummaryPayload, std::string::String> {
|
||||
let acquire_result = state.demo_core_extraction_running().compare_exchange(
|
||||
false,
|
||||
true,
|
||||
std::sync::atomic::Ordering::AcqRel,
|
||||
std::sync::atomic::Ordering::Acquire,
|
||||
);
|
||||
if acquire_result.is_err() {
|
||||
return std::result::Result::Err(
|
||||
"a core extraction campaign is already running".to_string(),
|
||||
);
|
||||
}
|
||||
let _run_guard = crate::DemoCoreExtractionRunGuard {
|
||||
running: state.demo_core_extraction_running(),
|
||||
};
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(false, std::sync::atomic::Ordering::Release);
|
||||
let pipeline_request_result = crate::build_demo_core_extraction_pipeline_request(request);
|
||||
let pipeline_request = match pipeline_request_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let observer = crate::DemoCoreExtractionObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_core_extraction_cancel_requested(),
|
||||
};
|
||||
let summary_result =
|
||||
kb_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await;
|
||||
let summary = match summary_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
return std::result::Result::Ok(crate::demo_core_extraction_summary_payload(summary));
|
||||
}
|
||||
|
||||
/// Requests cooperative cancellation of the current core extraction campaign.
|
||||
#[tauri::command]
|
||||
fn demo_core_extraction_cancel(state: tauri::State<'_, crate::AppState>) -> bool {
|
||||
let running = state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(true, std::sync::atomic::Ordering::Release);
|
||||
return running;
|
||||
}
|
||||
|
||||
/// Opens or focuses the contextual decode replay window.
|
||||
#[tauri::command]
|
||||
fn open_demo_decode_replay_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
tracing::info!(target: crate::TRACING_TARGET, action = "open_window", window = "demo_decode_replay", "open contextual decode replay window");
|
||||
let existing_window = app_handle.get_webview_window("demo_decode_replay");
|
||||
if let std::option::Option::Some(window) = existing_window {
|
||||
let show_result = window.show();
|
||||
if let std::result::Result::Err(error) = show_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
"demo_decode_replay",
|
||||
tauri::WebviewUrl::App("demo_decode_replay.html".into()),
|
||||
)
|
||||
.title("Khadhroony Bot2 - Décodage et matérialisation")
|
||||
.inner_size(1320.0, 900.0)
|
||||
.min_inner_size(980.0, 660.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.build();
|
||||
return match build_result {
|
||||
std::result::Result::Ok(window) => {
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns available decoders and default replay bounds.
|
||||
#[tauri::command]
|
||||
fn demo_decode_replay_options(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> crate::DemoDecodeReplayOptionsPayload {
|
||||
let decoders = crate::available_decoders();
|
||||
let decoder_options = decoders
|
||||
.iter()
|
||||
.map(|decoder| {
|
||||
let identity = decoder.identity();
|
||||
return crate::DemoDecodeReplayDecoderOption {
|
||||
name: identity.name,
|
||||
version: identity.version,
|
||||
program_ids: decoder
|
||||
.surfaces()
|
||||
.iter()
|
||||
.map(|surface| return surface.program_id.to_string())
|
||||
.collect(),
|
||||
};
|
||||
})
|
||||
.collect::<std::vec::Vec<_>>();
|
||||
let materializers = crate::available_materializers();
|
||||
let materializer_names = materializers
|
||||
.iter()
|
||||
.map(|materializer| {
|
||||
let identity = materializer.identity();
|
||||
return format!("{}@{}", identity.name, identity.version);
|
||||
})
|
||||
.collect::<std::vec::Vec<_>>();
|
||||
let running = state.demo_decode_replay_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "load_options",
|
||||
pipeline_version = kb_pipeline::DECODE_PIPELINE_VERSION,
|
||||
decoder_count = decoder_options.len(),
|
||||
materializer_names = ?materializer_names,
|
||||
default_limit = 100_u32,
|
||||
default_max_concurrent_inputs = 4_u32,
|
||||
running,
|
||||
"return contextual decode replay options"
|
||||
);
|
||||
return crate::DemoDecodeReplayOptionsPayload {
|
||||
pipeline_version: kb_pipeline::DECODE_PIPELINE_VERSION.to_string(),
|
||||
decoders: decoder_options,
|
||||
materializer_names,
|
||||
default_limit: 100,
|
||||
default_max_concurrent_inputs: 4,
|
||||
running,
|
||||
};
|
||||
}
|
||||
|
||||
/// Executes one bounded contextual decode and optional materialization campaign.
|
||||
#[tauri::command]
|
||||
async fn demo_decode_replay_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoDecodeReplayRequest,
|
||||
) -> std::result::Result<crate::DemoDecodeReplaySummaryPayload, std::string::String> {
|
||||
let campaign_id = kb_pipeline::new_decode_campaign_id();
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "execute",
|
||||
campaign_id = %campaign_id,
|
||||
instruction_state = %request.instruction_state,
|
||||
signature_line_count = crate::optional_line_count(&request.signatures_text),
|
||||
program_id = ?request.program_id,
|
||||
instruction_paths_text = ?request.instruction_paths_text,
|
||||
decoder_names = ?request.decoder_names,
|
||||
limit = request.limit,
|
||||
max_concurrent_inputs = request.max_concurrent_inputs,
|
||||
all_compatible = request.all_compatible,
|
||||
force_replay = request.force_replay,
|
||||
force_replay_all_matching = request.force_replay_all_matching,
|
||||
materialize_after_decode = request.materialize_after_decode,
|
||||
"received contextual decode replay command"
|
||||
);
|
||||
let acquire_result = state.demo_decode_replay_running().compare_exchange(
|
||||
false,
|
||||
true,
|
||||
std::sync::atomic::Ordering::AcqRel,
|
||||
std::sync::atomic::Ordering::Acquire,
|
||||
);
|
||||
if acquire_result.is_err() {
|
||||
tracing::warn!(target: crate::TRACING_TARGET, action = "execute", campaign_id = %campaign_id, accepted = false, reason = "already_running", "reject contextual decode replay command");
|
||||
return std::result::Result::Err(
|
||||
"a contextual decode replay campaign is already running".to_string(),
|
||||
);
|
||||
}
|
||||
let _run_guard = crate::DemoDecodeReplayRunGuard {
|
||||
running: state.demo_decode_replay_running(),
|
||||
campaign_id: state.demo_decode_replay_campaign_id(),
|
||||
};
|
||||
let register_result = crate::register_active_campaign(
|
||||
state.demo_decode_replay_campaign_id(),
|
||||
campaign_id.as_str(),
|
||||
);
|
||||
if let std::result::Result::Err(error) = register_result {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "register_campaign", campaign_id = %campaign_id, error = %error, "cannot lock active contextual decode campaign slot");
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
state
|
||||
.demo_decode_replay_cancel_requested()
|
||||
.store(false, std::sync::atomic::Ordering::Release);
|
||||
let pipeline_request_result =
|
||||
crate::build_demo_decode_replay_pipeline_request(request, campaign_id.clone());
|
||||
let pipeline_request = match pipeline_request_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "build_request", campaign_id = %campaign_id, error = %error, "cannot build contextual decode replay request");
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "execute_pipeline",
|
||||
campaign_id = %pipeline_request.campaign_id,
|
||||
signature_count = pipeline_request.selection.signatures.len(),
|
||||
signature_sample = ?crate::text_sample(pipeline_request.selection.signatures.as_slice(), 5),
|
||||
processing_states = ?pipeline_request.selection.processing_states,
|
||||
min_slot = ?pipeline_request.selection.min_slot,
|
||||
max_slot = ?pipeline_request.selection.max_slot,
|
||||
program_ids = ?pipeline_request.selection.program_ids,
|
||||
instruction_paths = ?pipeline_request.selection.instruction_paths,
|
||||
incomplete_signatures = pipeline_request.selection.incomplete_signatures,
|
||||
limit = pipeline_request.selection.limit,
|
||||
decoder_names = ?pipeline_request.decoder_names,
|
||||
dispatch_policy = ?pipeline_request.dispatch_policy,
|
||||
max_concurrent_inputs = pipeline_request.max_concurrent_inputs,
|
||||
force_replay = pipeline_request.force_replay,
|
||||
force_replay_all_matching = pipeline_request.force_replay_all_matching,
|
||||
materialize_after_decode = pipeline_request.materialize_after_decode,
|
||||
"start contextual decode replay pipeline"
|
||||
);
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "connect_store", campaign_id = %pipeline_request.campaign_id, error = %error, "cannot connect contextual decode replay store");
|
||||
return std::result::Result::Err(error);
|
||||
},
|
||||
};
|
||||
let decoders = crate::available_decoders();
|
||||
let materializers = crate::available_materializers();
|
||||
let observer = crate::DemoDecodeReplayObserver {
|
||||
app_handle,
|
||||
campaign_id: pipeline_request.campaign_id.clone(),
|
||||
cancel_requested: state.demo_decode_replay_cancel_requested(),
|
||||
};
|
||||
let summary_result = kb_pipeline::execute_decode_replay(
|
||||
&store,
|
||||
&pipeline_request,
|
||||
decoders.as_slice(),
|
||||
materializers.as_slice(),
|
||||
&observer,
|
||||
)
|
||||
.await;
|
||||
let summary = match summary_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
tracing::error!(target: crate::TRACING_TARGET, action = "execute_pipeline", campaign_id = %pipeline_request.campaign_id, error = %error, "contextual decode replay pipeline failed");
|
||||
return std::result::Result::Err(error.to_string());
|
||||
},
|
||||
};
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "execute_pipeline",
|
||||
campaign_id = %summary.campaign_id,
|
||||
selected = summary.selected,
|
||||
started = summary.started,
|
||||
completed = summary.completed,
|
||||
unmatched = summary.unmatched,
|
||||
not_started = summary.not_started,
|
||||
failed_inputs = summary.failed_inputs,
|
||||
cancelled = summary.cancelled,
|
||||
processors = ?summary.processors,
|
||||
"contextual decode replay command completed"
|
||||
);
|
||||
return std::result::Result::Ok(crate::demo_decode_replay_summary_payload(summary));
|
||||
}
|
||||
|
||||
/// Requests cooperative cancellation of the current decode replay campaign.
|
||||
#[tauri::command]
|
||||
fn demo_decode_replay_cancel(state: tauri::State<'_, crate::AppState>) -> bool {
|
||||
let running = state.demo_decode_replay_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
state
|
||||
.demo_decode_replay_cancel_requested()
|
||||
.store(true, std::sync::atomic::Ordering::Release);
|
||||
let campaign_lock_result = state.demo_decode_replay_campaign_id().lock();
|
||||
let campaign_id = match campaign_lock_result {
|
||||
std::result::Result::Ok(active_campaign_id) => active_campaign_id.clone(),
|
||||
std::result::Result::Err(_) => std::option::Option::None,
|
||||
};
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "cancel", campaign_id = ?campaign_id, running, cancellation_requested = true, "contextual decode replay cancellation command handled");
|
||||
return running;
|
||||
}
|
||||
|
||||
/// Loads read-only decode, materialization, ledger and coverage diagnostics.
|
||||
#[tauri::command]
|
||||
async fn demo_decode_replay_diagnostics(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoDecodeDiagnosticsPayload, std::string::String> {
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "load_diagnostics", coverage_limit = 500_u32, "load contextual decode replay diagnostics");
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let table_result = store.known_table_diagnostics().await;
|
||||
let all_tables = match table_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let selected_tables: std::vec::Vec<crate::DemoSqlTableSnapshot> = all_tables
|
||||
.iter()
|
||||
.filter(|table| {
|
||||
return table.table_name.starts_with("kb_sol_decode_")
|
||||
|| table.table_name.starts_with("kb_sol_mat_")
|
||||
|| table.table_name == "kb_sol_ops_processing_ledger";
|
||||
})
|
||||
.map(crate::table_snapshot_from_pg)
|
||||
.collect();
|
||||
let coverage_result = kb_store::DecodePipelineStore::list_decode_coverage_summary(
|
||||
&store,
|
||||
std::option::Option::None,
|
||||
std::option::Option::None,
|
||||
500,
|
||||
)
|
||||
.await;
|
||||
let coverage = match coverage_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "load_diagnostics", table_count = selected_tables.len(), coverage_count = coverage.len(), "contextual decode replay diagnostics loaded");
|
||||
return std::result::Result::Ok(crate::DemoDecodeDiagnosticsPayload {
|
||||
tables: selected_tables,
|
||||
coverage: coverage.into_iter().map(crate::coverage_payload).collect(),
|
||||
});
|
||||
}
|
||||
|
||||
/// Loads a bounded journal of committed SPL Memo transaction annotations.
|
||||
#[tauri::command]
|
||||
async fn demo_decode_replay_annotations(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoTransactionAnnotationRequest,
|
||||
) -> std::result::Result<std::vec::Vec<crate::DemoTransactionAnnotationRow>, std::string::String> {
|
||||
let filter_result = kb_store::MaterializedEventFilter::new(
|
||||
std::option::Option::Some("transaction_annotations".to_string()),
|
||||
std::option::Option::Some("transaction_annotation".to_string()),
|
||||
request.signature_contains,
|
||||
request.limit,
|
||||
);
|
||||
let filter = match filter_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "load_transaction_annotations", signature_contains = ?filter.signature_contains, limit = filter.limit, "load bounded committed transaction annotation journal");
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let rows_result =
|
||||
kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await;
|
||||
let rows = match rows_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let mut output = std::vec::Vec::with_capacity(rows.len());
|
||||
for row in rows {
|
||||
let mapped = crate::annotation_payload(row);
|
||||
match mapped {
|
||||
std::result::Result::Ok(value) => output.push(value),
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
}
|
||||
}
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "load_transaction_annotations", row_count = output.len(), "bounded committed transaction annotation journal loaded");
|
||||
return std::result::Result::Ok(output);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_demo_config_window(
|
||||
@@ -217,15 +657,11 @@ fn open_demo_config_window(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn load_demo_config(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> crate::DemoConfigPayload {
|
||||
fn load_demo_config(state: tauri::State<'_, crate::AppState>) -> crate::DemoConfigPayload {
|
||||
return crate::demo_config_payload(state.inner());
|
||||
}
|
||||
|
||||
fn into_ipc_result<T>(
|
||||
result: kb_core::Result<T>,
|
||||
) -> std::result::Result<T, std::string::String> {
|
||||
fn into_ipc_result<T>(result: kb_core::Result<T>) -> std::result::Result<T, std::string::String> {
|
||||
return match result {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
@@ -244,9 +680,7 @@ fn load_project_readme() -> std::result::Result<std::string::String, std::string
|
||||
|
||||
#[tauri::command]
|
||||
fn demo_backfill_cancel(state: tauri::State<'_, crate::AppState>) -> bool {
|
||||
let running = state
|
||||
.demo_backfill_running()
|
||||
.load(std::sync::atomic::Ordering::Acquire);
|
||||
let running = state.demo_backfill_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
state
|
||||
.demo_backfill_cancel_requested()
|
||||
.store(true, std::sync::atomic::Ordering::Release);
|
||||
@@ -305,9 +739,7 @@ fn demo_backfill_options(
|
||||
default_max_pages: 20,
|
||||
default_max_concurrent_requests: 4,
|
||||
default_max_retries: 2,
|
||||
running: state
|
||||
.demo_backfill_running()
|
||||
.load(std::sync::atomic::Ordering::Acquire),
|
||||
running: state.demo_backfill_running().load(std::sync::atomic::Ordering::Acquire),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -327,9 +759,7 @@ async fn demo_backfill_execute(
|
||||
if acquire_result.is_err() {
|
||||
return std::result::Result::Err("a backfill campaign is already running".to_string());
|
||||
}
|
||||
let _run_guard = crate::DemoBackfillRunGuard {
|
||||
running: state.demo_backfill_running(),
|
||||
};
|
||||
let _run_guard = crate::DemoBackfillRunGuard { running: state.demo_backfill_running() };
|
||||
state
|
||||
.demo_backfill_cancel_requested()
|
||||
.store(false, std::sync::atomic::Ordering::Release);
|
||||
@@ -414,9 +844,7 @@ fn demo_http_list_pool_clients(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn demo_http_options(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> crate::DemoHttpOptionsPayload {
|
||||
fn demo_http_options(state: tauri::State<'_, crate::AppState>) -> crate::DemoHttpOptionsPayload {
|
||||
return crate::DemoHttpOptionsPayload {
|
||||
roles: crate::build_http_role_options(state.http_pool().snapshot()),
|
||||
methods: crate::build_http_method_options(),
|
||||
@@ -480,7 +908,10 @@ fn open_demo_ws_window(
|
||||
#[tauri::command]
|
||||
fn demo_ws_list_pool_clients(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<std::vec::Vec<kb_onchain_transport::WsPoolClientSnapshot>, std::string::String> {
|
||||
) -> std::result::Result<
|
||||
std::vec::Vec<kb_onchain_transport::WsPoolClientSnapshot>,
|
||||
std::string::String,
|
||||
> {
|
||||
let pool = match state.demo_ws_pool() {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -876,4 +1307,3 @@ async fn load_demo_sql_replay_entities(
|
||||
}
|
||||
return std::result::Result::Ok(output);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user