use crate::protocol::BlobDescriptor;
pub trait BlobClient {
type Address: Send + Sync;
fn upload(
&self,
addr: &Self::Address,
data: &[u8],
content_type: &str,
) -> impl std::future::Future<Output = Result<BlobDescriptor, String>> + Send;
fn download(
&self,
addr: &Self::Address,
sha256: &str,
) -> impl std::future::Future<Output = Result<Vec<u8>, String>> + Send;
fn exists(
&self,
addr: &Self::Address,
sha256: &str,
) -> impl std::future::Future<Output = Result<bool, String>> + Send;
fn delete(
&self,
addr: &Self::Address,
sha256: &str,
) -> impl std::future::Future<Output = Result<bool, String>> + Send;
fn list(
&self,
addr: &Self::Address,
pubkey: &str,
) -> impl std::future::Future<Output = Result<Vec<BlobDescriptor>, String>> + Send;
fn upload_file(
&self,
addr: &Self::Address,
path: &std::path::Path,
content_type: &str,
) -> impl std::future::Future<Output = Result<BlobDescriptor, String>> + Send;
}