pub struct LocalStorage { /* private fields */ }Expand description
Filesystem-backed object storage.
Implementations§
Source§impl LocalStorage
impl LocalStorage
Sourcepub fn new(
root: impl Into<PathBuf>,
base_url: Url,
signing_secret: impl Into<Vec<u8>>,
) -> Self
pub fn new( root: impl Into<PathBuf>, base_url: Url, signing_secret: impl Into<Vec<u8>>, ) -> Self
Build a new local-filesystem backend.
Sourcepub fn verify_token(
&self,
method: &str,
key: &str,
expires: i64,
sig: &str,
) -> BucketResult<()>
pub fn verify_token( &self, method: &str, key: &str, expires: i64, sig: &str, ) -> BucketResult<()>
Verify a token produced by sign.
Returns Ok(()) if sig matches and expires is in the future.
Trait Implementations§
Source§impl Clone for LocalStorage
impl Clone for LocalStorage
Source§impl Debug for LocalStorage
impl Debug for LocalStorage
Source§impl ObjectStorage for LocalStorage
impl ObjectStorage for LocalStorage
Source§fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
body: Bytes,
_content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
body: Bytes,
_content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upload an object under
key with the given content type.Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download the full object body (buffered).
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the object. Idempotent: absent keys return
Ok(()).Source§fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<ObjectMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = BucketResult<ObjectMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stat the object without fetching the body.
Source§fn presigned_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn presigned_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Short-lived signed URL for direct GET. Read more
Source§fn presigned_put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
_content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn presigned_put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
_content_type: &'life2 str,
) -> Pin<Box<dyn Future<Output = BucketResult<Url>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Short-lived signed URL for direct PUT (browser direct-upload flow).
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.