Skip to main content

LocalStorage

Struct LocalStorage 

Source
pub struct LocalStorage { /* private fields */ }
Expand description

Simplified local filesystem storage implementation

Implementations§

Source§

impl LocalStorage

Source

pub fn new(config: LocalStorageConfig) -> StorageResult<Self>

Create new local storage instance

Source

pub fn builder() -> LocalStorageBuilder

Builder for local storage

Trait Implementations§

Source§

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Test storage connection
Source§

fn backend_type(&self) -> StorageBackend

Get storage backend type
Source§

fn bucket(&self) -> &str

Get bucket/container name
Source§

fn config(&self) -> &StorageConfig

Get configuration

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more