Imperative shell for dj.concurrency: the impure runtime that owns the event
queue, spawns virtual threads, and interprets directives. Everything with a
side effect lives here; the pure decision-making lives in
dj.concurrency.policy.
The shell communicates with the policy through two positional pairs that travel across the queue verbatim:
NOTE: the qualified keyword :dj.concurrency/shutdown is part of the public
contract (consumers match on (:type (ex-data e))). It is keyed to the
dj.concurrency namespace, so it is written out in full rather than with
:: auto-resolution (which would key it to THIS namespace).
Imperative shell for dj.concurrency: the impure runtime that owns the event queue, spawns virtual threads, and interprets directives. Everything with a side effect lives here; the pure decision-making lives in `dj.concurrency.policy`. The shell communicates with the policy through two positional pairs that travel across the queue verbatim: - events [event-type payload-map] - directives [directive-type payload-map] Every other value here is a MAP (policy results, internal shell bindings) so the code reads by key rather than by position. NOTE: the qualified keyword `:dj.concurrency/shutdown` is part of the public contract (consumers match on `(:type (ex-data e))`). It is keyed to the `dj.concurrency` namespace, so it is written out in full rather than with `::` auto-resolution (which would key it to THIS namespace).
(run-shell! {:keys [queue state policy shutdown-promise] :as sup})Starts the supervisor's single-threaded event loop on a Virtual Thread.
sup must contain: {:queue BlockingQueue, :state Atom, :policy IFn,
:event-tap IFn, :shutdown-promise promise}.
The policy is called as (policy event state) and must return a map
{:directives [...] :state new-state}.
Starts the supervisor's single-threaded event loop on a Virtual Thread.
`sup` must contain: {:queue BlockingQueue, :state Atom, :policy IFn,
:event-tap IFn, :shutdown-promise promise}.
The policy is called as `(policy event state)` and must return a map
`{:directives [...] :state new-state}`.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |