use async_trait::async_trait;
use chrono::{DateTime, Utc};
use crate::StoreError;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PackageRecord {
pub workflow_type: String,
pub content_hash: String,
pub archive: Vec<u8>,
pub deployed_at: DateTime<Utc>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PackageRouteRecord {
pub workflow_type: String,
pub content_hash: String,
}
#[async_trait]
pub trait PackageStore: Send + Sync + 'static {
async fn put_package(&self, record: PackageRecord) -> Result<(), StoreError>;
async fn list_packages(&self) -> Result<Vec<PackageRecord>, StoreError>;
async fn delete_package(
&self,
workflow_type: &str,
content_hash: &str,
) -> Result<(), StoreError>;
async fn put_package_route(
&self,
workflow_type: &str,
content_hash: &str,
) -> Result<(), StoreError>;
async fn list_package_routes(&self) -> Result<Vec<PackageRouteRecord>, StoreError>;
}