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§
Sourceasync fn health_check(self, context: Context) -> BlobResult<BlobHealth>
async fn health_check(self, context: Context) -> BlobResult<BlobHealth>
Check if the blob store is healthy
Sourceasync fn upload(self, context: Context, data: Vec<u8>) -> BlobResult<BlobId>
async fn upload(self, context: Context, data: Vec<u8>) -> BlobResult<BlobId>
Upload a blob and return its hash
Sourceasync fn download(
self,
context: Context,
hash: BlobId,
) -> BlobResult<Option<Vec<u8>>>
async fn download( self, context: Context, hash: BlobId, ) -> BlobResult<Option<Vec<u8>>>
Download a blob by its hash
Sourceasync fn get_info(
self,
context: Context,
hash: BlobId,
) -> BlobResult<Option<BlobInfo>>
async fn get_info( self, context: Context, hash: BlobId, ) -> BlobResult<Option<BlobInfo>>
Get information about a blob
Sourceasync fn check_blobs(
self,
context: Context,
hashes: Vec<BlobId>,
) -> BlobResult<Vec<bool>>
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:
truemeans the server has the blob storedfalsemeans the server doesn’t have this blob yet
Provided Methods§
Sourcefn serve(self) -> ServeBlobService<Self>
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.