Skip to main content

BlobService

Trait BlobService 

Source
pub trait BlobService:
    Send
    + Sync
    + 'static {
    type ReadStream: Stream<Item = Result<BlobChunk, Status>> + Send + 'static;

    // Required methods
    fn stat<'life0, 'async_trait>(
        &'life0 self,
        request: Request<StatBlobRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<StatBlobResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ReadBlobRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ReadStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<BlobChunk>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PutBlobResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with BlobServiceServer.

Required Associated Types§

Source

type ReadStream: Stream<Item = Result<BlobChunk, Status>> + Send + 'static

Server streaming response type for the Read method.

Required Methods§

Source

fn stat<'life0, 'async_trait>( &'life0 self, request: Request<StatBlobRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<StatBlobResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stat can be used to check for the existence of a blob, as well as gathering more data about it, like more granular chunking information or baos. Server implementations are not required to provide more granular chunking information, especially if the digest specified in StatBlobRequest is already a chunk of a blob.

Source

fn read<'life0, 'async_trait>( &'life0 self, request: Request<ReadBlobRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ReadStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read allows reading (all) data of a blob/chunk by the BLAKE3 digest of its contents. If the backend communicated more granular chunks in the Stat request, this can also be used to read chunks. This request returns a stream of BlobChunk, which is just a container for bytes. The server may split the blob data into individual BlobChunk messages streamed however it may see fit. This is mostly to keep individual messages at a manageable size, not to inform about a certain chunking potentially used internally.

Source

fn put<'life0, 'async_trait>( &'life0 self, request: Request<Streaming<BlobChunk>>, ) -> Pin<Box<dyn Future<Output = Result<Response<PutBlobResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Put uploads a Blob, by reading a stream of bytes.

The way the data is chunked up in individual BlobChunk messages sent in the stream has no effect on how the server ends up chunking blobs up, if it does at all.

Implementors§

Source§

impl<T> BlobService for GRPCBlobServiceWrapper<T>
where T: Deref<Target = dyn BlobService> + Send + Sync + 'static,

Source§

type ReadStream = Pin<Box<dyn Stream<Item = Result<BlobChunk, Status>> + Send>>