Trait remi::StorageService
source · pub trait StorageService: Send + Sync {
type Error;
const NAME: &'static str;
// Required methods
fn open<'life0, 'async_trait, P>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Self::Error>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'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 P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'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 P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'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 P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'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 P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'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 P: 'async_trait + AsRef<Path> + Send,
Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn init<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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>>
where P: 'async_trait + AsRef<Path> + Send,
F: 'async_trait + FnMut(&Blob) -> bool + Send,
Self: '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 Associated Constants§
Required Methods§
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
sourcefn upload<'life0, 'async_trait, P>(
&'life0 self,
path: P,
options: UploadRequest
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + '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>>
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.
- 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: '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: '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
sourcefn 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.
- since: 0.6.0