Liking cljdoc? Tell your friends :D

d-core.libs.workers


bump!clj

(bump! stats path)

Increment a stats counter at the given nested path.

Increment a stats counter at the given nested path.
raw docstring

channel-bufferclj

(channel-buffer {:keys [buffer buffer-type]})

Return a core.async buffer for channel config.

Supported keys:

  • :buffer (size, default 0)
  • :buffer-type (:fixed | :dropping | :sliding, default :fixed) A :buffer of 0 returns an unbuffered channel.
Return a core.async buffer for channel config.

Supported keys:
- :buffer (size, default 0)
- :buffer-type (:fixed | :dropping | :sliding, default :fixed)
A :buffer of 0 returns an unbuffered channel.
raw docstring

command!clj

(command! system worker-id msg)

Send a message to an exposed worker using its configured :put-mode.

:put-mode can be:

  • :async (default) -> async/put!
  • :block -> blocking >!!
  • :drop -> non-blocking offer! with drop event
Send a message to an exposed worker using its configured :put-mode.

:put-mode can be:
- :async (default) -> async/put!
- :block -> blocking >!!
- :drop -> non-blocking offer! with drop event
raw docstring

deliver-output!clj

(deliver-output! out-chan value {:keys [worker-id output-chan-id stats emit]})

Attempt to deliver a worker result to an output channel without blocking.

When the output channel is full, records a drop and emits an event.

Attempt to deliver a worker result to an output channel without blocking.

When the output channel is full, records a drop and emits an event.
raw docstring

emit!clj

(emit! emit event)

Emit an event through the provided emitter, if any.

Emit an event through the provided emitter, if any.
raw docstring

error-eventclj

(error-event ctx msg ex)

Build a structured error event from worker context + exception.

Build a structured error event from worker context + exception.
raw docstring

exposed-chanclj

(exposed-chan system worker-id)

Return the underlying channel for an exposed worker.

Return the underlying channel for an exposed worker.
raw docstring

exposed-channelsclj

(exposed-channels definition channels)

Return a map of exposed worker-id -> {:channel ... :channel-id ... :put-mode ...}.

Return a map of exposed worker-id -> {:channel ... :channel-id ... :put-mode ...}.
raw docstring

guarded-go-callclj

(guarded-go-call worker-fn ctx msg {:keys [guard-ms]})

Run a worker function inside a go block and fail if it exceeds guard-ms.

This must be invoked from within a go context.

Run a worker function inside a go block and fail if it exceeds guard-ms.

This must be invoked from within a go context.
raw docstring

handle-worker-error!clj

(handle-worker-error! ctx msg ex {:keys [stats emit fail-chan fail-chan-id]})

Handle a worker error by emitting a structured event and optionally forwarding it to a fail channel.

Handle a worker error by emitting a structured event and optionally
forwarding it to a fail channel.
raw docstring

make-channelsclj

(make-channels channels)

Build a map of channel-id -> core.async channel from a channels config map.

Build a map of channel-id -> core.async channel from a channels config map.
raw docstring

record-drop!clj

(record-drop! stats emit {:keys [worker-id channel-id reason]})

Record a drop counter and emit a :workers.drop event.

Record a drop counter and emit a :workers.drop event.
raw docstring

record-error!clj

(record-error! stats emit event)

Record an error counter and emit a :workers.error event.

Record an error counter and emit a :workers.error event.
raw docstring

request!clj

(request! system worker-id msg)

Send a message with a reply-chan and return the reply-chan.

Send a message with a reply-chan and return the reply-chan.
raw docstring

resolve-emitterclj

(resolve-emitter components)

Resolve an emitter function from components.

Accepted shapes:

  • components {:observability <fn|{:emit fn}>}
  • components {:obs <fn|{:emit fn}>}
  • components {:logger <fn|{:log fn}>}
Resolve an emitter function from components.

Accepted shapes:
- components {:observability <fn|{:emit fn}>}
- components {:obs <fn|{:emit fn}>}
- components {:logger <fn|{:log fn}>}
raw docstring

start-command-workerclj

(start-command-worker worker ctx {:keys [dev-guard? guard-ms stats emit]})

Start a command worker that consumes from :in and invokes :worker-fn.

Supported keys on worker:

  • :dispatch (:go | :thread, default :go)
  • :output-chan (optional channel-id for results)
  • :fail-chan (optional channel-id for error events)
Start a command worker that consumes from :in and invokes :worker-fn.

Supported keys on worker:
- :dispatch (:go | :thread, default :go)
- :output-chan (optional channel-id for results)
- :fail-chan (optional channel-id for error events)
raw docstring

start-ticker-workerclj

(start-ticker-worker worker ctx stop-chan)

Start a ticker worker that emits ticks to :out at :interval-ms until stop.

Tick delivery is best-effort and non-blocking; when the output channel is full, ticks may be dropped and a drop event recorded (if stats/emit are provided).

Start a ticker worker that emits ticks to :out at :interval-ms until stop.

Tick delivery is best-effort and non-blocking; when the output channel is
full, ticks may be dropped and a drop event recorded (if stats/emit are
provided).
raw docstring

start-worker-by-kindcljmultimethod

Dispatch worker startup by :kind

Dispatch worker startup by :kind
raw docstring

start-workersclj

(start-workers definition components)
(start-workers definition components {:keys [dev-guard? guard-ms]})

Start a workers runtime.

Returns {:channels ... :exposed ... :stats ... :emit ... :stop! ...}.

Start a workers runtime.

Returns {:channels ... :exposed ... :stats ... :emit ... :stop! ...}.
raw docstring

stats-snapshotclj

(stats-snapshot system)

Return a snapshot of stats counters for drops and errors.

Return a snapshot of stats counters for drops and errors.
raw docstring

worker-ctxclj

(worker-ctx components channels worker-id worker)

Build the worker context map passed to worker functions.

Build the worker context map passed to worker functions.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close