imgproxy-rs/src/storages/disk.rs

44 lines
896 B
Rust

use std::pin::Pin;
use crate::config::DiskStorageConfig;
use async_trait::async_trait;
use tokio_stream::Stream;
use tokio_util::bytes::Bytes;
use super::Storage;
pub struct DiskStorage {
config: DiskStorageConfig,
}
impl DiskStorage {
pub fn new(config: DiskStorageConfig) -> Self {
Self { config }
}
}
#[async_trait]
impl Storage for DiskStorage {
async fn eligible(&self, src: String) -> bool {
false
}
async fn delete(&mut self, key: String) -> anyhow::Result<()> {
Ok(())
}
async fn retrieve(
&self,
key: String,
) -> Option<Pin<Box<dyn Stream<Item = Result<Bytes, anyhow::Error>> + Send>>> {
None
}
async fn save(
&mut self,
key: String,
stream: Pin<Box<dyn Stream<Item = Result<Bytes, anyhow::Error>> + Send>>,
) -> anyhow::Result<()> {
todo!()
}
}