use std::path::Path;
use async_trait::async_trait;
use bytes::Bytes;
use super::{GetResponse, StorageResult, StoreDriver, UploadResponse};
use crate::storage::StorageError;
pub struct NullStorage {}
#[must_use]
pub fn new() -> Box<dyn StoreDriver> {
Box::new(NullStorage {})
}
#[async_trait]
impl StoreDriver for NullStorage {
async fn upload(&self, _path: &Path, _content: &Bytes) -> StorageResult<UploadResponse> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
async fn get(&self, _path: &Path) -> StorageResult<GetResponse> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
async fn delete(&self, _path: &Path) -> StorageResult<()> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
async fn rename(&self, _from: &Path, _to: &Path) -> StorageResult<()> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
async fn copy(&self, _from: &Path, _to: &Path) -> StorageResult<()> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
async fn exists(&self, _path: &Path) -> StorageResult<bool> {
Err(StorageError::Any(
"Operation not supported by null storage".into(),
))
}
}