pub struct PostgresDocumentStorage { /* private fields */ }Expand description
DocumentStorage over one table of a PostgreSQL database.
Implementations§
Source§impl PostgresDocumentStorage
impl PostgresDocumentStorage
Sourcepub async fn connect(config: PostgresConfig) -> Result<Self, StorageError>
pub async fn connect(config: PostgresConfig) -> Result<Self, StorageError>
Opens a connection pool. The table need not exist yet, so this also
serves to migrate the database (see Self::pool).
§Errors
Returns StorageError::Configuration when no database URL is set or
the database cannot be reached.
Trait Implementations§
Source§impl DocumentStorage for PostgresDocumentStorage
impl DocumentStorage for PostgresDocumentStorage
Source§fn put<'a>(
&'a self,
scope: &'a DocumentScope,
name: &'a DocumentName,
document: Document,
) -> StorageFuture<'a, DocumentMetadata>
fn put<'a>( &'a self, scope: &'a DocumentScope, name: &'a DocumentName, document: Document, ) -> StorageFuture<'a, DocumentMetadata>
Stores
document as name in scope, replacing whatever was there.Source§fn head<'a>(
&'a self,
scope: &'a DocumentScope,
name: &'a DocumentName,
) -> StorageFuture<'a, DocumentMetadata>
fn head<'a>( &'a self, scope: &'a DocumentScope, name: &'a DocumentName, ) -> StorageFuture<'a, DocumentMetadata>
Reads a document’s metadata without its body. Fails with
StorageError::NotFound when the scope holds no document of that
name.Source§fn get<'a>(
&'a self,
scope: &'a DocumentScope,
name: &'a DocumentName,
) -> StorageFuture<'a, StoredDocument>
fn get<'a>( &'a self, scope: &'a DocumentScope, name: &'a DocumentName, ) -> StorageFuture<'a, StoredDocument>
Reads a document, streaming its body. Fails with
StorageError::NotFound when the scope holds no document of that
name.Source§fn delete<'a>(
&'a self,
scope: &'a DocumentScope,
name: &'a DocumentName,
) -> StorageFuture<'a, ()>
fn delete<'a>( &'a self, scope: &'a DocumentScope, name: &'a DocumentName, ) -> StorageFuture<'a, ()>
Deletes the document. Deleting a missing document succeeds.
Source§fn list<'a>(
&'a self,
scope: &'a DocumentScope,
request: ListRequest,
) -> StorageFuture<'a, ListPage>
fn list<'a>( &'a self, scope: &'a DocumentScope, request: ListRequest, ) -> StorageFuture<'a, ListPage>
Lists the documents of
scope one page at a time, in name order. Pass
the returned token back to fetch the next page.Source§fn scopes(&self) -> StorageFuture<'_, Vec<DocumentScope>>
fn scopes(&self) -> StorageFuture<'_, Vec<DocumentScope>>
Every scope the store holds a document for. The one call that looks
across tenants and projects, for maintenance such as the orphan sweep,
which needs the scopes of projects that no longer exist.
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresDocumentStorage
impl !UnwindSafe for PostgresDocumentStorage
impl Freeze for PostgresDocumentStorage
impl Send for PostgresDocumentStorage
impl Sync for PostgresDocumentStorage
impl Unpin for PostgresDocumentStorage
impl UnsafeUnpin for PostgresDocumentStorage
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