pub struct LocalDriver { /* private fields */ }Expand description
Local disk storage driver supporting path traversal protection
Implementations§
Source§impl LocalDriver
impl LocalDriver
Sourcepub async fn put(&self, path: &str, bytes: &[u8]) -> Result<(), StorageError>
pub async fn put(&self, path: &str, bytes: &[u8]) -> Result<(), StorageError>
Put binary payload to target path.
The bytes are written to a unique temporary file in the destination directory, flushed to disk and renamed over the destination. Readers and concurrent writers observe one complete version; a failed write leaves the previous object untouched.
Sourcepub async fn exists(&self, path: &str) -> Result<bool, StorageError>
pub async fn exists(&self, path: &str) -> Result<bool, StorageError>
Check if target path exists
Sourcepub async fn get(&self, path: &str) -> Result<Vec<u8>, StorageError>
pub async fn get(&self, path: &str) -> Result<Vec<u8>, StorageError>
Retrieve binary payload from target path
Trait Implementations§
Source§impl Clone for LocalDriver
impl Clone for LocalDriver
Auto Trait Implementations§
impl Freeze for LocalDriver
impl RefUnwindSafe for LocalDriver
impl Send for LocalDriver
impl Sync for LocalDriver
impl Unpin for LocalDriver
impl UnsafeUnpin for LocalDriver
impl UnwindSafe for LocalDriver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more