pub struct ClientConfig {
pub concurrency: usize,
pub upload_window: usize,
pub download_window: usize,
pub download_chunk_size: u64,
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 ws_url: Option<String>,
}Expand description
Runtime configuration of the WASM engine.
Fields§
§concurrency: usizeMaximum number of concurrently-transferring files (default 4).
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.
download_chunk_size: u64Chunk size for parallel downloads (default 256 KiB).
Smaller than the upload chunk on purpose: the WASM engine reorders
in-flight chunks in memory so the SDK keeps receiving them in order
(append-mode writes), and download_window * download_chunk_size is
that buffer’s worst-case size.
compress: boolRequest zrip compression from the server / compress uploads.
chunk_size: u64Fixed chunk size used to slice files (default 2 MiB).
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).
ws_url: Option<String>Optional explicit WebSocket endpoint (e.g. wss://host/ws).
When None the engine derives the ws(s):// URL from the HTTP
baseUrl passed to each transfer method.
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