pub enum Distribution {
Vnode,
Ketama,
Modula,
Random,
RandomSlicing,
}Expand description
Distribution algorithm selected by the pool’s distribution:
directive.
Vnode is the historical default and the only mode the C
reference engine supported in the Rust port until
RandomSlicing was added. Ketama, Modula, and Random
are accepted for backward compatibility with the C
configuration vocabulary; they collapse to Vnode at
runtime and emit a deprecation warning at config-load time.
§Examples
use dynomite::conf::Distribution;
assert_eq!(Distribution::parse("vnode").unwrap(), Distribution::Vnode);
assert_eq!(
Distribution::parse("random_slicing").unwrap(),
Distribution::RandomSlicing
);Variants§
Vnode
Per-rack continuum keyed by per-peer token lists. The historical default.
Ketama
Compatibility alias accepted by the C reference; collapsed
to Self::Vnode at runtime with a deprecation warning.
Modula
Compatibility alias accepted by the C reference; collapsed
to Self::Vnode at runtime with a deprecation warning.
Random
Compatibility alias accepted by the C reference; collapsed
to Self::Vnode at runtime with a deprecation warning.
RandomSlicing
Random-slicing distribution: a small, gap-free (name, size) partition table over the 64-bit hash space. See
crate::hashkit::random_slicing.
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn parse(s: &str) -> Result<Self, ConfError>
pub fn parse(s: &str) -> Result<Self, ConfError>
Parse a distribution: value (case-insensitive).
§Errors
Returns ConfError::BadDistribution when the value is
not a recognised mode.
§Examples
use dynomite::conf::Distribution;
assert_eq!(Distribution::parse("VNODE").unwrap(), Distribution::Vnode);
assert!(Distribution::parse("sphere").is_err());Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Render back to the canonical YAML name.
§Examples
use dynomite::conf::Distribution;
assert_eq!(Distribution::Vnode.as_str(), "vnode");
assert_eq!(Distribution::RandomSlicing.as_str(), "random_slicing");Sourcepub const fn is_supported(self) -> bool
pub const fn is_supported(self) -> bool
True for the modes that survived the C-to-Rust port
untouched; Ketama, Modula, and Random are accepted
for backward compatibility but collapse to Vnode at
runtime.
§Examples
use dynomite::conf::Distribution;
assert!(Distribution::Vnode.is_supported());
assert!(Distribution::RandomSlicing.is_supported());
assert!(!Distribution::Ketama.is_supported());Trait Implementations§
Source§impl Clone for Distribution
impl Clone for Distribution
Source§fn clone(&self) -> Distribution
fn clone(&self) -> Distribution
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 Distribution
impl Debug for Distribution
Source§impl Default for Distribution
impl Default for Distribution
Source§impl<'de> Deserialize<'de> for Distribution
impl<'de> Deserialize<'de> for Distribution
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Source§impl Display for Distribution
impl Display for Distribution
Source§impl Hash for Distribution
impl Hash for Distribution
Source§impl PartialEq for Distribution
impl PartialEq for Distribution
Source§fn eq(&self, other: &Distribution) -> bool
fn eq(&self, other: &Distribution) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Distribution
impl Serialize for Distribution
impl Copy for Distribution
impl Eq for Distribution
impl StructuralPartialEq for Distribution
Auto Trait Implementations§
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnsafeUnpin for Distribution
impl UnwindSafe for Distribution
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.