BlobService

Trait BlobService 

Source
pub trait BlobService: Sized {
    // Required methods
    async fn health_check(self, context: Context) -> BlobResult<BlobHealth>;
    async fn upload(self, context: Context, data: Vec<u8>) -> BlobResult<BlobId>;
    async fn download(
        self,
        context: Context,
        hash: BlobId,
    ) -> BlobResult<Option<Vec<u8>>>;
    async fn get_info(
        self,
        context: Context,
        hash: BlobId,
    ) -> BlobResult<Option<BlobInfo>>;
    async fn check_blobs(
        self,
        context: Context,
        hashes: Vec<BlobId>,
    ) -> BlobResult<Vec<bool>>;

    // Provided method
    fn serve(self) -> ServeBlobService<Self> { ... }
}
Expand description

Blob store service for file upload/download operations

Required Methods§

Source

async fn health_check(self, context: Context) -> BlobResult<BlobHealth>

Check if the blob store is healthy

Source

async fn upload(self, context: Context, data: Vec<u8>) -> BlobResult<BlobId>

Upload a blob and return its hash

Source

async fn download( self, context: Context, hash: BlobId, ) -> BlobResult<Option<Vec<u8>>>

Download a blob by its hash

Source

async fn get_info( self, context: Context, hash: BlobId, ) -> BlobResult<Option<BlobInfo>>

Get information about a blob

Source

async fn check_blobs( self, context: Context, hashes: Vec<BlobId>, ) -> BlobResult<Vec<bool>>

Check which blobs the server already has stored. Returns a vec of bool in the same order as the input, where:

  • true means the server has the blob stored
  • false means the server doesn’t have this blob yet

Provided Methods§

Source

fn serve(self) -> ServeBlobService<Self>

Returns a serving function to use with InFlightRequest::execute.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§