pub struct RangeOwnership { /* private fields */ }Expand description
One owned shard/range: the catalog’s unit of routing and fencing.
An entry is self-describing — it carries its collection, range id, mode,
bounds, owner, replicas, epoch, version, and placement — so a data member
that receives it by replication can route and fence without consulting any
other state. New ownership states are produced as transitions off an
existing entry (transfer_to,
update_replicas,
update_placement), each of which advances the
version — and, for an owner change, the fencing epoch.
Implementations§
Source§impl RangeOwnership
impl RangeOwnership
Sourcepub fn establish(
collection: CollectionId,
range_id: RangeId,
shard_key_mode: ShardKeyMode,
bounds: RangeBounds,
owner: NodeIdentity,
replicas: impl IntoIterator<Item = NodeIdentity>,
placement: PlacementMetadata,
) -> RangeOwnership
pub fn establish( collection: CollectionId, range_id: RangeId, shard_key_mode: ShardKeyMode, bounds: RangeBounds, owner: NodeIdentity, replicas: impl IntoIterator<Item = NodeIdentity>, placement: PlacementMetadata, ) -> RangeOwnership
The initial ownership state for a freshly created range: version and
epoch both at their initial values.
pub fn collection(&self) -> &CollectionId
pub fn range_id(&self) -> RangeId
pub fn shard_key_mode(&self) -> ShardKeyMode
pub fn bounds(&self) -> &RangeBounds
pub fn owner(&self) -> &NodeIdentity
pub fn replicas(&self) -> &[NodeIdentity]
pub fn epoch(&self) -> OwnershipEpoch
pub fn version(&self) -> CatalogVersion
pub fn placement(&self) -> &PlacementMetadata
Sourcepub fn transfer_to(
&self,
new_owner: NodeIdentity,
new_replicas: impl IntoIterator<Item = NodeIdentity>,
) -> RangeOwnership
pub fn transfer_to( &self, new_owner: NodeIdentity, new_replicas: impl IntoIterator<Item = NodeIdentity>, ) -> RangeOwnership
A transition that moves write authority to new_owner with new_replicas.
Advances both the version (it is a catalog write) and the ownership
epoch (write authority moved, so any old owner is fenced).
Sourcepub fn update_replicas(
&self,
new_replicas: impl IntoIterator<Item = NodeIdentity>,
) -> RangeOwnership
pub fn update_replicas( &self, new_replicas: impl IntoIterator<Item = NodeIdentity>, ) -> RangeOwnership
A transition that changes only the replica set. Advances the version but not the epoch: write authority did not move, so no owner is fenced.
Sourcepub fn update_placement(&self, placement: PlacementMetadata) -> RangeOwnership
pub fn update_placement(&self, placement: PlacementMetadata) -> RangeOwnership
A transition that changes only placement metadata. Advances the version but not the epoch.
Trait Implementations§
Source§impl Clone for RangeOwnership
impl Clone for RangeOwnership
Source§fn clone(&self) -> RangeOwnership
fn clone(&self) -> RangeOwnership
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 RangeOwnership
impl Debug for RangeOwnership
impl Eq for RangeOwnership
Source§impl PartialEq for RangeOwnership
impl PartialEq for RangeOwnership
Source§fn eq(&self, other: &RangeOwnership) -> bool
fn eq(&self, other: &RangeOwnership) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RangeOwnership
Auto Trait Implementations§
impl Freeze for RangeOwnership
impl RefUnwindSafe for RangeOwnership
impl Send for RangeOwnership
impl Sync for RangeOwnership
impl Unpin for RangeOwnership
impl UnsafeUnpin for RangeOwnership
impl UnwindSafe for RangeOwnership
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§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