pub struct GcsDocumentStorage { /* private fields */ }Expand description
DocumentStorage over one Google Cloud Storage bucket.
Implementations§
Source§impl GcsDocumentStorage
impl GcsDocumentStorage
Sourcepub async fn connect(config: GcsConfig) -> Result<Self, StorageError>
pub async fn connect(config: GcsConfig) -> Result<Self, StorageError>
Builds the client and obtains a first access token, so rejected credentials fail here rather than on the first document.
§Errors
Returns StorageError::Configuration for an unusable configuration or
credentials file, and StorageError::Unauthorized when the token
endpoint rejects the credentials.
Trait Implementations§
Source§impl DocumentStorage for GcsDocumentStorage
impl DocumentStorage for GcsDocumentStorage
Source§fn put<'a>(
&'a self,
key: &'a DocumentKey,
document: Document,
) -> StorageFuture<'a, DocumentMetadata>
fn put<'a>( &'a self, key: &'a DocumentKey, document: Document, ) -> StorageFuture<'a, DocumentMetadata>
Stores
document under key, replacing whatever was there.Source§fn head<'a>(
&'a self,
key: &'a DocumentKey,
) -> StorageFuture<'a, DocumentMetadata>
fn head<'a>( &'a self, key: &'a DocumentKey, ) -> StorageFuture<'a, DocumentMetadata>
Reads a document’s metadata without its body.
Fails with
StorageError::NotFound when nothing is stored under key.Source§fn get<'a>(&'a self, key: &'a DocumentKey) -> StorageFuture<'a, StoredDocument>
fn get<'a>(&'a self, key: &'a DocumentKey) -> StorageFuture<'a, StoredDocument>
Reads a document, streaming its body.
Fails with
StorageError::NotFound when nothing is stored under key.Source§fn delete<'a>(&'a self, key: &'a DocumentKey) -> StorageFuture<'a, ()>
fn delete<'a>(&'a self, key: &'a DocumentKey) -> StorageFuture<'a, ()>
Deletes the document under
key. Deleting a missing document succeeds.Source§fn list(&self, request: ListRequest) -> StorageFuture<'_, ListPage>
fn list(&self, request: ListRequest) -> StorageFuture<'_, ListPage>
Lists documents whose keys start with the request’s prefix, one page at
a time; pass the returned token back to fetch the next page.
Auto Trait Implementations§
impl !Freeze for GcsDocumentStorage
impl !RefUnwindSafe for GcsDocumentStorage
impl !UnwindSafe for GcsDocumentStorage
impl Send for GcsDocumentStorage
impl Sync for GcsDocumentStorage
impl Unpin for GcsDocumentStorage
impl UnsafeUnpin for GcsDocumentStorage
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more