use bytes::Bytes;
use futures::stream::BoxStream;
pub mod blob_provision;
pub mod cache_coherence;
#[cfg(feature = "authz")]
pub mod cedar;
pub mod cert;
pub mod compat;
#[cfg(feature = "authz")]
pub mod cose;
pub mod envelope;
pub mod compute;
pub mod deploy;
pub mod error;
pub mod ipam;
#[cfg(feature = "authz")]
pub mod kernel_trust;
pub mod kv;
pub mod messaging;
pub mod migrate;
pub mod mode;
pub mod project;
pub mod sql;
pub mod time;
pub use boatramp_types::{
access, authz, blob_notify, config, cron, daemon_config, dns_managed, domain_verify, function,
gateway, geo, host, logs, matcher, predicate, route, security, site, waf, workflow,
};
pub use boatramp_types::{schema_version, SCHEMA_VERSION};
pub use error::{ConfigError, DeployError, KvError, StorageError};
pub use mode::DeploymentMode;
pub type ByteStream = BoxStream<'static, Result<Bytes, StorageError>>;
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct ObjectMeta {
pub key: String,
pub size: Option<u64>,
pub content_type: Option<String>,
pub etag: Option<String>,
}
#[derive(Debug, Clone, Default)]
pub struct PutMeta {
pub content_type: Option<String>,
}
pub struct GetObject {
pub meta: ObjectMeta,
pub body: ByteStream,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BlobChangeKind {
Created,
Modified,
Removed,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BlobChange {
pub key: String,
pub kind: BlobChangeKind,
}
pub type ChangeStream = BoxStream<'static, BlobChange>;
#[async_trait::async_trait]
pub trait Storage: Send + Sync {
async fn get(&self, key: &str) -> Result<GetObject, StorageError>;
async fn get_range(
&self,
key: &str,
offset: u64,
len: Option<u64>,
) -> Result<GetObject, StorageError>;
async fn put(
&self,
key: &str,
body: ByteStream,
meta: PutMeta,
) -> Result<ObjectMeta, StorageError>;
async fn head(&self, key: &str) -> Result<ObjectMeta, StorageError>;
async fn delete(&self, key: &str) -> Result<(), StorageError>;
async fn list(&self, prefix: &str) -> Result<Vec<ObjectMeta>, StorageError>;
fn supports_watch(&self) -> bool {
false
}
async fn watch(&self, _prefix: &str) -> Result<Option<ChangeStream>, StorageError> {
Ok(None)
}
}