ReceptorAsync<C extends Cell> class
An asynchronous execution handle for a Receptor that facilitates non‑blocking pulse processing and lifecycle synchronization.
ReceptorAsync provides a Future-based API for interacting with cells,
ensuring that reactive signals can be injected from asynchronous contexts
while maintaining strict causal order and transactional integrity.
When to use
Use the async view when you need to bridge asynchronous events into the reactive graph.
- Event Integration: Injecting pulses from timers, network responses, or user interactions.
- Deterministic Testing: Waiting for a reactive wave to fully settle before asserting results.
- Backpressure Management: Coordinating sequential updates in high- throughput scenarios.
How it works
- Queueing: Pulses are added to a thread-safe internal queue to preserve the order of arrival.
- Sequential Processing: A worker drains the queue, executing each pulse within the cell's atomic perimeter using the synchronous pipeline.
- Future Mapping: It converts the receptor's synchronous logic into a guaranteed Future-based API.
- Synchronized Completion: It can optionally wait for every downstream synapse to finish propagation before resolving.
Non‑obvious
- Memory Awareness: The internal buffer is unbounded; high-frequency bursts without proper awaiting can lead to memory pressure.
- Causal Consistency: By default, it preserves the order of signals even if the underlying transformations are asynchronous.
- Atomicity: Even when called asynchronously, the actual state transition is protected by the cell's lock, preventing race conditions.
- Identity Integrity: The async handle is a stateless proxy; it shares the same operational context and metadata as the primary receptor.
- Synchronous Pipeline: The underlying pipeline executes synchronously. The async adapter only manages the execution timing and completion.
Type Parameters:
C: The type of the host Cell.
Example: Fire-and-Forget
receptor.async.call(Pulse('Update'));
Example: Await Full Propagation
await receptor.async.call(Pulse('Critical'), serializedCompletion: true);
// At this point, the entire downstream graph has settled.
See also:
- Receptor.async – The getter that provides this handle.
- Implemented types
Constructors
-
ReceptorAsync(ReceptorBase<
C> receptor) - Creates an asynchronous adapter for a synchronous Receptor.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
Pulse incoming, {bool serializedCompletion = true, void hook({required Pulse input, Pulse? result})?}) → Future< void> - Injects a pulse into the receptor's transformation pipeline asynchronously.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited