Skip to main content

DocumentStorage

Trait DocumentStorage 

Source
pub trait DocumentStorage: Send + Sync {
    // Required methods
    fn put<'a>(
        &'a self,
        key: &'a DocumentKey,
        document: Document,
    ) -> StorageFuture<'a, DocumentMetadata>;
    fn head<'a>(
        &'a self,
        key: &'a DocumentKey,
    ) -> StorageFuture<'a, DocumentMetadata>;
    fn get<'a>(
        &'a self,
        key: &'a DocumentKey,
    ) -> StorageFuture<'a, StoredDocument>;
    fn delete<'a>(&'a self, key: &'a DocumentKey) -> StorageFuture<'a, ()>;
    fn list(&self, request: ListRequest) -> StorageFuture<'_, ListPage>;
}
Expand description

Object storage for document bodies, keyed by DocumentKey.

An implementation wraps one bucket (or container) and is shared across tasks behind an Arc. Keys are opaque to callers: how they map onto the backend, including any deployment-wide prefix, is the backend’s concern.

Required Methods§

Source

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>

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>

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, ()>

Deletes the document under key. Deleting a missing document succeeds.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§