Skip to main content

CasClient

Trait CasClient 

Source
pub trait CasClient: Send + Sync {
    // Required methods
    fn get_file_reconstruction_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_hash: &'life1 DataHash,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(MDBFileInfo, Option<DataHash>)>, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_reconstruction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_id: &'life1 DataHash,
        bytes_range: Option<Range<u64, _F>>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn batch_get_reconstruction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_ids: &'life1 [DataHash],
    ) -> Pin<Box<dyn Future<Output = Result<BatchQueryReconstructionResponse, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn acquire_download_permit<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_file_term_data<'life0, 'async_trait>(
        &'life0 self,
        url_info: Box<dyn URLProvider>,
        download_permit: ConnectionPermit,
        progress_callback: Option<Arc<dyn Fn(u64, u64, u64) + Sync + Send>>,
        uncompressed_size_if_known: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>), ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn query_for_global_dedup_shard<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prefix: &'life1 str,
        chunk_hash: &'life2 DataHash,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn acquire_upload_permit<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn upload_shard<'life0, 'async_trait>(
        &'life0 self,
        shard_data: Bytes,
        upload_permit: ConnectionPermit,
        progress_callback: Option<Arc<dyn Fn(ShardUploadProgressType<'_>) + Sync + Send>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn upload_xorb<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 str,
        serialized_xorb_object: SerializedXorbObject,
        progress_callback: Option<Arc<dyn Fn(u64, u64, u64) + Sync + Send>>,
        upload_permit: ConnectionPermit,
    ) -> Pin<Box<dyn Future<Output = Result<u64, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_file_chunk_hashes<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file_id: &'life1 DataHash,
        dirty_ranges: Vec<Range<u64, _F>>,
    ) -> Pin<Box<dyn Future<Output = Result<FileChunkHashesResponse, ClientError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

A Client to the Shard service. The shard service provides for

  1. upload shard to the shard service
  2. querying of file->reconstruction information
  3. querying of chunk->shard information

Required Methods§

Source

fn get_file_reconstruction_info<'life0, 'life1, 'async_trait>( &'life0 self, file_hash: &'life1 DataHash, ) -> Pin<Box<dyn Future<Output = Result<Option<(MDBFileInfo, Option<DataHash>)>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn get_reconstruction<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 DataHash, bytes_range: Option<Range<u64, _F>>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns reconstruction info always in V2 format. Implementations may try V2 first and fall back to V1 + convert.

Source

fn batch_get_reconstruction<'life0, 'life1, 'async_trait>( &'life0 self, file_ids: &'life1 [DataHash], ) -> Pin<Box<dyn Future<Output = Result<BatchQueryReconstructionResponse, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn acquire_download_permit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn get_file_term_data<'life0, 'async_trait>( &'life0 self, url_info: Box<dyn URLProvider>, download_permit: ConnectionPermit, progress_callback: Option<Arc<dyn Fn(u64, u64, u64) + Sync + Send>>, uncompressed_size_if_known: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>), ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Optional progress callback receives (delta, completed, total) in transfer bytes. When [uncompressed_size_if_known] is Some, the returned Bytes must have len() equal to that value.

Source

fn query_for_global_dedup_shard<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prefix: &'life1 str, chunk_hash: &'life2 DataHash, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Source

fn acquire_upload_permit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectionPermit, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Acquire an upload permit.

Source

fn upload_shard<'life0, 'async_trait>( &'life0 self, shard_data: Bytes, upload_permit: ConnectionPermit, progress_callback: Option<Arc<dyn Fn(ShardUploadProgressType<'_>) + Sync + Send>>, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Upload a new shard. The optional callback receives v2 NDJSON progress events.

Source

fn upload_xorb<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, serialized_xorb_object: SerializedXorbObject, progress_callback: Option<Arc<dyn Fn(u64, u64, u64) + Sync + Send>>, upload_permit: ConnectionPermit, ) -> Pin<Box<dyn Future<Output = Result<u64, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Upload a new xorb. Optional progress callback receives (delta, completed, total) in transfer bytes.

Source

fn get_file_chunk_hashes<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 DataHash, dirty_ranges: Vec<Range<u64, _F>>, ) -> Pin<Box<dyn Future<Output = Result<FileChunkHashesResponse, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Compute chunk-aligned dirty windows + opaque gap [MerkleHashSubtree] summaries for the given file, narrowed to dirty_ranges.

dirty_ranges must be sorted and non-overlapping. Per-chunk hashes are never returned; the response carries only windows.len() dirty windows and windows.len() + 1 gap subtrees, which the client merges with locally-recomputed window subtrees to obtain the new file hash.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§