pub struct MemberlistOptions {Show 29 fields
pub label: Label,
pub skip_inbound_label_check: bool,
pub timeout: Duration,
pub indirect_checks: usize,
pub retransmit_mult: usize,
pub suspicion_mult: usize,
pub suspicion_max_timeout_mult: usize,
pub push_pull_interval: Duration,
pub probe_interval: Duration,
pub probe_timeout: Duration,
pub disable_reliable_pings: bool,
pub awareness_max_multiplier: usize,
pub gossip_interval: Duration,
pub gossip_nodes: usize,
pub gossip_to_the_dead_time: Duration,
pub protocol_version: ProtocolVersion,
pub delegate_version: DelegateVersion,
pub handoff_queue_depth: usize,
pub dead_node_reclaim_time: Duration,
pub queue_check_interval: Duration,
pub checksum_algo: Option<ChecksumAlgorithm>,
pub offload_size: usize,
pub encryption_algo: Option<EncryptionAlgorithm>,
pub gossip_verify_outgoing: bool,
pub gossip_verify_incoming: bool,
pub primary_key: Option<SecretKey>,
pub secret_keys: SecretKeys,
pub compress_algo: Option<CompressAlgorithm>,
pub metric_labels: Arc<MetricLabels>,
}
Expand description
Options used to configure the memberlist.
Fields§
§label: Label
Label is an optional set of bytes to include on the outside of each packet and stream.
If gossip encryption is enabled and this is set it is treated as GCM authenticated data.
skip_inbound_label_check: bool
Skips the check that inbound packets and gossip streams need to be label prefixed.
timeout: Duration
The timeout for establishing a stream connection with a remote node for a full state sync, and for stream read and write operations.
indirect_checks: usize
The number of nodes that will be asked to perform
an indirect probe of a node in the case a direct probe fails. Memberlist
waits for an ack from any single indirect node, so increasing this
number will increase the likelihood that an indirect probe will succeed
at the expense of bandwidth.
retransmit_mult: usize
The multiplier for the number of retransmissions that are attempted for messages broadcasted over gossip. The actual count of retransmissions is calculated using the formula:
retransmits = retransmit_mult * log(N+1)
This allows the retransmits to scale properly with cluster size. The higher the multiplier, the more likely a failed broadcast is to converge at the expense of increased bandwidth.
suspicion_mult: usize
The multiplier for determining the time an inaccessible node is considered suspect before declaring it dead. The actual timeout is calculated using the formula:
suspicion_timeout = suspicion_mult * log(N+1) * probe_interval
This allows the timeout to scale properly with expected propagation delay with a larger cluster size. The higher the multiplier, the longer an inaccessible node is considered part of the cluster before declaring it dead, giving that suspect node more time to refute if it is indeed still alive.
suspicion_max_timeout_mult: usize
The multiplier applied to the
suspicion_timeout
used as an upper bound on detection time. This max
timeout is calculated using the formula:
suspicion_max_timeout = suspicion_max_timeout_mult * suspicion_timeout
If everything is working properly, confirmations from other nodes will accelerate suspicion timers in a manner which will cause the timeout to reach the base SuspicionTimeout before that elapses, so this value will typically only come into play if a node is experiencing issues communicating with other nodes. It should be set to a something fairly large so that a node having problems will have a lot of chances to recover before falsely declaring other nodes as failed, but short enough for a legitimately isolated node to still make progress marking nodes failed in a reasonable amount of time.
push_pull_interval: Duration
The interval between complete state syncs. Complete state syncs are done with a single node over TCP and are quite expensive relative to standard gossiped messages. Setting this to zero will disable state push/pull syncs completely.
Setting this interval lower (more frequent) will increase convergence speeds across larger clusters at the expense of increased bandwidth usage.
probe_interval: Duration
The interval between random node probes. Setting this lower (more frequent) will cause the memberlist cluster to detect failed nodes more quickly at the expense of increased bandwidth usage
probe_timeout: Duration
The timeout to wait for an ack from a probed node before assuming it is unhealthy. This should be set to 99-percentile of RTT (round-trip time) on your network.
disable_reliable_pings: bool
Set this field will turn off the fallback promised pings that are attempted if the direct unreliable ping fails. These get pipelined along with the indirect unreliable pings.
awareness_max_multiplier: usize
Increase the probe interval if the node becomes aware that it might be degraded and not meeting the soft real time requirements to reliably probe other nodes.
gossip_interval: Duration
The interval between sending messages that need to be gossiped that haven’t been able to piggyback on probing messages. If this is set to zero, non-piggyback gossip is disabled. By lowering this value (more frequent) gossip messages are propagated across the cluster more quickly at the expense of increased bandwidth.
gossip_nodes: usize
The number of random nodes to send gossip messages to
per gossip_interval
. Increasing this number causes the gossip messages
to propagate across the cluster more quickly at the expense of
increased bandwidth.
gossip_to_the_dead_time: Duration
The interval after which a node has died that we will still try to gossip to it. This gives it a chance to refute.
protocol_version: ProtocolVersion
Used to guarantee protocol-compatibility
delegate_version: DelegateVersion
Used to guarantee protocol-compatibility for any custom messages that the delegate might do (broadcasts, local/remote state, etc.). If you don’t set these, then the protocol versions will just be zero, and version compliance won’t be done.
handoff_queue_depth: usize
Size of Memberlist’s internal channel which handles UDP messages. The size of this determines the size of the queue which Memberlist will keep while UDP messages are handled.
dead_node_reclaim_time: Duration
Controls the time before a dead node’s name can be reclaimed by one with a different address or port. By default, this is 0, meaning nodes cannot be reclaimed this way.
queue_check_interval: Duration
The interval at which we check the message queue to apply the warning and max depth.
checksum_algo: Option<ChecksumAlgorithm>
Indicates that should the messages sent as packets through transport will be appended a checksum.
Default is None
.
§Note
If the Transport::packet_reliable
is return true
,
then the checksum will not be appended to the packets, even if this field is set to Some
.
offload_size: usize
The size of a message that should be offload to [rayon
] thread pool
for checksuming, encryption or compression.
The default value is 1KB, which means that any message larger than 1KB
will be offloaded to [rayon
] thread pool for encryption or compression.
encryption_algo: Option<EncryptionAlgorithm>
Indicates that should the messages sent as packet or stream through transport will be encrypted or not.
Default is None
.
§Note
- If the
Transport::packet_secure
returnstrue
, then the encryption will not be applied to the messages when sending as packet, even if this field is set toSome
. - If the
Transport::stream_secure
returnstrue
, then the encryption will not be applied to the messages when sending as stream, even if this field is set toSome
.
gossip_verify_outgoing: bool
Controls whether to enforce encryption for outgoing gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster.
gossip_verify_incoming: bool
Controls whether to enforce encryption for incoming gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster.
primary_key: Option<SecretKey>
Used to initialize the primary encryption key in a keyring.
The primary encryption key is the only key used to encrypt messages and the first key used while attempting to decrypt messages. Providing a value for this primary key will enable message-level encryption and verification, and automatically install the key onto the keyring.
secret_keys: SecretKeys
Holds all of the encryption keys used internally.
compress_algo: Option<CompressAlgorithm>
Indicates that should the messages sent through transport will be compressed or not.
Default is None
.
metric_labels: Arc<MetricLabels>
The metric labels for the memberlist.
Implementations§
Source§impl Options
impl Options
Sourcepub const fn skip_inbound_label_check(&self) -> bool
pub const fn skip_inbound_label_check(&self) -> bool
Get if the check that inbound packets and gossip streams need to be label prefixed.
Sourcepub const fn timeout(&self) -> Duration
pub const fn timeout(&self) -> Duration
Returns the timeout for establishing a stream connection with a remote node for a full state sync, and for stream read and write operations.
Sourcepub const fn indirect_checks(&self) -> usize
pub const fn indirect_checks(&self) -> usize
Returns the number of nodes that will be asked to perform an indirect probe of a node in the case a direct probe fails.
Sourcepub const fn retransmit_mult(&self) -> usize
pub const fn retransmit_mult(&self) -> usize
Returns the retransmit mult
Sourcepub const fn suspicion_mult(&self) -> usize
pub const fn suspicion_mult(&self) -> usize
Returns the suspicion mult
Sourcepub const fn suspicion_max_timeout_mult(&self) -> usize
pub const fn suspicion_max_timeout_mult(&self) -> usize
Returns the suspicion max timeout mult
Sourcepub const fn push_pull_interval(&self) -> Duration
pub const fn push_pull_interval(&self) -> Duration
Returns the push pull interval
Sourcepub const fn probe_interval(&self) -> Duration
pub const fn probe_interval(&self) -> Duration
Returns the probe interval
Sourcepub const fn probe_timeout(&self) -> Duration
pub const fn probe_timeout(&self) -> Duration
Returns the probe timeout
Sourcepub const fn disable_reliable_pings(&self) -> bool
pub const fn disable_reliable_pings(&self) -> bool
Returns whether disable promised pings or not
Sourcepub const fn awareness_max_multiplier(&self) -> usize
pub const fn awareness_max_multiplier(&self) -> usize
Returns the awareness max multiplier
Sourcepub const fn gossip_interval(&self) -> Duration
pub const fn gossip_interval(&self) -> Duration
Returns the gossip interval
Sourcepub const fn gossip_nodes(&self) -> usize
pub const fn gossip_nodes(&self) -> usize
Returns the gossip nodes
Sourcepub const fn gossip_to_the_dead_time(&self) -> Duration
pub const fn gossip_to_the_dead_time(&self) -> Duration
Returns the gossip to the dead timeout
Sourcepub const fn protocol_version(&self) -> ProtocolVersion
pub const fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version this node is speaking
Sourcepub const fn delegate_version(&self) -> DelegateVersion
pub const fn delegate_version(&self) -> DelegateVersion
Returns the delegate version this node is speaking
Sourcepub const fn handoff_queue_depth(&self) -> usize
pub const fn handoff_queue_depth(&self) -> usize
Returns the handoff queue depth
Sourcepub const fn dead_node_reclaim_time(&self) -> Duration
pub const fn dead_node_reclaim_time(&self) -> Duration
Returns the dead node reclaim time
Sourcepub const fn queue_check_interval(&self) -> Duration
pub const fn queue_check_interval(&self) -> Duration
Returns the queue check interval
Sourcepub const fn checksum_algo(&self) -> Option<ChecksumAlgorithm>
pub const fn checksum_algo(&self) -> Option<ChecksumAlgorithm>
Returns the checksum algorithm for the packets sent through transport.
Sourcepub const fn offload_size(&self) -> usize
pub const fn offload_size(&self) -> usize
Get the size of a message that should be offload to [rayon
] thread pool for encryption or compression.
Sourcepub const fn encryption_algo(&self) -> Option<EncryptionAlgorithm>
pub const fn encryption_algo(&self) -> Option<EncryptionAlgorithm>
Returns the encryption algorithm for the messages sent through transport.
Sourcepub const fn gossip_verify_outgoing(&self) -> bool
pub const fn gossip_verify_outgoing(&self) -> bool
Get whether to enforce encryption for outgoing gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster.
Sourcepub const fn gossip_verify_incoming(&self) -> bool
pub const fn gossip_verify_incoming(&self) -> bool
Get whether to enforce encryption for incoming gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster.
Sourcepub const fn primary_key(&self) -> Option<&SecretKey>
pub const fn primary_key(&self) -> Option<&SecretKey>
Get the primary encryption key in a keyring.
Sourcepub fn secret_keys(&self) -> &[SecretKey]
pub fn secret_keys(&self) -> &[SecretKey]
Get all of the encryption keys used internally.
Sourcepub const fn compress_algo(&self) -> Option<CompressAlgorithm>
pub const fn compress_algo(&self) -> Option<CompressAlgorithm>
Returns the compress algorithm for the messages sent through transport.
Sourcepub const fn metric_labels(&self) -> &Arc<MetricLabels>
pub const fn metric_labels(&self) -> &Arc<MetricLabels>
Get the metric labels for the memberlist.
Sourcepub fn with_label(self, val: Label) -> Options
pub fn with_label(self, val: Label) -> Options
Set the label of the node. (Builder pattern)
Sourcepub fn with_skip_inbound_label_check(self, val: bool) -> Options
pub fn with_skip_inbound_label_check(self, val: bool) -> Options
Set if the check that inbound packets and gossip streams need to be label prefixed. (Builder pattern)
Sourcepub const fn with_timeout(self, val: Duration) -> Options
pub const fn with_timeout(self, val: Duration) -> Options
Sets the timeout for establishing a stream connection with a remote node for a full state sync, and for stream read and write operations (Builder pattern).
Sourcepub const fn with_indirect_checks(self, val: usize) -> Options
pub const fn with_indirect_checks(self, val: usize) -> Options
Sets the number of nodes that will be asked to perform an indirect probe of a node in the case a direct probe fails (Builder pattern).
Sourcepub const fn with_retransmit_mult(self, val: usize) -> Options
pub const fn with_retransmit_mult(self, val: usize) -> Options
Sets the retransmit mult (Builder pattern).
Sourcepub const fn with_suspicion_mult(self, val: usize) -> Options
pub const fn with_suspicion_mult(self, val: usize) -> Options
Sets the suspicion mult (Builder pattern).
Sourcepub const fn with_suspicion_max_timeout_mult(self, val: usize) -> Options
pub const fn with_suspicion_max_timeout_mult(self, val: usize) -> Options
Sets the suspicion max timeout mult (Builder pattern).
Sourcepub const fn with_push_pull_interval(self, val: Duration) -> Options
pub const fn with_push_pull_interval(self, val: Duration) -> Options
Sets the push pull interval (Builder pattern).
Sourcepub const fn with_probe_interval(self, val: Duration) -> Options
pub const fn with_probe_interval(self, val: Duration) -> Options
Sets the probe interval (Builder pattern).
Sourcepub const fn with_probe_timeout(self, val: Duration) -> Options
pub const fn with_probe_timeout(self, val: Duration) -> Options
Sets the probe timeout (Builder pattern).
Sourcepub const fn with_disable_reliable_pings(self, val: bool) -> Options
pub const fn with_disable_reliable_pings(self, val: bool) -> Options
Sets whether disable promised pings or not (Builder pattern).
Sourcepub const fn with_awareness_max_multiplier(self, val: usize) -> Options
pub const fn with_awareness_max_multiplier(self, val: usize) -> Options
Sets the awareness max multiplier (Builder pattern).
Sourcepub const fn with_gossip_interval(self, val: Duration) -> Options
pub const fn with_gossip_interval(self, val: Duration) -> Options
Sets the gossip interval (Builder pattern).
Sourcepub const fn with_gossip_nodes(self, val: usize) -> Options
pub const fn with_gossip_nodes(self, val: usize) -> Options
Sets the gossip nodes (Builder pattern).
Sourcepub const fn with_gossip_to_the_dead_time(self, val: Duration) -> Options
pub const fn with_gossip_to_the_dead_time(self, val: Duration) -> Options
Sets the gossip to the dead timeout (Builder pattern).
Sourcepub const fn with_protocol_version(self, val: ProtocolVersion) -> Options
pub const fn with_protocol_version(self, val: ProtocolVersion) -> Options
Sets the protocol version this node is speaking (Builder pattern).
Sourcepub const fn with_delegate_version(self, val: DelegateVersion) -> Options
pub const fn with_delegate_version(self, val: DelegateVersion) -> Options
Sets the delegate version this node is speaking (Builder pattern).
Sourcepub const fn with_handoff_queue_depth(self, val: usize) -> Options
pub const fn with_handoff_queue_depth(self, val: usize) -> Options
Sets the handoff queue depth (Builder pattern).
Sourcepub const fn with_dead_node_reclaim_time(self, val: Duration) -> Options
pub const fn with_dead_node_reclaim_time(self, val: Duration) -> Options
Sets the dead node reclaim time (Builder pattern).
Sourcepub const fn with_queue_check_interval(self, val: Duration) -> Options
pub const fn with_queue_check_interval(self, val: Duration) -> Options
Sets the queue check interval (Builder pattern).
Sourcepub const fn maybe_checksum_algo(
self,
val: Option<ChecksumAlgorithm>,
) -> Options
pub const fn maybe_checksum_algo( self, val: Option<ChecksumAlgorithm>, ) -> Options
Sets the checksum algorithm for the packets sent through transport.
Sourcepub fn with_offload_size(self, val: usize) -> Options
pub fn with_offload_size(self, val: usize) -> Options
Set the size of a message that should be offload to [rayon
] thread pool for encryption or compression. (Builder pattern)
Sourcepub const fn maybe_encryption_algo(
self,
val: Option<EncryptionAlgorithm>,
) -> Options
pub const fn maybe_encryption_algo( self, val: Option<EncryptionAlgorithm>, ) -> Options
Sets the encryption algorithm for the messages sent through transport.
Sourcepub fn with_gossip_verify_outgoing(self, val: bool) -> Options
pub fn with_gossip_verify_outgoing(self, val: bool) -> Options
Set whether to enforce encryption for outgoing gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster. (Builder pattern)
Sourcepub fn with_gossip_verify_incoming(self, val: bool) -> Options
pub fn with_gossip_verify_incoming(self, val: bool) -> Options
Set whether to enforce encryption for incoming gossip. It is used for upshifting from unencrypted to encrypted gossip on a running cluster. (Builder pattern)
Sourcepub fn maybe_primary_key(self, val: Option<SecretKey>) -> Options
pub fn maybe_primary_key(self, val: Option<SecretKey>) -> Options
Set the primary encryption key in a keyring. (Builder pattern)
Sourcepub fn with_secret_keys(self, val: SecretKeys) -> Options
pub fn with_secret_keys(self, val: SecretKeys) -> Options
Set all of the encryption keys used internally. (Builder pattern)
Sourcepub const fn maybe_compress_algo(
self,
val: Option<CompressAlgorithm>,
) -> Options
pub const fn maybe_compress_algo( self, val: Option<CompressAlgorithm>, ) -> Options
Sets the compress algorithm for the messages sent through transport.
Sourcepub fn with_metric_labels(self, val: Arc<MetricLabels>) -> Options
pub fn with_metric_labels(self, val: Arc<MetricLabels>) -> Options
Sets the metric labels for the memberlist.
Source§impl Options
impl Options
Sourcepub fn lan() -> Options
pub fn lan() -> Options
Returns a sane set of configurations for Memberlist. Sets very conservative values that are sane for most LAN environments. The default configuration errs on the side of caution, choosing values that are optimized for higher convergence at the cost of higher bandwidth usage. Regardless, these values are a good starting point when getting started with memberlist.
Sourcepub fn wan() -> Options
pub fn wan() -> Options
Returns a configuration that is optimized for most WAN environments. The default configuration is still very conservative and errs on the side of caution.
Sourcepub fn local() -> Options
pub fn local() -> Options
Returns a configuration that is optimized for a local loopback environments. The default configuration is still very conservative and errs on the side of caution.
Sourcepub fn with_compress_algo(self, compress_algo: CompressAlgorithm) -> Options
pub fn with_compress_algo(self, compress_algo: CompressAlgorithm) -> Options
Set the compression algorithm for the messages sent through transport.
Sourcepub fn with_checksum_algo(self, checksum_algo: ChecksumAlgorithm) -> Options
pub fn with_checksum_algo(self, checksum_algo: ChecksumAlgorithm) -> Options
Set the checksum algorithm for the packets sent through transport.
Sourcepub fn with_encryption_algo(
self,
encryption_algo: EncryptionAlgorithm,
) -> Options
pub fn with_encryption_algo( self, encryption_algo: EncryptionAlgorithm, ) -> Options
Set the encryption algorithm for the messages sent through transport.
Sourcepub fn with_primary_key(self, primary_key: SecretKey) -> Options
pub fn with_primary_key(self, primary_key: SecretKey) -> Options
Set the primary encryption key in a keyring.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Options, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Options, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Options
impl Serialize for Options
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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
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> 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 more