Function akka_persistence_rs::entity_manager::task_with_hasher
source · pub async fn task_with_hasher<A, B, S>(
behavior: B,
adapter: A,
receiver: Receiver<Message<B::Command>>,
entity_capacity: usize,
hash_builder: S
) -> Result<()>where
B: EventSourcedBehavior + Send + Sync + 'static,
B::Command: Send,
B::State: Send + Sync,
A: SourceProvider<B::Event> + Handler<B::Event> + Send + 'static,
S: BuildHasher + Send + Sync,
Expand description
Provides an asynchronous task and a command channel that can run and drive an entity manager.
Entity managers manage the lifecycle of entities given a specific behavior. They are established given an adapter of persistent events associated with an entity type. That source is consumed by subsequently telling the entity manager to run, generally on its own task. Events are persisted by calling on the adapter’s handler.
Commands are sent to a channel established for the entity manager. Effects may be produced as a result of performing a command, which may, in turn, perform side effects and yield events.
A hasher for entity ids can also be supplied which will be used to control the internal caching of entities.
entity_capacity
declares size of the number of entities to cache in memory at one time, and will panic at runtime if zero.