go_zoom_kinesis/store/
mod.rsuse async_trait::async_trait;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use tokio::time::Duration;
pub mod dynamodb;
pub mod memory;
#[async_trait]
pub trait CheckpointStore: Send + Sync {
async fn get_checkpoint(&self, shard_id: &str) -> anyhow::Result<Option<String>>;
async fn save_checkpoint(&self, shard_id: &str, sequence_number: &str) -> anyhow::Result<()>;
}
pub trait CheckpointStoreTestExt: CheckpointStore {
fn timeout(&self) -> Duration {
Duration::from_secs(5)
}
fn get_all_checkpoints(
&self,
) -> impl std::future::Future<Output = anyhow::Result<HashMap<String, String>>> + Send {
async {
Ok(HashMap::new()) }
}
}
impl<T: CheckpointStore> CheckpointStoreTestExt for T {}
pub use dynamodb::DynamoDbCheckpointStore;
pub use memory::InMemoryCheckpointStore;