use std::{future::Future, pin::Pin};
use crate::{ReconstructionCacheError, ReconstructionCacheKey};
pub type ReconstructionCacheFuture<'operation, T> =
Pin<Box<dyn Future<Output = Result<T, ReconstructionCacheError>> + Send + 'operation>>;
pub trait AsyncReconstructionCache: Send + Sync {
fn ready(&self) -> ReconstructionCacheFuture<'_, ()>;
fn get<'operation>(
&'operation self,
key: &'operation ReconstructionCacheKey,
) -> ReconstructionCacheFuture<'operation, Option<Vec<u8>>>;
fn put<'operation>(
&'operation self,
key: &'operation ReconstructionCacheKey,
payload: &'operation [u8],
) -> ReconstructionCacheFuture<'operation, ()>;
fn delete<'operation>(
&'operation self,
key: &'operation ReconstructionCacheKey,
) -> ReconstructionCacheFuture<'operation, bool>;
}