Skip to main content

ImageStore

Trait ImageStore 

Source
pub trait ImageStore: Send + Sync {
    // Required methods
    fn put_image(
        &self,
        print_id: PrintId,
        event_id: EventId,
        source_url: Option<String>,
        content_type: String,
        bytes: RawBytes,
    ) -> BoxFuture<'_, Result<ImageRecord, StoreError>>;
    fn image(
        &self,
        image_id: ImageId,
    ) -> BoxFuture<'_, Result<ImageLookup, StoreError>>;
}
Expand description

The images stored beside events.

Every method is asynchronous, the trait is dyn-compatible, and it is shareable across threads, because its consumers hold it behind Arc<dyn ImageStore>.

Required Methods§

Source

fn put_image( &self, print_id: PrintId, event_id: EventId, source_url: Option<String>, content_type: String, bytes: RawBytes, ) -> BoxFuture<'_, Result<ImageRecord, StoreError>>

Store one image’s bytes, minting its identifier.

Source

fn image( &self, image_id: ImageId, ) -> BoxFuture<'_, Result<ImageLookup, StoreError>>

Read one image by its identifier.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§