v0.3.15-pre.007
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// file: crates/ksp-app-raw-transaction-ingest-desk/src/dto_route.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Safe route-identity, Config-composability and lifecycle DTOs for Raw Transaction Ingest Desk.
|
||||
|
||||
use ts_rs::TS; // rust-rules: trait-import
|
||||
|
||||
/// Stable logical V1 route identifiers owned by Raw Transaction Ingest Desk.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_route/RawIngestRouteId.ts")]
|
||||
pub(crate) enum RawIngestRouteId {
|
||||
@@ -26,7 +26,13 @@ impl crate::RawIngestRouteId {
|
||||
/// Returns all V1 route identifiers in stable UI order.
|
||||
#[must_use]
|
||||
pub(crate) fn all() -> std::vec::Vec<Self> {
|
||||
return vec![Self::YellowstoneHydrated, Self::StandardLogsHydrated, Self::StandardBlockDirect, Self::HeliusTransactionHydrated, Self::HttpBlockPolling];
|
||||
return vec![
|
||||
Self::YellowstoneHydrated,
|
||||
Self::StandardLogsHydrated,
|
||||
Self::StandardBlockDirect,
|
||||
Self::HeliusTransactionHydrated,
|
||||
Self::HttpBlockPolling,
|
||||
];
|
||||
}
|
||||
|
||||
/// Returns the application-owned route family used by safe UI projections.
|
||||
@@ -52,6 +58,81 @@ impl crate::RawIngestRouteId {
|
||||
Self::HttpBlockPolling => "HTTP Block Polling",
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the stable kebab-case route identifier used by safe logs and IPC.
|
||||
#[must_use]
|
||||
pub(crate) const fn as_str(self) -> &'static str {
|
||||
return match self {
|
||||
Self::YellowstoneHydrated => "yellowstone-hydrated",
|
||||
Self::StandardLogsHydrated => "standard-logs-hydrated",
|
||||
Self::StandardBlockDirect => "standard-block-direct",
|
||||
Self::HeliusTransactionHydrated => "helius-transaction-hydrated",
|
||||
Self::HttpBlockPolling => "http-block-polling",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Start-time commitments accepted by Raw Transaction Ingest Desk.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_route/RawIngestCommitment.ts")]
|
||||
pub(crate) enum RawIngestCommitment {
|
||||
/// Confirmed commitment.
|
||||
Confirmed,
|
||||
/// Finalized commitment.
|
||||
Finalized,
|
||||
}
|
||||
|
||||
impl crate::RawIngestCommitment {
|
||||
/// Returns the stable wire label.
|
||||
#[must_use]
|
||||
pub(crate) const fn as_str(self) -> &'static str {
|
||||
return match self {
|
||||
Self::Confirmed => "confirmed",
|
||||
Self::Finalized => "finalized",
|
||||
};
|
||||
}
|
||||
|
||||
/// Maps the application-owned bounded commitment into the Transport contract.
|
||||
#[must_use]
|
||||
pub(crate) const fn into_transport(self) -> ksp_onchain_transport_lib::SolanaCommitment {
|
||||
return match self {
|
||||
Self::Confirmed => ksp_onchain_transport_lib::SolanaCommitment::Confirmed,
|
||||
Self::Finalized => ksp_onchain_transport_lib::SolanaCommitment::Finalized,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Safe request used to revalidate and reconstruct one future route Start without accepting physical resources from the frontend.
|
||||
#[derive(Clone, Debug, serde::Deserialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_route/RawIngestRouteStartRequestDto.ts")]
|
||||
pub(crate) struct RawIngestRouteStartRequestDto {
|
||||
/// Confirmed/finalized commitment selected for the future Worker.
|
||||
pub(crate) commitment: crate::RawIngestCommitment,
|
||||
/// Inventory generation observed by the caller.
|
||||
pub(crate) inventory_generation: u32,
|
||||
/// Safe logical network-profile identifier selected from the current inventory.
|
||||
pub(crate) profile_id: String,
|
||||
/// Stable logical route identifier.
|
||||
pub(crate) route_id: crate::RawIngestRouteId,
|
||||
}
|
||||
|
||||
/// Safe acknowledgement that exact Start-time Transport resources were reconstructed and validated without Worker launch.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_route/RawIngestRouteStartValidationDto.ts")]
|
||||
pub(crate) struct RawIngestRouteStartValidationDto {
|
||||
/// Commitment validated by the exact Worker source constructor.
|
||||
pub(crate) commitment: crate::RawIngestCommitment,
|
||||
/// Inventory generation validated against backend state.
|
||||
pub(crate) inventory_generation: u32,
|
||||
/// Logical network re-proven from Store and Transport Config.
|
||||
pub(crate) network: String,
|
||||
/// Safe logical network-profile identifier.
|
||||
pub(crate) profile_id: String,
|
||||
/// Exact logical route whose Transport resources were reconstructed.
|
||||
pub(crate) route_id: crate::RawIngestRouteId,
|
||||
}
|
||||
|
||||
/// Stable application-owned route families used only for safe presentation and orchestration.
|
||||
@@ -182,7 +263,11 @@ impl crate::RawIngestRouteDto {
|
||||
|
||||
/// Builds one route that is not composable from the current Config profile.
|
||||
#[must_use]
|
||||
pub(crate) fn unavailable(route_id: crate::RawIngestRouteId, network: std::option::Option<&str>, reason: crate::RawIngestRouteUnavailableReason) -> Self {
|
||||
pub(crate) fn unavailable(
|
||||
route_id: crate::RawIngestRouteId,
|
||||
network: std::option::Option<&str>,
|
||||
reason: crate::RawIngestRouteUnavailableReason,
|
||||
) -> Self {
|
||||
return Self {
|
||||
family: route_id.family(),
|
||||
label: route_id.label().to_owned(),
|
||||
|
||||
Reference in New Issue
Block a user