Expand description
atomr-cluster-sharding adapter for super::PlacementActor.
Bridges the GPU-fleet placement layer to atomr’s typed sharding
primitives. Callers wrap their crate::device::DeviceMsg with a
[RoutedDeviceMsg { entity_id, msg }] envelope, and the adapter
exposes an [EntityRef<DeviceExtractor>] whose tell routes the
message to the device owning that entity id.
This enables:
- Cluster-wide shard handoff if/when a remote forwarder is wired in
via [
ShardRegion::set_remote_forwarder]. - Consistent placement: identical
entity_ids always land on the same device, even across restarts of the calling code.
The current implementation uses a simple FxHash-mod-N consistent
routing policy (no live-load awareness). A follow-up can install a
custom [ShardCoordinator]-driven allocation strategy that polls
the underlying super::PlacementActor’s load snapshot.
Structs§
- Device
Extractor MessageExtractorimpl forRoutedDeviceMsg. Hashesentity_idinto one ofshard_countshards.- Placement
Sharding Adapter - Adapter that publishes a [
ShardRegion<DeviceExtractor>] backed by a fixed pool of pre-spawnedDeviceActorrefs. Each shard maps to one device viashard_index % devices.len(), so identicalentity_ids always reach the same device. - Routed
Device Msg - Envelope used by the sharding adapter. Wraps an underlying
DeviceMsgwith the entity id the caller wants the message to be routed by. The adapter’sMessageExtractorreadsentity_idto pick the destination shard / device.