Skip to main content

ClientConfig

Struct ClientConfig 

Source
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: usize

Maximum number of concurrently-transferring files (default 4).

§upload_window: usize

In-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: usize

In-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: u64

Chunk 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: bool

Request zrip compression from the server / compress uploads.

§chunk_size: u64

Fixed chunk size used to slice files (default 2 MiB).

§max_retries: u32

Maximum retries per chunk/file (default 3).

§base_retry_delay_ms: u32

Initial backoff delay in ms (default 500).

§max_retry_delay_ms: u32

Backoff ceiling in ms (default 30s).

§timeout_ms: u32

Per-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

Source

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.

Source

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

Source§

fn clone(&self) -> ClientConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClientConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more