pub struct ControllerConfig {
pub node_id: u64,
pub listen_addr: SocketAddr,
pub raft_peers: Vec<RaftPeer>,
pub storage_path: PathBuf,
pub storage_backend: StorageBackendType,
pub election_timeout_ms: u64,
pub heartbeat_interval_ms: u64,
}Expand description
Controller configuration
Fields§
§node_id: u64Node ID
listen_addr: SocketAddrListen address
raft_peers: Vec<RaftPeer>Raft peer list
storage_path: PathBufStorage path
storage_backend: StorageBackendTypeStorage backend type
election_timeout_ms: u64Election timeout in milliseconds
heartbeat_interval_ms: u64Heartbeat interval in milliseconds
Implementations§
Source§impl ControllerConfig
impl ControllerConfig
Sourcepub fn new(node_id: u64, listen_addr: SocketAddr) -> Self
pub fn new(node_id: u64, listen_addr: SocketAddr) -> Self
Create a new controller configuration
Sourcepub fn with_raft_peers(self, peers: Vec<RaftPeer>) -> Self
pub fn with_raft_peers(self, peers: Vec<RaftPeer>) -> Self
Set Raft peers
Sourcepub fn with_storage_path(self, path: PathBuf) -> Self
pub fn with_storage_path(self, path: PathBuf) -> Self
Set storage path
Sourcepub fn with_storage_backend(self, backend: StorageBackendType) -> Self
pub fn with_storage_backend(self, backend: StorageBackendType) -> Self
Set storage backend
Sourcepub fn with_election_timeout_ms(self, timeout_ms: u64) -> Self
pub fn with_election_timeout_ms(self, timeout_ms: u64) -> Self
Set election timeout
Sourcepub fn with_heartbeat_interval_ms(self, interval_ms: u64) -> Self
pub fn with_heartbeat_interval_ms(self, interval_ms: u64) -> Self
Set heartbeat interval
Sourcepub fn to_storage_config(&self) -> StorageConfig
pub fn to_storage_config(&self) -> StorageConfig
Convert to storage configuration
Trait Implementations§
Source§impl Clone for ControllerConfig
impl Clone for ControllerConfig
Source§fn clone(&self) -> ControllerConfig
fn clone(&self) -> ControllerConfig
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 ControllerConfig
impl Debug for ControllerConfig
Source§impl<'de> Deserialize<'de> for ControllerConfig
impl<'de> Deserialize<'de> for ControllerConfig
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 ControllerConfig
impl RefUnwindSafe for ControllerConfig
impl Send for ControllerConfig
impl Sync for ControllerConfig
impl Unpin for ControllerConfig
impl UnwindSafe for ControllerConfig
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