pub struct ConfBucketType {
pub name: String,
pub read_consistency: String,
pub write_consistency: String,
pub n_val: u8,
}Expand description
Routing-property bundle attached to a key bucket.
Bucket types let operators give different key classes
different SLAs without running multiple pools. Cache-style
keys can pin to DC_ONE while transactional keys sit on
DC_EACH_SAFE_QUORUM; the same dynomited binary serves both.
n_val caps the replica fan-out for the lifetime of one
request: when the topology offers more replicas than n_val,
the dispatcher takes the first n_val (the existing rack /
DC ordering puts preferred replicas first). A value of 0
means “no cap” and is treated identically to omitting the
field.
§Examples
use dynomite::conf::{ConfBucketType, ConsistencyLevel};
let bt = ConfBucketType {
name: "sessions".into(),
read_consistency: "DC_QUORUM".into(),
write_consistency: "DC_EACH_SAFE_QUORUM".into(),
n_val: 3,
};
assert_eq!(bt.name, "sessions");
assert_eq!(
ConsistencyLevel::parse("read_consistency", &bt.read_consistency).unwrap(),
ConsistencyLevel::DcQuorum,
);
assert_eq!(bt.n_val, 3);Fields§
§name: StringBucket name. Compared verbatim against the bytes returned
by crate::proto::redis::bucket_name; no normalisation
is performed. Names must be unique within a pool and must
not be empty.
read_consistency: StringRead-side consistency level for keys in this bucket.
Stored as a string so the YAML round-trip is
human-readable; parsed via
ConsistencyLevel::parse
during validation.
write_consistency: StringWrite-side consistency level for keys in this bucket.
See ConfBucketType::read_consistency.
n_val: u8Replication-factor cap. The dispatcher trims its replica
fan-out to at most this many targets. 0 means “no cap”;
any positive value caps the fan-out to the leading
n_val peers (rack-local first).
Implementations§
Source§impl ConfBucketType
impl ConfBucketType
Sourcepub fn read_level(&self) -> Result<ConsistencyLevel, ConfError>
pub fn read_level(&self) -> Result<ConsistencyLevel, ConfError>
Parse Self::read_consistency into the typed enum.
§Examples
use dynomite::conf::{ConfBucketType, ConsistencyLevel};
let bt = ConfBucketType {
name: "s".into(),
read_consistency: "DC_QUORUM".into(),
write_consistency: "DC_ONE".into(),
n_val: 0,
};
assert_eq!(bt.read_level().unwrap(), ConsistencyLevel::DcQuorum);Sourcepub fn write_level(&self) -> Result<ConsistencyLevel, ConfError>
pub fn write_level(&self) -> Result<ConsistencyLevel, ConfError>
Parse Self::write_consistency into the typed enum.
§Examples
use dynomite::conf::{ConfBucketType, ConsistencyLevel};
let bt = ConfBucketType {
name: "s".into(),
read_consistency: "DC_ONE".into(),
write_consistency: "DC_SAFE_QUORUM".into(),
n_val: 0,
};
assert_eq!(bt.write_level().unwrap(), ConsistencyLevel::DcSafeQuorum);Trait Implementations§
Source§impl Clone for ConfBucketType
impl Clone for ConfBucketType
Source§fn clone(&self) -> ConfBucketType
fn clone(&self) -> ConfBucketType
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 ConfBucketType
impl Debug for ConfBucketType
Source§impl<'de> Deserialize<'de> for ConfBucketType
impl<'de> Deserialize<'de> for ConfBucketType
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>,
Source§impl PartialEq for ConfBucketType
impl PartialEq for ConfBucketType
Source§fn eq(&self, other: &ConfBucketType) -> bool
fn eq(&self, other: &ConfBucketType) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ConfBucketType
impl Serialize for ConfBucketType
impl Eq for ConfBucketType
impl StructuralPartialEq for ConfBucketType
Auto Trait Implementations§
impl Freeze for ConfBucketType
impl RefUnwindSafe for ConfBucketType
impl Send for ConfBucketType
impl Sync for ConfBucketType
impl Unpin for ConfBucketType
impl UnsafeUnpin for ConfBucketType
impl UnwindSafe for ConfBucketType
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.