pub struct ServerConfig {
pub pid: NodeId,
pub election_tick_timeout: u64,
pub resend_message_tick_timeout: u64,
pub buffer_size: usize,
pub batch_size: usize,
pub leader_priority: u32,
pub logger_file_path: Option<String>,
pub custom_logger: Option<Logger>,
}
Expand description
Configuration for a singular OmniPaxos
instance in a cluster.
§Fields
pid
: The unique identifier of this node. Must not be 0.election_tick_timeout
: The number of calls totick()
before leader election is updated. If this is set to 5 andtick()
is called every 10ms, then the election timeout will be 50ms. Must not be 0.resend_message_tick_timeout
: The number of calls totick()
before a message is considered dropped and thus resent. Must not be 0.buffer_size
: The buffer size for outgoing messages.batch_size
: The size of the buffer for log batching. The default is 1, which means no batching.logger_file_path
: The path where the default logger logs events.leader_priority
: Custom priority for this node to be elected as the leader.
Fields§
§pid: NodeId
The unique identifier of this node. Must not be 0.
election_tick_timeout: u64
The number of calls to tick()
before leader election is updated. If this is set to 5 and tick()
is called every 10ms, then the election timeout will be 50ms.
resend_message_tick_timeout: u64
The number of calls to tick()
before a message is considered dropped and thus resent. Must not be 0.
buffer_size: usize
The buffer size for outgoing messages.
batch_size: usize
The size of the buffer for log batching. The default is 1, which means no batching.
leader_priority: u32
Custom priority for this node to be elected as the leader.
logger_file_path: Option<String>
Available on crate feature
logging
only.The path where the default logger logs events.
custom_logger: Option<Logger>
Available on crate feature
logging
only.Custom logger, if provided, will be used instead of the default logger.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Checks that all the fields of the server config are valid.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
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 ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
impl Default for ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfigwhere
ServerConfig: Default,
impl<'de> Deserialize<'de> for ServerConfigwhere
ServerConfig: Default,
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 ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnwindSafe for ServerConfig
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