Unit-agnostic budget gate. 1 permit = 1 unit; caller picks the unit (bytes/MiB/slots/etc). Saturation policy: block up to :timeout-ms, then (r/err :budget/timeout ...).
Unit-agnostic budget gate. 1 permit = 1 unit; caller picks the unit (bytes/MiB/slots/etc). Saturation policy: block up to :timeout-ms, then (r/err :budget/timeout ...).
(->workload task)Parse [k thunk cost] or [k thunk cost fallback] into a Workload.
Parse [k thunk cost] or [k thunk cost fallback] into a Workload.
(byte-budget-gate
{:keys [capacity unit timeout-ms name fair?]
:or {unit :mib timeout-ms 30000 name "byte-budget-gate" fair? true}})Options: :capacity (required), :unit (default :mib), :timeout-ms (30000), :name ("byte-budget-gate"), :fair? (true).
Options: :capacity (required), :unit (default :mib), :timeout-ms (30000),
:name ("byte-budget-gate"), :fair? (true).(byte-fork-join {:keys [gate total-ms] :or {total-ms 30000}} & tasks)Concurrent dispatch under one IBudgetGate. Tasks: [k thunk cost] or [k thunk cost fallback]. Returns {k result-or-fallback}.
Options: :gate (required), :total-ms (default 30000).
Concurrent dispatch under one IBudgetGate. Tasks: [k thunk cost] or
[k thunk cost fallback]. Returns {k result-or-fallback}.
Options: :gate (required), :total-ms (default 30000).(-acquire g cost timeout-ms)Reserve cost units. Returns Result. On ok, caller MUST -release the same cost.
Reserve cost units. Returns Result. On ok, caller MUST -release the same cost.
(-release g cost)Release cost units. Call exactly once per successful -acquire.
Release cost units. Call exactly once per successful -acquire.
(-stats g)Snapshot: {:name :capacity :unit :inflight :available :queued :admitted-total :rejected-total :timeout-ms}.
Snapshot: {:name :capacity :unit :inflight :available :queued
:admitted-total :rejected-total :timeout-ms}.(resolve-outcome {:keys [key fallback]} outcome)Map an awaited outcome onto [key value-or-fallback]. Total fn.
Map an awaited outcome onto [key value-or-fallback]. Total fn.
(with-budget g cost thunk)(with-budget g cost timeout-ms thunk)Acquire cost units, run thunk, release. Returns Result. Errors: :budget/over-capacity, :budget/timeout, :budget/execution-failed.
Acquire cost units, run thunk, release. Returns Result. Errors: :budget/over-capacity, :budget/timeout, :budget/execution-failed.
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 |