Skip to main content

BlobAdapter

Trait BlobAdapter 

Source
pub trait BlobAdapter:
    Debug
    + Send
    + Sync {
    // Required methods
    fn create_blob_buf<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        file_id: &'life1 str,
        data: &'life2 [u8],
        opts: &'life3 CreateBlobOptions,
    ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn create_blob_stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        file_id: &'life1 str,
        stream: &'life2 mut (dyn AsyncRead + Send + Unpin),
    ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn stat_blob<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        blob_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<BlobStat>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_blob_buf<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        blob_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ClResult<Box<[u8]>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_blob_range_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        blob_id: &'life1 str,
        offset: u64,
        length: u64,
    ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_blob_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        blob_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_blob_from_path<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        file_id: &'life1 str,
        source: &'life2 Path,
        opts: &'life3 CreateBlobOptions,
    ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete_tenant_blobs<'life0, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
    ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_blob<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        blob_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_blobs<'life0, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
    ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = ClResult<String>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cleanup_tmp_files<'life0, 'async_trait>(
        &'life0 self,
        tn_id: TnId,
        cutoff_secs: i64,
    ) -> Pin<Box<dyn Future<Output = ClResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn create_blob_buf<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tn_id: TnId, file_id: &'life1 str, data: &'life2 [u8], opts: &'life3 CreateBlobOptions, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Creates a new blob from a buffer

Source

fn create_blob_stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tn_id: TnId, file_id: &'life1 str, stream: &'life2 mut (dyn AsyncRead + Send + Unpin), ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a new blob using a stream

Source

fn stat_blob<'life0, 'life1, 'async_trait>( &'life0 self, tn_id: TnId, blob_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<BlobStat>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stats a blob. Returns None if the blob is not present.

Source

fn read_blob_buf<'life0, 'life1, 'async_trait>( &'life0 self, tn_id: TnId, blob_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Box<[u8]>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads a blob

Source

fn read_blob_range_stream<'life0, 'life1, 'async_trait>( &'life0 self, tn_id: TnId, blob_id: &'life1 str, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads a byte range from a blob as a stream (no full buffering). offset is the start byte; length is the number of bytes to read.

Source

fn read_blob_stream<'life0, 'life1, 'async_trait>( &'life0 self, tn_id: TnId, blob_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads a blob

Source

fn create_blob_from_path<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tn_id: TnId, file_id: &'life1 str, source: &'life2 Path, opts: &'life3 CreateBlobOptions, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Creates a new blob by copying a file from a local path (no memory allocation)

Source

fn delete_tenant_blobs<'life0, 'async_trait>( &'life0 self, tn_id: TnId, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete every blob owned by the tenant. Treats a missing tenant directory as success. Used by tenant purge orchestration.

Source

fn delete_blob<'life0, 'life1, 'async_trait>( &'life0 self, tn_id: TnId, blob_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a single blob. Missing blob is success (idempotent).

Source

fn list_blobs<'life0, 'async_trait>( &'life0 self, tn_id: TnId, ) -> Pin<Box<dyn Future<Output = ClResult<Pin<Box<dyn Stream<Item = ClResult<String>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Enumerate every blob_id (typically a variant_id) currently present in this tenant’s blob store. Used by the GC scanner.

Source

fn cleanup_tmp_files<'life0, 'async_trait>( &'life0 self, tn_id: TnId, cutoff_secs: i64, ) -> Pin<Box<dyn Future<Output = ClResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete in-progress upload artifacts whose mtime is at or before cutoff_secs (Unix epoch seconds). These are written outside the content-addressed xx/yy/ shards by create_blob_stream, so they are invisible to list_blobs. Returns the number of files removed. Adapters with no notion of tmp files may return Ok(0).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§