pub struct ClientBuilder { /* private fields */ }Expand description
Builder for creating a Client with per-request callbacks and metrics.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn zc_threshold(self, bytes: u32) -> Self
pub fn zc_threshold(self, bytes: u32) -> Self
Set the zero-copy guard threshold (in bytes). Guard values passed to
fire_set_with_guard smaller than
this are copied into the coalescing send buffer so they batch like
plain SETs instead of taking the scatter-gather guard path (which
flushes every few ops). 0 = always use the guard path.
Defaults to 4096. Should generally match the runtime
Config::send_zc_threshold.
Sourcepub fn max_in_flight(self, n: usize) -> Self
pub fn max_in_flight(self, n: usize) -> Self
Configure the maximum number of in-flight fire_* operations.
fire_* returns Error::TooManyInFlight past it. Defaults to
usize::MAX (unbounded). Set a bounded value on any server that
issues fire_* faster than recv() consumes.
Sourcepub fn on_result<F: Fn(&CommandResult) + 'static>(self, f: F) -> Self
pub fn on_result<F: Fn(&CommandResult) + 'static>(self, f: F) -> Self
Register a callback invoked after each command completes.
Sourcepub fn max_batch_size(self, n: usize) -> Self
pub fn max_batch_size(self, n: usize) -> Self
Set the maximum number of fire_* commands to coalesce into a single
send. Default is 1 (each fire_* sends immediately, matching
pre-coalescing behavior). Set higher for pipelined workloads to batch
multiple commands into fewer TCP segments.
§Panics
Panics if n is 0.
Sourcepub fn with_metrics(self) -> Self
pub fn with_metrics(self) -> Self
Enable built-in histogram tracking (requires metrics feature).