pub struct NodeConfig {
pub node_id: OxirsNodeId,
pub address: SocketAddr,
pub data_dir: String,
pub peers: Vec<OxirsNodeId>,
pub peer_addresses: HashMap<OxirsNodeId, SocketAddr>,
pub discovery: Option<DiscoveryConfig>,
pub replication_strategy: Option<ReplicationStrategy>,
pub use_bft: bool,
pub region_config: Option<MultiRegionConfig>,
}Expand description
Cluster node configuration
Fields§
§node_id: OxirsNodeIdUnique node identifier
address: SocketAddrNetwork address for communication
data_dir: StringData directory for persistent storage
peers: Vec<OxirsNodeId>List of peer node IDs
peer_addresses: HashMap<OxirsNodeId, SocketAddr>Known network addresses of entries in peers, keyed by node id.
Required (for every id in peers) to form a real multi-node Raft
cluster — ClusterNode::new feeds this straight into
RaftNode::set_network via ConsensusManager::with_raft_network, so
the Raft transport (raft_network.rs) knows where to dial each peer
and what address to advertise for itself. Left empty for a genuine
single-node deployment (peers empty), which never needs it.
discovery: Option<DiscoveryConfig>Discovery configuration
replication_strategy: Option<ReplicationStrategy>Replication strategy
use_bft: boolUse Byzantine fault tolerance instead of Raft.
This field is always present so a caller can request BFT regardless of
how the crate was compiled; if it is true but the bft feature was
not enabled, ClusterNode::start fails loud rather than silently
running Raft.
region_config: Option<MultiRegionConfig>Multi-region deployment configuration
Implementations§
Source§impl NodeConfig
impl NodeConfig
Sourcepub fn new(node_id: OxirsNodeId, address: SocketAddr) -> Self
pub fn new(node_id: OxirsNodeId, address: SocketAddr) -> Self
Create a new node configuration
Sourcepub fn add_peer(&mut self, peer_id: OxirsNodeId) -> &mut Self
pub fn add_peer(&mut self, peer_id: OxirsNodeId) -> &mut Self
Add a peer to the configuration
Sourcepub fn add_peer_address(
&mut self,
peer_id: OxirsNodeId,
address: SocketAddr,
) -> &mut Self
pub fn add_peer_address( &mut self, peer_id: OxirsNodeId, address: SocketAddr, ) -> &mut Self
Record (or update) the network address of a peer, so a multi-node
Raft cluster can be formed. Does not implicitly add peer_id to
peers — call add_peer too if it isn’t already listed.
Sourcepub fn with_discovery(self, discovery: DiscoveryConfig) -> Self
pub fn with_discovery(self, discovery: DiscoveryConfig) -> Self
Set the discovery configuration
Sourcepub fn with_replication_strategy(self, strategy: ReplicationStrategy) -> Self
pub fn with_replication_strategy(self, strategy: ReplicationStrategy) -> Self
Set the replication strategy
Sourcepub fn with_bft(self, enable: bool) -> Self
pub fn with_bft(self, enable: bool) -> Self
Enable Byzantine fault tolerance.
Requesting BFT here always compiles; it only takes effect when the crate
is built with the bft feature. Otherwise ClusterNode::start returns
an explicit configuration error.
Sourcepub fn with_multi_region(self, region_config: MultiRegionConfig) -> Self
pub fn with_multi_region(self, region_config: MultiRegionConfig) -> Self
Set multi-region configuration
Sourcepub fn is_multi_region_enabled(&self) -> bool
pub fn is_multi_region_enabled(&self) -> bool
Check if multi-region is enabled
Sourcepub fn availability_zone_id(&self) -> Option<&str>
pub fn availability_zone_id(&self) -> Option<&str>
Get availability zone ID if configured
Trait Implementations§
Source§impl Clone for NodeConfig
impl Clone for NodeConfig
Source§fn clone(&self) -> NodeConfig
fn clone(&self) -> NodeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeConfig
impl Debug for NodeConfig
Source§impl<'de> Deserialize<'de> for NodeConfig
impl<'de> Deserialize<'de> for NodeConfig
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>,
Auto Trait Implementations§
impl Freeze for NodeConfig
impl RefUnwindSafe for NodeConfig
impl Send for NodeConfig
impl Sync for NodeConfig
impl Unpin for NodeConfig
impl UnsafeUnpin for NodeConfig
impl UnwindSafe for NodeConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeDebug for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.