0.3.17-pre.002
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-store-api/tests/external_backend.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! External-implementation canary for object-safe Store API capabilities.
|
||||
|
||||
@@ -215,6 +215,81 @@ impl ksp_store_api::RawTransactionRetentionWrite for ExternalMemoryBackend {
|
||||
}
|
||||
}
|
||||
|
||||
impl ksp_store_api::RawTransactionVariantInspectionRead for ExternalMemoryBackend {
|
||||
fn inspect_raw_transaction_variants<'a>(
|
||||
&'a self,
|
||||
query: &'a ksp_store_api::RawTransactionVariantInspectionQuery,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<ksp_store_api::RawInspectionPage<ksp_store_api::RawTransactionVariantSummary>>> {
|
||||
let _ = query;
|
||||
return std::boxed::Box::pin(async {
|
||||
return ksp_store_api::RawInspectionPage::try_new(std::vec::Vec::new(), 0, 0);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_raw_transaction_variant<'a>(
|
||||
&'a self,
|
||||
reference: &'a ksp_store_api::RawTransactionVariantReference,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<std::option::Option<ksp_store_api::RawTransactionVariantDetail>>> {
|
||||
let _ = reference;
|
||||
return std::boxed::Box::pin(async {
|
||||
return std::result::Result::Ok(std::option::Option::None);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ksp_store_api::RawTransactionConflictInspectionRead for ExternalMemoryBackend {
|
||||
fn inspect_raw_transaction_conflicts<'a>(
|
||||
&'a self,
|
||||
query: &'a ksp_store_api::RawTransactionConflictInspectionQuery,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<ksp_store_api::RawInspectionPage<ksp_store_api::RawTransactionConflictSummary>>> {
|
||||
let _ = query;
|
||||
return std::boxed::Box::pin(async {
|
||||
return ksp_store_api::RawInspectionPage::try_new(std::vec::Vec::new(), 0, 0);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_raw_transaction_conflict<'a>(
|
||||
&'a self,
|
||||
reference: &'a ksp_store_api::RawTransactionConflictReference,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<std::option::Option<ksp_store_api::RawTransactionConflictDetail>>> {
|
||||
let _ = reference;
|
||||
return std::boxed::Box::pin(async {
|
||||
return std::result::Result::Ok(std::option::Option::None);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ksp_store_api::RawTransactionConflictHistoryRead for ExternalMemoryBackend {
|
||||
fn inspect_raw_transaction_conflict_history<'a>(
|
||||
&'a self,
|
||||
query: &'a ksp_store_api::RawTransactionConflictHistoryQuery,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<ksp_store_api::RawInspectionPage<ksp_store_api::RawTransactionConflictEventSummary>>> {
|
||||
let _ = query;
|
||||
return std::boxed::Box::pin(async {
|
||||
return ksp_store_api::RawInspectionPage::try_new(std::vec::Vec::new(), 0, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ksp_store_api::RawTransactionConflictActionWrite for ExternalMemoryBackend {
|
||||
fn apply_raw_transaction_conflict_action<'a>(
|
||||
&'a self,
|
||||
request: ksp_store_api::RawTransactionConflictActionRequest,
|
||||
) -> ksp_store_api::StoreApiFuture<'a, ksp_store_api::Result<ksp_store_api::RawTransactionConflictActionOutcome>> {
|
||||
let _ = request;
|
||||
return std::boxed::Box::pin(async {
|
||||
return std::result::Result::Ok(ksp_store_api::RawTransactionConflictActionOutcome::Applied);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ksp_store_api::StoreErrorClassifier for ExternalMemoryBackend {
|
||||
fn classify_store_error(&self, error: &ksp_store_api::Error) -> ksp_store_api::StoreErrorClass {
|
||||
let _ = error;
|
||||
return ksp_store_api::StoreErrorClass::Terminal;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn v0_3_8_pre_003_external_backend_implements_canonical_and_inspection_capabilities_without_runtime_crate() {
|
||||
let backend = ExternalMemoryBackend;
|
||||
@@ -232,6 +307,11 @@ fn v0_3_8_pre_003_external_backend_implements_canonical_and_inspection_capabilit
|
||||
let account_observation_write: &dyn ksp_store_api::RawAccountObservationWrite = &backend;
|
||||
let retention_read: &dyn ksp_store_api::RawTransactionRetentionRead = &backend;
|
||||
let retention_write: &dyn ksp_store_api::RawTransactionRetentionWrite = &backend;
|
||||
let variant_inspection: &dyn ksp_store_api::RawTransactionVariantInspectionRead = &backend;
|
||||
let conflict_inspection: &dyn ksp_store_api::RawTransactionConflictInspectionRead = &backend;
|
||||
let conflict_history: &dyn ksp_store_api::RawTransactionConflictHistoryRead = &backend;
|
||||
let conflict_action: &dyn ksp_store_api::RawTransactionConflictActionWrite = &backend;
|
||||
let error_classifier: &dyn ksp_store_api::StoreErrorClassifier = &backend;
|
||||
let _ = transaction_read;
|
||||
let _ = transaction_write;
|
||||
let _ = transaction_inspection;
|
||||
@@ -246,5 +326,10 @@ fn v0_3_8_pre_003_external_backend_implements_canonical_and_inspection_capabilit
|
||||
let _ = account_observation_write;
|
||||
let _ = retention_read;
|
||||
let _ = retention_write;
|
||||
let _ = variant_inspection;
|
||||
let _ = conflict_inspection;
|
||||
let _ = conflict_history;
|
||||
let _ = conflict_action;
|
||||
let _ = error_classifier;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user