pub struct MemoryActors { /* private fields */ }Expand description
An in-process Actors host for module tests (issue #583): one
serialized actor per (kind, key), its values in memory, its one alarm
driven by a ManualClock the test advances.
It dispatches to the ActorHandlers a venture registered and owns the
serialization core leaves to the host: a call takes its actor’s async lock
for the whole of run_actor_message, so two calls to one actor run one
at a time, and an unknown kind is ActorError::NotConfigured, as a host
with no handler is.
Implementations§
Source§impl MemoryActors
impl MemoryActors
Sourcepub fn new(handlers: ActorHandlers, clock: ManualClock) -> Self
pub fn new(handlers: ActorHandlers, clock: ManualClock) -> Self
A host that dispatches to handlers and reads clock, which its
alarms are measured against.
Sourcepub async fn advance(&self, by: Duration)
pub async fn advance(&self, by: Duration)
Moves the clock forward by by, then runs every alarm due at the new
instant under its actor’s lock — the way a real host wakes a Durable
Object when its alarm passes.
An alarm a handler re-arms into the past or now fires again in the
same call, up to MAX_ALARMS_PER_ADVANCE; one whose handler fails
stays armed for the next advance.