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§
Sourcefn set_fetch_term_url_expiration(&self, expiration: Duration)
fn set_fetch_term_url_expiration(&self, expiration: Duration)
Sets the expiration duration for fetch term URLs.
Sourcefn set_api_delay_range(&self, delay_range: Option<Range<Duration>>)
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.
Sourcefn set_max_ranges_per_fetch(&self, max_ranges: usize)
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.
Sourcefn set_global_dedup_shard_expiration(&self, expiration: Option<Duration>)
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).
Sourcefn disable_v2_endpoints(&self, status_code: u16)
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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn apply_api_delay<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
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.
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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 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).
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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,
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§
Sourcefn v2_disabled_status_code(&self) -> u16
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".