Liking cljdoc? Tell your friends :D

hive-weave.core

hive-weave — bounded, timed, safe execution primitives.

Weaves parallel/concurrent/async strands with built-in safety: every operation has a timeout, every parallel fan-out is bounded.

Modules: hive-weave.safe — safe deref, safe future (never hangs) hive-weave.gate — semaphore-bounded execution hive-weave.parallel — bounded-pmap, fork-join, fan-out hive-weave.pool — bounded ThreadPoolExecutor + safe await! hive-weave.timed — timed interceptors, timed handlers

Quick start: (require '[hive-weave.core :as weave])

;; Safe deref (replaces bare @) (weave/deref-safe my-promise 5000 fallback)

;; Bounded parallel map (replaces pmap) (weave/bounded-pmap {:concurrency 4 :timeout-ms 5000} fetch-preview ids)

;; Fork-join with budget (weave/fork-join {:budget-ms 15000} [:tags #(query-tags tags) {}] [:kg #(expand-kg ids) #{}])

;; Gate for resource protection (def db-gate (weave/gate {:permits 4 :timeout-ms 10000 :name "db"})) (weave/with-gate db-gate (query ...))

;; Timed interceptor (for hive-events) (weave/->timed-interceptor :id :my/enrichment :timeout-ms 15000 :after (fn [ctx] ...))

hive-weave — bounded, timed, safe execution primitives.

Weaves parallel/concurrent/async strands with built-in safety:
every operation has a timeout, every parallel fan-out is bounded.

Modules:
  hive-weave.safe      — safe deref, safe future (never hangs)
  hive-weave.gate      — semaphore-bounded execution
  hive-weave.parallel  — bounded-pmap, fork-join, fan-out
  hive-weave.pool      — bounded ThreadPoolExecutor + safe await!
  hive-weave.timed     — timed interceptors, timed handlers

Quick start:
  (require '[hive-weave.core :as weave])

  ;; Safe deref (replaces bare @)
  (weave/deref-safe my-promise 5000 fallback)

  ;; Bounded parallel map (replaces pmap)
  (weave/bounded-pmap {:concurrency 4 :timeout-ms 5000}
    fetch-preview ids)

  ;; Fork-join with budget
  (weave/fork-join {:budget-ms 15000}
    [:tags  #(query-tags tags)     {}]
    [:kg    #(expand-kg ids)       #{}])

  ;; Gate for resource protection
  (def db-gate (weave/gate {:permits 4 :timeout-ms 10000 :name "db"}))
  (weave/with-gate db-gate (query ...))

  ;; Timed interceptor (for hive-events)
  (weave/->timed-interceptor
    :id :my/enrichment :timeout-ms 15000
    :after (fn [ctx] ...))
raw docstring

->timed-interceptorclj

source

bounded-pmapclj

source

broker-statsclj

source

byte-budget-gateclj

source

byte-fork-joinclj

source

byte-gate-statsclj

source

decide-policyclj

source

deref-gateclj

source

deref-safeclj

source

deref-safe!clj

source

fan-outclj

source

fork-joinclj

source

gateclj

source

gate-runclj

source

gate-run!clj

source

gate-statsclj

source

guarded-await!clj

Pool-bound counterpart to guarded-future-call. Submits to a ThreadPoolExecutor (via hive-weave.pool/make-pool) and applies the same timeout / cleanup / alert contract, plus pool-stats embedded in the alert event so saturation is visible when timeouts cluster.

Pool-bound counterpart to guarded-future-call. Submits to a
ThreadPoolExecutor (via hive-weave.pool/make-pool) and applies the
same timeout / cleanup / alert contract, plus pool-stats embedded
in the alert event so saturation is visible when timeouts cluster.
sourceraw docstring

guarded-futurecljmacro

(guarded-future opts & body)

Macro form of guarded-future-call. Body is wrapped as the thunk.

Macro form of guarded-future-call. Body is wrapped as the thunk.
sourceraw docstring

guarded-future-callclj

Run a thunk under :timeout-ms with cleanup hook + injectable alert. On timeout: future-cancel, run :on-cancel on a separate cleanup pool, fire :alert!, return (r/err :weave/timeout {...}). See hive-weave.guarded ns doc for the full contract.

Run a thunk under :timeout-ms with cleanup hook + injectable alert.
On timeout: future-cancel, run :on-cancel on a separate cleanup pool,
fire :alert!, return (r/err :weave/timeout {...}). See
`hive-weave.guarded` ns doc for the full contract.
sourceraw docstring

heap-observe!clj

source

heap-sample!clj

source

heap-snapshotclj

source

heap-unobserve!clj

source

make-poolclj

source

pool-await!clj

source

pool-shutdown!clj

source

pool-statsclj

source

pool-submit!clj

source

safe-futurecljmacro

(safe-future opts & body)
source

safe-future-callclj

source

start-broker!clj

source

start-heap-sentinel!clj

source

stop-broker!clj

source

stop-heap-sentinel!clj

source

submitclj

source

timed-handlerclj

source

with-budgetclj

source

with-byte-budgetclj

source

with-gatecljmacro

(with-gate g & body)
source

with-gate-resultcljmacro

(with-gate-result g & body)
source

with-guarded-awaitcljmacro

(with-guarded-await pool opts & body)

Macro form of guarded-await!. Submits body to pool with cleanup + alert hooks.

Macro form of guarded-await!. Submits body to pool with cleanup +
alert hooks.
sourceraw docstring

with-pool-awaitcljmacro

(with-pool-await pool opts & body)
source

wrap-timedclj

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