Struct remi_fs::StorageService
source · pub struct StorageService { /* private fields */ }Expand description
Represents an implementation of a StorageService for the
local filesystem.
Implementations§
source§impl StorageService
impl StorageService
sourcepub fn new<P: AsRef<Path>>(path: P) -> StorageService
pub fn new<P: AsRef<Path>>(path: P) -> StorageService
Creates a new StorageService instance.
sourcepub fn with_config(config: Config) -> StorageService
pub fn with_config(config: Config) -> StorageService
Creates a new StorageService instance with a provided configuration object.
sourcepub fn with_resolver<R: ContentTypeResolver + 'static>(
self,
resolver: R
) -> StorageService
pub fn with_resolver<R: ContentTypeResolver + 'static>( self, resolver: R ) -> StorageService
Updates the given ContentTypeResolver to something else.
sourcepub fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<Option<PathBuf>>
pub fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<Option<PathBuf>>
Attempts to normalize a given path and returns a canonical, absolute path. It must follow some strict rules:
-
If the path starts with
./, then it will resolve fromConfig::directoryif the directory was found. Otherwise, it’ll use the current directory. -
If the path starts with
~/, then it will resolve from the home directory fromdirs::home_dir.
Trait Implementations§
source§impl Clone for StorageService
impl Clone for StorageService
source§fn clone(&self) -> StorageService
fn clone(&self) -> StorageService
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl StorageService for StorageService
impl StorageService for StorageService
§type Error = Error
type Error = Error
Represents a generic error to use for errors that could be emitted
when calling any function.
source§fn init<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Optionally initialize this
StorageService if it requires initialization,
like creating a directory if it doesn’t exist. Read moresource§fn open<'life0, 'async_trait, P>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>
fn open<'life0, 'async_trait, P>( &'life0 self, path: P ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>
source§fn blob<'life0, 'async_trait, P>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>>> + Send + 'async_trait>>
fn blob<'life0, 'async_trait, P>( &'life0 self, path: P ) -> Pin<Box<dyn Future<Output = Result<Option<Blob>>> + Send + 'async_trait>>
source§fn blobs<'life0, 'async_trait, P>(
&'life0 self,
path: Option<P>,
options: Option<ListBlobsRequest>
) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>>> + Send + 'async_trait>>
fn blobs<'life0, 'async_trait, P>( &'life0 self, path: Option<P>, options: Option<ListBlobsRequest> ) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>>> + Send + 'async_trait>>
source§fn delete<'life0, 'async_trait, P>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn delete<'life0, 'async_trait, P>( &'life0 self, path: P ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Deletes a file in a specified
path. At the moment, () is returned but bool might be
returned to indicate if it actually deleted itself or not. Read moresource§fn exists<'life0, 'async_trait, P>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
fn exists<'life0, 'async_trait, P>( &'life0 self, path: P ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
Checks the existence of the file by the specified path. Read more
source§fn upload<'life0, 'async_trait, P>(
&'life0 self,
path: P,
options: UploadRequest
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn upload<'life0, 'async_trait, P>( &'life0 self, path: P, options: UploadRequest ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Does a file upload where it writes the byte array as one call and does not do chunking. Use the [
StorageService::multipart_upload]
method to upload chunks by a specific size. Read moresource§fn name(&self) -> &'static str
fn name(&self) -> &'static str
👎Deprecated since 0.5.0: use Self::NAME instead of the name() function, this will be removed in 0.7.0
Returns the name of this
StorageService.source§fn find<'life0, 'async_trait, P, F>(
&'life0 self,
path: Option<P>,
options: Option<ListBlobsRequest>,
finder: F
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, Self::Error>> + Send + 'async_trait>>
fn find<'life0, 'async_trait, P, F>( &'life0 self, path: Option<P>, options: Option<ListBlobsRequest>, finder: F ) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, Self::Error>> + Send + 'async_trait>>
Attempt to find a blob from a
Blob where it returns the first blob that was found. A default
implementation is given which just queries all blobs via StorageService::blobs and uses the
find method. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for StorageService
impl Send for StorageService
impl Sync for StorageService
impl Unpin for StorageService
impl !UnwindSafe for StorageService
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