pub struct ShardingHandle { /* private fields */ }Expand description
Running sharding region handle.
Implementations§
Source§impl ShardingHandle
impl ShardingHandle
Sourcepub async fn register_entity_type<M, F, B>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> B + Send + Sync + 'static,
B: EntityBehavior<M>,
pub async fn register_entity_type<M, F, B>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> B + Send + Sync + 'static,
B: EntityBehavior<M>,
Register an entity type with a Ractor-backed factory.
Sourcepub async fn register_actor_entity_type<M, F, A>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> A + Send + Sync + 'static,
A: ActorEntity<M>,
pub async fn register_actor_entity_type<M, F, A>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> A + Send + Sync + 'static,
A: ActorEntity<M>,
Register an entity type whose factory creates a spawnable actor entity.
The factory mirrors Akka Cluster Sharding’s
EntityContext<M> => Behavior<M> boundary: it is invoked once for each
entity incarnation, and ActorEntity::spawn returns the typed mailbox
ingress used for routing M. Passivation and handoff stop that actor. A
self-stopped actor remains stopped until the next delivery, which creates
a new incarnation without retrying the message that caused the stop.
Sourcepub async fn register_remembered_entity_type<M, F, B>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> B + Send + Sync + 'static,
B: EntityBehavior<M>,
pub async fn register_remembered_entity_type<M, F, B>(
&self,
type_name: impl Into<String>,
factory: F,
) -> ShardingResult<()>where
M: Serialize + DeserializeOwned + Send + 'static,
F: Fn(EntityContext) -> B + Send + Sync + 'static,
B: EntityBehavior<M>,
Register an entity type with remember-entities enabled.
The region must be configured with RememberEntitiesConfig::with_store
or registration fails. Remembered entities are spawned automatically when
their shard starts locally after rebalance, restart recovery, or
coordinator takeover. Passivation removes the id from the remember store;
ordinary actor failure/restart and node stop do not.
Sourcepub fn subscribe_remember_entities_events(
&self,
) -> Receiver<RememberEntitiesEvent>
pub fn subscribe_remember_entities_events( &self, ) -> Receiver<RememberEntitiesEvent>
Subscribe to remember-entities store failure events.
Sourcepub async fn flush_remember_entities(&self) -> ShardingResult<()>
pub async fn flush_remember_entities(&self) -> ShardingResult<()>
Wait until previously queued remember-entities writes have been processed.
Sourcepub fn entity_ref<M>(
&self,
type_name: impl Into<String>,
entity_id: impl Into<String>,
) -> EntityRef<M>
pub fn entity_ref<M>( &self, type_name: impl Into<String>, entity_id: impl Into<String>, ) -> EntityRef<M>
Return an entity ref using the configured default extractor.
Sourcepub fn entity_ref_with_extractor<M, E>(
&self,
type_name: impl Into<String>,
entity_id: impl Into<String>,
extractor: Arc<E>,
) -> EntityRef<M>
pub fn entity_ref_with_extractor<M, E>( &self, type_name: impl Into<String>, entity_id: impl Into<String>, extractor: Arc<E>, ) -> EntityRef<M>
Return an entity ref using a custom extractor.
Sourcepub async fn allocation_table(
&self,
type_name: impl Into<String>,
) -> ShardingResult<ShardAllocationTable>
pub async fn allocation_table( &self, type_name: impl Into<String>, ) -> ShardingResult<ShardAllocationTable>
Return the cached allocation table known by this region.
Sourcepub async fn rebalance_rounds(&self) -> ShardingResult<Vec<RebalanceRound>>
pub async fn rebalance_rounds(&self) -> ShardingResult<Vec<RebalanceRound>>
Return rebalance rounds recorded by this region when it was coordinator.
Trait Implementations§
Source§impl Clone for ShardingHandle
impl Clone for ShardingHandle
Source§fn clone(&self) -> ShardingHandle
fn clone(&self) -> ShardingHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more