Files
khadhroony-solana-project/crates/ksp-store-api/src/capability.rs
2026-09-24 10:55:34 +02:00

30 lines
1.3 KiB
Rust

// file: crates/ksp-store-api/src/capability.rs
// version: 4
//! Private home for backend-agnostic Store capability contracts.
//!
//! Capabilities are split by persistent family and operation direction so a
//! backend can implement only the contracts it actually supports. The runtime
//! Store facade, backend selection and concrete database implementations remain
//! outside `ksp-store-api`.
pub(crate) mod raw_account;
pub(crate) mod raw_conflict;
pub(crate) mod raw_retention;
pub(crate) mod raw_transaction;
/// Boxed async operation returned by object-safe Store capability contracts.
///
/// The alias uses only standard-library primitives so backend implementations
/// need no async helper dependency merely to implement `ksp-store-api`.
pub type StoreApiFuture<'a, T> = std::pin::Pin<std::boxed::Box<dyn std::future::Future<Output = T> + std::marker::Send + 'a>>;
/// Backend-neutral classifier for errors crossing a Store capability boundary.
///
/// Implementations must classify from structured KSP error state. Consumers such
/// as Workers must not infer retryability by matching backend-specific strings.
pub trait StoreErrorClassifier: std::marker::Send + std::marker::Sync {
/// Classifies one already-redacted Store error as retryable/transient or terminal.
fn classify_store_error(&self, error: &crate::Error) -> crate::StoreErrorClass;
}