pub mod disk; use super::Result; use crate::server::blobref::BlobRef; pub fn factory<'a, T: StorageBackend>(config: &T::Config) -> impl Fn(&'a str) -> T + '_ { |bucket: &str| T::new(bucket, config) } pub trait StorageBackend: Iterator { type Config; fn new(bucket: &str, config: &Self::Config) -> Self; fn put(&self, data: &[u8]) -> Result; fn get(&self, blobref: &BlobRef) -> Result>>; fn exists(&self, blobref: &BlobRef) -> bool { if let Ok(Some(_)) = self.get(blobref) { return true; } false } }