pub struct OwnedShardFraction { /* private fields */ }Expand description
This node’s owned-shard fraction of the cluster’s virtual shard space.
owned / total is the proportional slice of every tenant’s cluster-wide quota
this node enforces (CP-Phase-2 §3.6). A single-node / own-all deployment has
owned == total (fraction 1), so each per-node ceiling equals the full quota
and behaviour is byte-identical to no per-node split.
Implementations§
Source§impl OwnedShardFraction
impl OwnedShardFraction
Sourcepub fn new(owned: u32, total: u32) -> Self
pub fn new(owned: u32, total: u32) -> Self
Build a fraction from this node’s owned-shard count and the cluster shard count.
A total of zero is meaningless (the keyspace always has ≥1 shard); it is
clamped to 1 so the fraction is well-defined. owned is clamped to total
— a node never owns more than the whole keyspace — so the fraction is always
in (0, 1] and a per-node ceiling never exceeds the cluster-wide quota.
Sourcepub fn own_all() -> Self
pub fn own_all() -> Self
The whole cluster on one node (own-all): fraction 1, so a per-node ceiling equals the full cluster-wide quota. This is the single-node default and the byte-identical path.
Sourcepub fn per_node_ceiling(self, quota: u32) -> u32
pub fn per_node_ceiling(self, quota: u32) -> u32
ceil(quota × owned / total) — this node’s proportional slice of the
cluster-wide quota, rounded UP so the per-node ceilings sum to ≥ quota
(over-admit slightly under shard skew rather than starve — the right failure
direction with generous defaults, CP-Phase-2 §3.6).
Trait Implementations§
Source§impl Clone for OwnedShardFraction
impl Clone for OwnedShardFraction
Source§fn clone(&self) -> OwnedShardFraction
fn clone(&self) -> OwnedShardFraction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for OwnedShardFraction
Source§impl Debug for OwnedShardFraction
impl Debug for OwnedShardFraction
impl Eq for OwnedShardFraction
Source§impl PartialEq for OwnedShardFraction
impl PartialEq for OwnedShardFraction
impl StructuralPartialEq for OwnedShardFraction
Auto Trait Implementations§
impl Freeze for OwnedShardFraction
impl RefUnwindSafe for OwnedShardFraction
impl Send for OwnedShardFraction
impl Sync for OwnedShardFraction
impl Unpin for OwnedShardFraction
impl UnsafeUnpin for OwnedShardFraction
impl UnwindSafe for OwnedShardFraction
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request