use alloc::vec::Vec;
use crate::blob_store::types::{BlobId, BlobMeta, CausalEdge, TemporalKey};
pub trait BlobQueryProvider {
type Error: Into<crate::StorageError>;
fn get_blob_meta(&self, blob_id: &BlobId) -> Result<Option<BlobMeta>, Self::Error>;
fn blob_by_sequence(&self, seq: u64) -> Result<Option<(BlobId, BlobMeta)>, Self::Error>;
fn blobs_in_time_range(
&self,
start_ns: u64,
end_ns: u64,
) -> Result<Vec<(TemporalKey, BlobMeta)>, Self::Error>;
fn blobs_in_namespace(&self, namespace: &str) -> Result<Vec<(BlobId, BlobMeta)>, Self::Error>;
fn blobs_by_tag(&self, tag: &str) -> Result<Vec<BlobId>, Self::Error>;
fn causal_children(&self, blob_id: &BlobId) -> Result<Vec<CausalEdge>, Self::Error>;
}
impl BlobQueryProvider for crate::transactions::ReadTransaction {
type Error = crate::StorageError;
fn get_blob_meta(&self, blob_id: &BlobId) -> Result<Option<BlobMeta>, Self::Error> {
self.get_blob_meta(blob_id)
}
fn blob_by_sequence(&self, seq: u64) -> Result<Option<(BlobId, BlobMeta)>, Self::Error> {
self.blob_by_sequence(seq)
}
fn blobs_in_time_range(
&self,
start_ns: u64,
end_ns: u64,
) -> Result<Vec<(TemporalKey, BlobMeta)>, Self::Error> {
self.blobs_in_time_range(start_ns, end_ns)
}
fn blobs_in_namespace(&self, namespace: &str) -> Result<Vec<(BlobId, BlobMeta)>, Self::Error> {
self.blobs_in_namespace(namespace)
}
fn blobs_by_tag(&self, tag: &str) -> Result<Vec<BlobId>, Self::Error> {
self.blobs_by_tag(tag)
}
fn causal_children(&self, blob_id: &BlobId) -> Result<Vec<CausalEdge>, Self::Error> {
self.causal_children(blob_id)
}
}