pub struct RaftNodeConfig {
pub cluster: ClusterConfig,
pub network: NetworkConfig,
pub raft: RaftConfig,
pub retry: RetryPolicies,
pub tls: TlsConfig,
}
Expand description
Main configuration container for Raft consensus engine components
Combines all subsystem configurations with hierarchical override support:
- Default values from code implementation
- Configuration file specified by
CONFIG_PATH
- Environment variables (highest priority)
Fields§
§cluster: ClusterConfig
Cluster topology and node configuration
network: NetworkConfig
Network communication parameters
raft: RaftConfig
Core Raft algorithm parameters
retry: RetryPolicies
Retry policies for distributed operations
tls: TlsConfig
TLS/SSL security configuration
Implementations§
Source§impl RaftNodeConfig
impl RaftNodeConfig
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new configuration with hierarchical override support:
Configuration sources are merged in the following order (later sources override earlier ones):
- Type defaults (lowest priority)
- Configuration file from
CONFIG_PATH
environment variable - Environment variables with
RAFT__
prefix (highest priority)
§Returns
Merged configuration instance or error if:
- Config file parsing fails
- Validation rules are violated
§Example
ⓘ
// Load with default values only
let cfg = RaftNodeConfig::new()?;
// Load with config file and environment variables
std::env::set_var("CONFIG_PATH", "config/cluster.toml");
std::env::set_var("RAFT__CLUSTER__NODE_ID", "100");
let cfg = RaftNodeConfig::new()?;
Sourcepub fn with_override_config(&self, path: &str) -> Result<Self>
pub fn with_override_config(&self, path: &str) -> Result<Self>
Creates a new configuration with additional overrides:
Merging order (later sources override earlier ones):
- Current configuration values
- New configuration file
- Latest environment variables (highest priority)
§Example
ⓘ
// Initial configuration
let base = RaftNodeConfig::new()?;
// Apply runtime overrides
let final_cfg = base.with_override_config("runtime_overrides.toml")?;
pub fn is_joining(&self) -> bool
Trait Implementations§
Source§impl Clone for RaftNodeConfig
impl Clone for RaftNodeConfig
Source§fn clone(&self) -> RaftNodeConfig
fn clone(&self) -> RaftNodeConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RaftNodeConfig
impl Debug for RaftNodeConfig
Source§impl Default for RaftNodeConfig
impl Default for RaftNodeConfig
Source§fn default() -> RaftNodeConfig
fn default() -> RaftNodeConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RaftNodeConfig
impl<'de> Deserialize<'de> for RaftNodeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RaftNodeConfig
impl RefUnwindSafe for RaftNodeConfig
impl Send for RaftNodeConfig
impl Sync for RaftNodeConfig
impl Unpin for RaftNodeConfig
impl UnwindSafe for RaftNodeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request