pub struct ClientConfig {
pub concurrency: usize,
pub upload_window: usize,
pub download_window: usize,
pub compress: bool,
pub chunk_size: u64,
pub max_retries: u32,
pub base_retry_delay_ms: u32,
pub max_retry_delay_ms: u32,
pub timeout_ms: u32,
pub auto_tune: bool,
pub tune_ttl_ms: u64,
pub compress_level: CompressLevel,
}Expand description
Runtime configuration of the WASM engine.
Fields§
§concurrency: usizeGlobal cap on concurrent in-flight HTTP transfers (default 4).
Every upload chunk POST and download range GET acquires a permit from
a shared pool, so this bounds the engine’s TOTAL network parallelism
— across all files AND all per-file windows combined (a single file
can still open up to upload_window / download_window requests, but
never more than concurrency in total).
upload_window: usizeIn-flight chunk window for a single file’s upload (default 8).
Independent of concurrency: one file keeps up to upload_window
chunks in flight, so a high-latency link stays saturated (throughput
is bounded by bandwidth, not chunk_size / RTT).
download_window: usizeIn-flight byte-range window for a single file’s download (default 4).
A large file is downloaded as download_window concurrent Range
GETs so its throughput is bounded by bandwidth instead of one
connection’s chunk_size / RTT (tus-style parallel transfer). Set to
1 to fall back to the sequential single-connection path.
compress: boolRequest zrip compression from the server / compress uploads.
chunk_size: u64Fixed chunk size used to slice files and byte-range downloads (default 2 MiB).
The same value is used for both upload chunking and parallel download range splits, so a single config option represents the budget for both paths (larger = fewer, bigger transfers; bounded by the server’s upload limit, memory, and the per-file window budget).
max_retries: u32Maximum retries per chunk/file (default 3).
base_retry_delay_ms: u32Initial backoff delay in ms (default 500).
max_retry_delay_ms: u32Backoff ceiling in ms (default 30s).
timeout_ms: u32Per-request timeout in ms (default 60s).
auto_tune: boolAdaptive tuning (TCP-style ramp over real transfers). Off by default so legacy callers behave exactly as before.
tune_ttl_ms: u64TTL of the persisted tuning cache (default 1h).
compress_level: CompressLevelClient-side compression level policy.
Absent config resolves to CompressLevel::Balanced (the server’s
advertised default = the historical level-1 behavior), so callers
that never set it are byte-identical to pre-0.3.3. compress: false
still forces identity regardless of this field.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn from_js(opts: &JsValue) -> ClientConfig
pub fn from_js(opts: &JsValue) -> ClientConfig
Parse configuration from a JS object literal, e.g.
{ concurrency: 4, compress: true, chunkSize: 2097152 }.
Safe to call with null/undefined (returns defaults) — this also
keeps native (non-wasm) unit tests runnable.
Sourcepub fn backoff_ms(&self, attempt: u32) -> u32
pub fn backoff_ms(&self, attempt: u32) -> u32
Exponential backoff delay for a failed attempt (0-based).
2^attempt * base, clamped to max. Bounded so a hung peer cannot
grow the delay without limit.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more