Liking cljdoc? Tell your friends :D

hive-weave.budget

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 ...).
raw docstring

->deadlineclj

(->deadline total-ms)
source

->workloadclj

(->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.
sourceraw docstring

await-outcomeclj

(await-outcome submission deadline)
source

byte-budget-gateclj

(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).
sourceraw docstring

byte-fork-joinclj

(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).
sourceraw docstring

byte-gate-statsclj

(byte-gate-stats g)
source

cancel-if-timed-outclj

(cancel-if-timed-out submission outcome)
source

collect-submissionclj

(collect-submission submission deadline)
source

IBudgetGatecljprotocol

-acquireclj

(-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.

-releaseclj

(-release g cost)

Release cost units. Call exactly once per successful -acquire.

Release cost units. Call exactly once per successful -acquire.

-statsclj

(-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}.
source

remaining-msclj

(remaining-ms deadline)
source

resolve-outcomeclj

(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.
sourceraw docstring

submit-workloadclj

(submit-workload gate workload)
source

with-budgetclj

(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.
sourceraw docstring

with-byte-budgetclj

(with-byte-budget g cost thunk)
source

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