active_storage/drivers/
mod.rs1use std::{path::Path, time::SystemTime};
7
8use dyn_clone::DynClone;
9
10use crate::errors::{DriverError, DriverResult};
11
12#[cfg(feature = "disk")]
13pub mod disk;
14
15#[cfg(feature = "inmem")]
16pub mod inmem;
17
18#[cfg(feature = "aws_s3")]
19pub mod aws_s3;
20
21#[async_trait::async_trait]
22pub trait Driver: DynClone + Sync + Send {
23 async fn read(&self, path: &Path) -> DriverResult<Vec<u8>>;
24
25 async fn file_exists(&self, path: &Path) -> DriverResult<bool>;
26
27 async fn write(&self, path: &Path, content: Vec<u8>) -> DriverResult<()>;
28
29 async fn delete(&self, path: &Path) -> DriverResult<()>;
30
31 async fn delete_directory(&self, path: &Path) -> DriverResult<()>;
32
33 async fn last_modified(&self, path: &Path) -> DriverResult<SystemTime>;
34}