pub struct LocalStorage { /* private fields */ }Expand description
Simplified local filesystem storage implementation
Implementations§
Source§impl LocalStorage
impl LocalStorage
Sourcepub fn new(config: LocalStorageConfig) -> StorageResult<Self>
pub fn new(config: LocalStorageConfig) -> StorageResult<Self>
Create new local storage instance
Sourcepub fn builder() -> LocalStorageBuilder
pub fn builder() -> LocalStorageBuilder
Builder for local storage
Trait Implementations§
Source§impl StorageService for LocalStorage
impl StorageService for LocalStorage
Source§fn upload_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: Bytes,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: Bytes,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a file from bytes
Source§fn upload_reader<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
reader: Box<dyn AsyncRead + Send + Unpin>,
size: Option<u64>,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upload_reader<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
reader: Box<dyn AsyncRead + Send + Unpin>,
size: Option<u64>,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upload a file from a reader
Source§fn upload_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upload_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
options: Option<UploadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload a file from local path
Source§fn download_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a file to bytes
Source§fn download_writer<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
writer: Box<dyn AsyncWrite + Send + Unpin>,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_writer<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
writer: Box<dyn AsyncWrite + Send + Unpin>,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a file to a writer
Source§fn download_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
local_path: &'life2 str,
_options: Option<DownloadOptions>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Download a file to local path
Source§fn stream_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Stream<Item = StorageResult<Bytes>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_range: Option<ByteRange>,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Stream<Item = StorageResult<Bytes>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream a file (useful for large files)
Source§fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file metadata
Source§fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if file exists
Source§fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file
Source§fn copy_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn copy_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copy a file
Source§fn move_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn move_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_path: &'life1 str,
to_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Move a file
Source§fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<u32>,
continuation_token: Option<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<FileListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<u32>,
continuation_token: Option<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<FileListResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files in a directory/prefix
Source§fn generate_presigned_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: PresignedUrlOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_presigned_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
options: PresignedUrlOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate presigned URL for file operations
Source§fn get_file_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_expiry_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_file_url<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_expiry_seconds: Option<u64>,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file URL (public access or presigned)
Source§fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
_metadata: HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update file metadata
Source§fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get storage statistics
Source§fn test_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn test_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Test storage connection
Source§fn backend_type(&self) -> StorageBackend
fn backend_type(&self) -> StorageBackend
Get storage backend type
Source§fn config(&self) -> &StorageConfig
fn config(&self) -> &StorageConfig
Get configuration
Auto Trait Implementations§
impl Freeze for LocalStorage
impl RefUnwindSafe for LocalStorage
impl Send for LocalStorage
impl Sync for LocalStorage
impl Unpin for LocalStorage
impl UnsafeUnpin for LocalStorage
impl UnwindSafe for LocalStorage
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