pub trait StorageService: Send + Sync {
type Error;
// Required methods
fn name(&self) -> Cow<'static, str>
where Self: Sized;
fn open<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
fn blob<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
fn blobs<'life0, 'async_trait, P>(
&'life0 self,
path: Option<P>,
options: Option<ListBlobsRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
fn delete<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
fn exists<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
fn upload<'life0, 'async_trait, P>(
&'life0 self,
path: P,
options: UploadRequest,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
P: 'async_trait + AsRef<Path> + Send,
'life0: 'async_trait;
// Provided method
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A storage service is a base primitive of remi-rs: it is the way to interact
with the storage providers in ways that you would commonly use files: open, deleting,
listing, etc.
Required Associated Types§
Required Methods§
Sourcefn name(&self) -> Cow<'static, str>where
Self: Sized,
fn name(&self) -> Cow<'static, str>where
Self: Sized,
Returns the name of the storage service.
- since 0.1.0
Sourcefn open<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Self::Error>> + Send + 'async_trait>>
fn open<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Self::Error>> + Send + 'async_trait>>
Opens a file in the specified path and returns the contents as Bytes if it existed, otherwise
None will be returned to indicate that file doesn’t exist.
- since 0.1.0
Sourcefn blob<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, Self::Error>> + Send + 'async_trait>>
fn blob<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<Option<Blob>, Self::Error>> + Send + 'async_trait>>
Open a file in the given path and returns a Blob structure if the path existed, otherwise
None will be returned to indiciate that a file doesn’t exist.
- since 0.1.0
Sourcefn blobs<'life0, 'async_trait, P>(
&'life0 self,
path: Option<P>,
options: Option<ListBlobsRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>, Self::Error>> + 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>, Self::Error>> + Send + 'async_trait>>
Sourcefn delete<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
fn delete<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 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.
- since 0.1.0
Sourcefn exists<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
fn exists<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
Checks the existence of the file by the specified path.
- since: 0.1.0
Provided Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Optionally initialize this StorageService if it requires initialization,
like creating a directory if it doesn’t exist.
- since 0.1.0