pub struct DataPartitioner { /* private fields */ }Expand description
Data partitioning and sharding system
Implementations§
Source§impl DataPartitioner
impl DataPartitioner
Sourcepub fn new(
strategy: PartitioningStrategy,
partition_count: usize,
replication_factor: usize,
) -> Self
pub fn new( strategy: PartitioningStrategy, partition_count: usize, replication_factor: usize, ) -> Self
Create new data partitioner
Sourcepub fn get_partition(&self, key: &str) -> usize
pub fn get_partition(&self, key: &str) -> usize
Determine partition for data key
Sourcepub fn get_partition_nodes(&self, partition: usize) -> Vec<String>
pub fn get_partition_nodes(&self, partition: usize) -> Vec<String>
Get nodes responsible for partition
Sourcepub fn assign_partition(&mut self, partition: usize, node_id: String)
pub fn assign_partition(&mut self, partition: usize, node_id: String)
Assign partition to node
Sourcepub fn rebalance_partitions(
&mut self,
available_nodes: &[String],
) -> PartitioningResult
pub fn rebalance_partitions( &mut self, available_nodes: &[String], ) -> PartitioningResult
Rebalance partitions across nodes
Auto Trait Implementations§
impl Freeze for DataPartitioner
impl RefUnwindSafe for DataPartitioner
impl Send for DataPartitioner
impl Sync for DataPartitioner
impl Unpin for DataPartitioner
impl UnwindSafe for DataPartitioner
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
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>
Converts
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>
Converts
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 more