pub struct RangeAssigner<WorkerId> { /* private fields */ }Expand description
Assigns ordered key ranges to workers.
Implementations§
Source§impl<WorkerId: Clone> RangeAssigner<WorkerId>
impl<WorkerId: Clone> RangeAssigner<WorkerId>
Sourcepub fn assign(
&mut self,
range: Range<Vec<u8>>,
worker: WorkerId,
) -> Result<(), ShardError>
pub fn assign( &mut self, range: Range<Vec<u8>>, worker: WorkerId, ) -> Result<(), ShardError>
Assigns range to worker.
Sourcepub fn try_assign(
&mut self,
range: Range<Vec<u8>>,
worker: WorkerId,
) -> Result<(), ShardError>
pub fn try_assign( &mut self, range: Range<Vec<u8>>, worker: WorkerId, ) -> Result<(), ShardError>
Backwards-compatible alias for assign.
Sourcepub fn reassign_start(
&mut self,
start: &[u8],
worker: WorkerId,
) -> Result<(), ShardError>
pub fn reassign_start( &mut self, start: &[u8], worker: WorkerId, ) -> Result<(), ShardError>
Reassigns the range that starts at start to worker.
Sourcepub fn split_at(
&mut self,
range_start: &[u8],
split_key: Vec<u8>,
right_worker: WorkerId,
) -> Result<(), ShardError>
pub fn split_at( &mut self, range_start: &[u8], split_key: Vec<u8>, right_worker: WorkerId, ) -> Result<(), ShardError>
Splits the range beginning at range_start at split_key.
Sourcepub fn worker_for<K: LexicographicKey + ?Sized>(
&self,
key: &K,
) -> Option<&WorkerId>
pub fn worker_for<K: LexicographicKey + ?Sized>( &self, key: &K, ) -> Option<&WorkerId>
Looks up the worker for a typed lexicographic key.
Sourcepub fn worker_for_encoded(&self, encoded: &[u8]) -> Option<&WorkerId>
pub fn worker_for_encoded(&self, encoded: &[u8]) -> Option<&WorkerId>
Looks up the worker for an already encoded key.
Sourcepub fn assignments(
&self,
) -> impl Iterator<Item = (&Vec<u8>, &RangeAssignment<WorkerId>)>
pub fn assignments( &self, ) -> impl Iterator<Item = (&Vec<u8>, &RangeAssignment<WorkerId>)>
Returns all range assignments keyed by inclusive start key.
Trait Implementations§
Source§impl<WorkerId: Clone> Clone for RangeAssigner<WorkerId>
impl<WorkerId: Clone> Clone for RangeAssigner<WorkerId>
Source§fn clone(&self) -> RangeAssigner<WorkerId>
fn clone(&self) -> RangeAssigner<WorkerId>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<WorkerId: Debug> Debug for RangeAssigner<WorkerId>
impl<WorkerId: Debug> Debug for RangeAssigner<WorkerId>
Source§impl<WorkerId: Default> Default for RangeAssigner<WorkerId>
impl<WorkerId: Default> Default for RangeAssigner<WorkerId>
Source§fn default() -> RangeAssigner<WorkerId>
fn default() -> RangeAssigner<WorkerId>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<WorkerId> Freeze for RangeAssigner<WorkerId>
impl<WorkerId> RefUnwindSafe for RangeAssigner<WorkerId>where
WorkerId: RefUnwindSafe,
impl<WorkerId> Send for RangeAssigner<WorkerId>where
WorkerId: Send,
impl<WorkerId> Sync for RangeAssigner<WorkerId>where
WorkerId: Sync,
impl<WorkerId> Unpin for RangeAssigner<WorkerId>
impl<WorkerId> UnsafeUnpin for RangeAssigner<WorkerId>
impl<WorkerId> UnwindSafe for RangeAssigner<WorkerId>where
WorkerId: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more