pub struct NixlBackendConfig { /* private fields */ }Expand description
Configuration for NIXL backends.
Supports extracting backend configurations from environment variables:
DYN_KVBM_NIXL_BACKEND_UCX=true- Enable UCX backend with default paramsDYN_KVBM_NIXL_BACKEND_GDS=false- Explicitly disable GDS backend- Valid values: true/false, 1/0, on/off, yes/no (case-insensitive)
- Invalid values (e.g., “maybe”, “random”) will cause an error
- Custom params (e.g.,
DYN_KVBM_NIXL_BACKEND_UCX_PARAM1=value) will cause an error
§Data Structure
Uses a single HashMap where:
- Key presence = backend is enabled
- Value (inner HashMap) = backend-specific parameters (empty = defaults)
§TOML Example
[backends.UCX]
# UCX with default params (empty map)
[backends.GDS]
threads = "4"
buffer_size = "1048576"Implementations§
Source§impl NixlBackendConfig
impl NixlBackendConfig
Sourcepub fn new(backends: HashMap<String, HashMap<String, String>>) -> Self
pub fn new(backends: HashMap<String, HashMap<String, String>>) -> Self
Creates a new configuration with the given backends.
For an empty configuration with no backends, use Default::default().
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create configuration from environment variables.
Extracts backends from DYN_KVBM_NIXL_BACKEND_<backend>=<value> variables.
§Errors
Returns an error if:
- Custom parameters are detected (not yet supported)
- Invalid boolean values are provided (must be truthy or falsey)
Sourcepub fn with_backend(self, backend: impl Into<String>) -> Self
pub fn with_backend(self, backend: impl Into<String>) -> Self
Add a backend with default parameters. Backend name is normalized to uppercase.
Sourcepub fn with_backend_params(
self,
backend: impl Into<String>,
params: HashMap<String, String>,
) -> Self
pub fn with_backend_params( self, backend: impl Into<String>, params: HashMap<String, String>, ) -> Self
Add a backend with custom parameters. Backend name is normalized to uppercase.
Sourcepub fn backend_params(&self, backend: &str) -> Option<&HashMap<String, String>>
pub fn backend_params(&self, backend: &str) -> Option<&HashMap<String, String>>
Get parameters for a specific backend. Backend name is normalized to uppercase for lookup.
Returns None if the backend is not enabled.
Sourcepub fn has_backend(&self, backend: &str) -> bool
pub fn has_backend(&self, backend: &str) -> bool
Check if a specific backend is enabled.
Sourcepub fn merge(self, other: NixlBackendConfig) -> Self
pub fn merge(self, other: NixlBackendConfig) -> Self
Merge another configuration into this one.
Backends from the other configuration will be added to this one.
If both have the same backend, params from other take precedence.
Trait Implementations§
Source§impl Clone for NixlBackendConfig
impl Clone for NixlBackendConfig
Source§fn clone(&self) -> NixlBackendConfig
fn clone(&self) -> NixlBackendConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more