Struct MemberlistOptions

Source
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 returns true, then the encryption will not be applied to the messages when sending as packet, even if this field is set to Some.
  • If the Transport::stream_secure returns true, then the encryption will not be applied to the messages when sending as stream, even if this field is set to Some.
§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

Source

pub const fn label(&self) -> &Label

Get the label of the node.

Source

pub const fn skip_inbound_label_check(&self) -> bool

Get if the check that inbound packets and gossip streams need to be label prefixed.

Source

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.

Source

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.

Source

pub const fn retransmit_mult(&self) -> usize

Returns the retransmit mult

Source

pub const fn suspicion_mult(&self) -> usize

Returns the suspicion mult

Source

pub const fn suspicion_max_timeout_mult(&self) -> usize

Returns the suspicion max timeout mult

Source

pub const fn push_pull_interval(&self) -> Duration

Returns the push pull interval

Source

pub const fn probe_interval(&self) -> Duration

Returns the probe interval

Source

pub const fn probe_timeout(&self) -> Duration

Returns the probe timeout

Source

pub const fn disable_reliable_pings(&self) -> bool

Returns whether disable promised pings or not

Source

pub const fn awareness_max_multiplier(&self) -> usize

Returns the awareness max multiplier

Source

pub const fn gossip_interval(&self) -> Duration

Returns the gossip interval

Source

pub const fn gossip_nodes(&self) -> usize

Returns the gossip nodes

Source

pub const fn gossip_to_the_dead_time(&self) -> Duration

Returns the gossip to the dead timeout

Source

pub const fn protocol_version(&self) -> ProtocolVersion

Returns the protocol version this node is speaking

Source

pub const fn delegate_version(&self) -> DelegateVersion

Returns the delegate version this node is speaking

Source

pub const fn handoff_queue_depth(&self) -> usize

Returns the handoff queue depth

Source

pub const fn dead_node_reclaim_time(&self) -> Duration

Returns the dead node reclaim time

Source

pub const fn queue_check_interval(&self) -> Duration

Returns the queue check interval

Source

pub const fn checksum_algo(&self) -> Option<ChecksumAlgorithm>

Returns the checksum algorithm for the packets sent through transport.

Source

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.

Source

pub const fn encryption_algo(&self) -> Option<EncryptionAlgorithm>

Returns the encryption algorithm for the messages sent through transport.

Source

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.

Source

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.

Source

pub const fn primary_key(&self) -> Option<&SecretKey>

Get the primary encryption key in a keyring.

Source

pub fn secret_keys(&self) -> &[SecretKey]

Get all of the encryption keys used internally.

Source

pub const fn compress_algo(&self) -> Option<CompressAlgorithm>

Returns the compress algorithm for the messages sent through transport.

Source

pub const fn metric_labels(&self) -> &Arc<MetricLabels>

Get the metric labels for the memberlist.

Source

pub fn with_label(self, val: Label) -> Options

Set the label of the node. (Builder pattern)

Source

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)

Source

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).

Source

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).

Source

pub const fn with_retransmit_mult(self, val: usize) -> Options

Sets the retransmit mult (Builder pattern).

Source

pub const fn with_suspicion_mult(self, val: usize) -> Options

Sets the suspicion mult (Builder pattern).

Source

pub const fn with_suspicion_max_timeout_mult(self, val: usize) -> Options

Sets the suspicion max timeout mult (Builder pattern).

Source

pub const fn with_push_pull_interval(self, val: Duration) -> Options

Sets the push pull interval (Builder pattern).

Source

pub const fn with_probe_interval(self, val: Duration) -> Options

Sets the probe interval (Builder pattern).

Source

pub const fn with_probe_timeout(self, val: Duration) -> Options

Sets the probe timeout (Builder pattern).

Source

pub const fn with_disable_reliable_pings(self, val: bool) -> Options

Sets whether disable promised pings or not (Builder pattern).

Source

pub const fn with_awareness_max_multiplier(self, val: usize) -> Options

Sets the awareness max multiplier (Builder pattern).

Source

pub const fn with_gossip_interval(self, val: Duration) -> Options

Sets the gossip interval (Builder pattern).

Source

pub const fn with_gossip_nodes(self, val: usize) -> Options

Sets the gossip nodes (Builder pattern).

Source

pub const fn with_gossip_to_the_dead_time(self, val: Duration) -> Options

Sets the gossip to the dead timeout (Builder pattern).

Source

pub const fn with_protocol_version(self, val: ProtocolVersion) -> Options

Sets the protocol version this node is speaking (Builder pattern).

Source

pub const fn with_delegate_version(self, val: DelegateVersion) -> Options

Sets the delegate version this node is speaking (Builder pattern).

Source

pub const fn with_handoff_queue_depth(self, val: usize) -> Options

Sets the handoff queue depth (Builder pattern).

Source

pub const fn with_dead_node_reclaim_time(self, val: Duration) -> Options

Sets the dead node reclaim time (Builder pattern).

Source

pub const fn with_queue_check_interval(self, val: Duration) -> Options

Sets the queue check interval (Builder pattern).

Source

pub const fn maybe_checksum_algo( self, val: Option<ChecksumAlgorithm>, ) -> Options

Sets the checksum algorithm for the packets sent through transport.

Source

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)

Source

pub const fn maybe_encryption_algo( self, val: Option<EncryptionAlgorithm>, ) -> Options

Sets the encryption algorithm for the messages sent through transport.

Source

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)

Source

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)

Source

pub fn maybe_primary_key(self, val: Option<SecretKey>) -> Options

Set the primary encryption key in a keyring. (Builder pattern)

Source

pub fn with_secret_keys(self, val: SecretKeys) -> Options

Set all of the encryption keys used internally. (Builder pattern)

Source

pub const fn maybe_compress_algo( self, val: Option<CompressAlgorithm>, ) -> Options

Sets the compress algorithm for the messages sent through transport.

Source

pub fn with_metric_labels(self, val: Arc<MetricLabels>) -> Options

Sets the metric labels for the memberlist.

Source§

impl Options

Source

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.

Source

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.

Source

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.

Source

pub fn with_compress_algo(self, compress_algo: CompressAlgorithm) -> Options

Set the compression algorithm for the messages sent through transport.

Source

pub fn with_checksum_algo(self, checksum_algo: ChecksumAlgorithm) -> Options

Set the checksum algorithm for the packets sent through transport.

Source

pub fn with_encryption_algo( self, encryption_algo: EncryptionAlgorithm, ) -> Options

Set the encryption algorithm for the messages sent through transport.

Source

pub fn with_primary_key(self, primary_key: SecretKey) -> Options

Set the primary encryption key in a keyring.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Options

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Options

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Options, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Options

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,