use async_trait::async_trait;
use crate::Result;
#[derive(Debug, Clone)]
pub struct StagingItem {
pub id: String,
pub queue_name: String,
pub payload: serde_json::Value,
}
#[async_trait]
pub trait StagingFlusher: Send + Sync {
async fn ensure_partitions(&self, ahead_count: u32) -> Result<()>;
async fn list_sealed_partitions(
&self,
cutoff: time::OffsetDateTime,
) -> Result<Vec<String>>;
async fn flush_partition(&self, partition_name: &str) -> Result<Vec<StagingItem>>;
async fn list_orphaned_partitions(&self) -> Result<Vec<String>>;
async fn recover_orphaned_partition(
&self,
partition_name: &str,
) -> Result<Vec<StagingItem>>;
async fn depth(&self, queue_name: &str) -> Result<i64>;
}