pub struct PinnedAllocationStrategy {
pub region: String,
}Expand description
Pin every shard to a specific region (useful for tests / static allocation). analog: a custom strategy returning a constant region.
Fields§
§region: StringTrait Implementations§
Source§impl ShardAllocationStrategy for PinnedAllocationStrategy
impl ShardAllocationStrategy for PinnedAllocationStrategy
Source§fn allocate_shard(
&self,
_shard_id: &str,
_regions: &HashMap<String, usize>,
) -> Option<String>
fn allocate_shard( &self, _shard_id: &str, _regions: &HashMap<String, usize>, ) -> Option<String>
Pick a region to host
shard_id. regions lists known
candidates (region path → current shard count). Returns the
chosen region’s path, or None if regions is empty.Source§fn rebalance(
&self,
_current: &HashMap<String, String>,
_regions: &HashMap<String, usize>,
) -> Vec<String>
fn rebalance( &self, _current: &HashMap<String, String>, _regions: &HashMap<String, usize>, ) -> Vec<String>
Decide which shards should migrate.
current_allocations is
the shard → region mapping; regions lists region shard
counts. Returns shard ids to hand off (the coordinator picks
the destination).Auto Trait Implementations§
impl Freeze for PinnedAllocationStrategy
impl RefUnwindSafe for PinnedAllocationStrategy
impl Send for PinnedAllocationStrategy
impl Sync for PinnedAllocationStrategy
impl Unpin for PinnedAllocationStrategy
impl UnsafeUnpin for PinnedAllocationStrategy
impl UnwindSafe for PinnedAllocationStrategy
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