Skip to main content

DirectAccessClient

Trait DirectAccessClient 

Source
pub trait DirectAccessClient:
    Client
    + Send
    + Sync {
Show 20 methods // Required methods fn set_fetch_term_url_expiration(&self, expiration: Duration); fn set_api_delay_range(&self, delay_range: Option<Range<Duration>>); fn set_max_ranges_per_fetch(&self, max_ranges: usize); fn set_global_dedup_shard_expiration(&self, expiration: Option<Duration>); fn disable_v2_endpoints(&self, status_code: u16); fn get_reconstruction_v1<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponse>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_reconstruction_v2<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn apply_api_delay<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_xorbs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<MerkleHash>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_full_xorb<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_xorb_ranges<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, chunk_ranges: Vec<(u32, u32)>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn xorb_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn xorb_exists<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn xorb_footer<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<XorbObject>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_file_size<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_file_data<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_xorb_raw_bytes<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn xorb_raw_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn fetch_term_data<'life0, 'async_trait>( &'life0 self, hash: MerkleHash, fetch_term: XorbReconstructionFetchInfo, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn v2_disabled_status_code(&self) -> u16 { ... }
}
Expand description

A Client with direct access to XORB and file storage.

This trait extends the standard Client interface with methods for:

  • Direct XORB access (read, list)
  • File data retrieval
  • URL expiration control
  • API delay simulation

Both LocalClient and MemoryClient implement this trait, allowing the local server to work with either backend.

Required Methods§

Source

fn set_fetch_term_url_expiration(&self, expiration: Duration)

Sets the expiration duration for fetch term URLs.

Source

fn set_api_delay_range(&self, delay_range: Option<Range<Duration>>)

Sets a random delay range for all Client API calls.

When set, each Client trait method will sleep for a random duration within the specified range before returning. This simulates network latency.

Pass None to disable the delay.

Source

fn set_max_ranges_per_fetch(&self, max_ranges: usize)

Sets the maximum number of byte ranges per XorbMultiRangeFetch entry in V2 reconstruction responses.

Default is usize::MAX (all ranges in one fetch). When set to N, ranges for each xorb are grouped into entries of at most N ranges. This simulates the CloudFront URL length limit that forces splitting.

Source

fn set_global_dedup_shard_expiration(&self, expiration: Option<Duration>)

Sets the expiration duration for global dedup shards.

When set, query_for_global_dedup_shard will set the shard footer’s shard_key_expiry to now + expiration

Pass None to disable (default: returns full shards with no expiration).

Source

fn disable_v2_endpoints(&self, status_code: u16)

Disables V2 endpoints (reconstruction and shard upload) with the given HTTP status code. When disabled, /v2/* handlers return this status, forcing clients to fall back to V1. Pass 0 to re-enable.

Source

fn get_reconstruction_v1<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

V1 reconstruction: returns per-range presigned URLs.

Source

fn get_reconstruction_v2<'life0, 'life1, 'async_trait>( &'life0 self, file_id: &'life1 MerkleHash, bytes_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Option<QueryReconstructionResponseV2>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

V2 reconstruction: returns per-xorb multi-range fetch descriptors.

Source

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

Applies the configured API delay if set.

This method sleeps for a random duration within the configured delay range. If no delay is configured (via set_api_delay_range), this returns immediately.

Source

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

Returns all XORB hashes stored in this client.

Source

fn get_full_xorb<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all uncompressed bytes from a XORB.

Source

fn get_xorb_ranges<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, chunk_ranges: Vec<(u32, u32)>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get uncompressed bytes from a XORB within chunk ranges. Each tuple represents a chunk index range [start, end).

Source

fn xorb_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the length of the uncompressed XORB data.

Source

fn xorb_exists<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a XORB exists.

Get the XorbObject footer/metadata for a XORB.

Source

fn get_file_size<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the file size for a given file hash.

Source

fn get_file_data<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get file data, optionally within a byte range.

Source

fn get_xorb_raw_bytes<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, byte_range: Option<FileRange>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get raw (serialized) bytes from a XORB, optionally within a byte range.

Unlike get_xorb_ranges which returns decompressed chunk data, this returns the raw bytes as stored (including compression headers). This is used by the server’s fetch_term endpoint to serve data that clients can then decompress.

Source

fn xorb_raw_length<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 MerkleHash, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the total length of the raw (serialized) XORB data.

Source

fn fetch_term_data<'life0, 'async_trait>( &'life0 self, hash: MerkleHash, fetch_term: XorbReconstructionFetchInfo, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Vec<u32>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches term data for a given hash and fetch term. Returns (data bytes, chunk byte indices) matching Client::get_file_term_data.

Provided Methods§

Source

fn v2_disabled_status_code(&self) -> u16

Returns the HTTP status code V2 endpoints should return when disabled, or 0 if V2 is enabled.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§