pub struct PlacementShardingAdapter { /* private fields */ }Expand description
Adapter that publishes a [ShardRegion<DeviceExtractor>] backed by
a fixed pool of pre-spawned DeviceActor
refs. Each shard maps to one device via shard_index % devices.len(),
so identical entity_ids always reach the same device.
Implementations§
Source§impl PlacementShardingAdapter
impl PlacementShardingAdapter
Sourcepub fn start(
region_id: impl Into<String>,
devices: Vec<ActorRef<DeviceMsg>>,
shard_count: usize,
) -> Self
pub fn start( region_id: impl Into<String>, devices: Vec<ActorRef<DeviceMsg>>, shard_count: usize, ) -> Self
Build the adapter from a fleet of device refs. region_id is
the cluster-visible name of this region (mirrors akka.net’s
type-name parameter to ClusterSharding.Start(...)).
shard_count controls the routing granularity; larger values
distribute consecutive entity ids more evenly. Defaults to the
number of devices when zero.
Sourcepub fn entity(&self, entity_id: impl Into<String>) -> EntityRef<DeviceExtractor>
pub fn entity(&self, entity_id: impl Into<String>) -> EntityRef<DeviceExtractor>
Build a typed handle to a particular entity.
Sourcepub fn region(&self) -> Arc<ShardRegion<DeviceExtractor>>
pub fn region(&self) -> Arc<ShardRegion<DeviceExtractor>>
Direct access to the underlying [ShardRegion] — useful for
installing a remote forwarder or inspecting shard counts.
Auto Trait Implementations§
impl Freeze for PlacementShardingAdapter
impl !RefUnwindSafe for PlacementShardingAdapter
impl Send for PlacementShardingAdapter
impl Sync for PlacementShardingAdapter
impl Unpin for PlacementShardingAdapter
impl UnsafeUnpin for PlacementShardingAdapter
impl !UnwindSafe for PlacementShardingAdapter
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