pub struct ShardManager { /* private fields */ }Expand description
Shard manager for handling sharding operations
Implementations§
Source§impl ShardManager
impl ShardManager
Sourcepub fn new(config: ShardingConfig) -> Self
pub fn new(config: ShardingConfig) -> Self
Create a new shard manager
Sourcepub fn initialize(&mut self, nodes: Vec<String>) -> Result<()>
pub fn initialize(&mut self, nodes: Vec<String>) -> Result<()>
Initialize sharding with available nodes
Sourcepub fn find_shard(&self, key: &str) -> Result<String>
pub fn find_shard(&self, key: &str) -> Result<String>
Find the shard for a given key
Sourcepub fn get_node_for_key(&self, key: &str) -> Result<String>
pub fn get_node_for_key(&self, key: &str) -> Result<String>
Get the node responsible for a key
Sourcepub fn remove_node(&mut self, node_id: &str) -> Result<()>
pub fn remove_node(&mut self, node_id: &str) -> Result<()>
Remove a node from the cluster
Sourcepub fn migrate_shard(
&mut self,
shard_id: &str,
target_node: Option<String>,
) -> Result<String>
pub fn migrate_shard( &mut self, shard_id: &str, target_node: Option<String>, ) -> Result<String>
Migrate a shard to a different node
Sourcepub fn complete_migration(&mut self, migration_id: &str) -> Result<()>
pub fn complete_migration(&mut self, migration_id: &str) -> Result<()>
Complete a migration
Sourcepub fn get_stats(&self) -> ShardingStats
pub fn get_stats(&self) -> ShardingStats
Get sharding statistics
Sourcepub fn list_shards(&self) -> Vec<DataShard>
pub fn list_shards(&self) -> Vec<DataShard>
List all shards
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShardManager
impl RefUnwindSafe for ShardManager
impl Send for ShardManager
impl Sync for ShardManager
impl Unpin for ShardManager
impl UnwindSafe for ShardManager
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.