Liking cljdoc? Tell your friends :D

com.potetm.fusebox.circuit-breaker


currentclj

(current {cb :com.potetm.fusebox.circuit-breaker/circuit-breaker})

The current circuit breaker state. Useful for diagnostics or testing.

The current circuit breaker state. Useful for diagnostics or testing.
sourceraw docstring

disableclj

(disable spec)
source

fail-pctclj

(fail-pct r)

The percent of calls currently tracked by the circuit breaker which are failed.

The percent of calls currently tracked by the circuit breaker which are failed.
sourceraw docstring

initclj

(init {_ns :com.potetm.fusebox.circuit-breaker/next-state
       hs :com.potetm.fusebox.circuit-breaker/hist-size
       _hot :com.potetm.fusebox.circuit-breaker/half-open-tries
       _scm :com.potetm.fusebox.circuit-breaker/slow-call-ms
       succ? :com.potetm.fusebox.circuit-breaker/success?
       :as spec})

Initialize a circuit breaker.

spec is a map containing: ::next-state - fn taking the current circuit breaker and returning the next state or nil if no transition is necessary. See next-state:default for a default implementation. Return value must be one of: ::closed, ::half-opened, ::opened ::hist-size - The number of calls to track ::half-open-tries - The number of calls to allow in a ::half-open state ::slow-call-ms - Milli threshold to label a call slow ::success? - A function which takes a return value and determines whether it was successful. If false, a ::failure is recorded.

Initialize a circuit breaker.

spec is a map containing:
  ::next-state - fn taking the current circuit breaker and returning the next
                 state or nil if no transition is necessary. See next-state:default
                 for a default implementation. Return value must be one of:
                 ::closed, ::half-opened, ::opened
  ::hist-size       - The number of calls to track
  ::half-open-tries - The number of calls to allow in a ::half-open state
  ::slow-call-ms    - Milli threshold to label a call slow
  ::success?        - A function which takes a return value and determines
                      whether it was successful. If false, a ::failure is
                      recorded.
sourceraw docstring

lockingcljmacro

(locking l & body)
source

next-state:defaultclj

(next-state:default opts r)

A default ::next-state implementation.

  • :fail-pct - The decimal threshold to use to open the breaker due to failed calls (0, 1]
  • :slow-pct - The decimal threshold to use to open the breaker due to slow calls (0, 1]
  • :wait-for-count - The number of calls to wait for after transitioning before transitioning again
  • :open->half-open-after-ms - Millis to wait before transitioning from ::opened to ::half-opened
A default ::next-state implementation.

* :fail-pct - The decimal threshold to use to open the breaker due to failed calls (0, 1]
* :slow-pct - The decimal threshold to use to open the breaker due to slow calls (0, 1]
* :wait-for-count - The number of calls to wait for after transitioning before transitioning again
* :open->half-open-after-ms - Millis to wait before transitioning from ::opened to ::half-opened
sourceraw docstring

record!clj

(record! spec res duration-ms)
source

should-close?clj

(should-close? r wait-for fail-threshold slow-threshold)

Default implementation for determining whether to transition to a ::closed state.

Default implementation for determining whether to transition to a ::closed state.
sourceraw docstring

should-open?clj

(should-open? r wait-for fail-threshold slow-threshold)

Default implementation for determining whether to transition to a ::opened state.

Default implementation for determining whether to transition to a ::opened state.
sourceraw docstring

shutdownclj

(shutdown spec)
source

slow-pctclj

(slow-pct r)

The percent of calls currently tracked by the circuit breaker which are slow.

The percent of calls currently tracked by the circuit breaker which are slow.
sourceraw docstring

slow|fail-pctclj

(slow|fail-pct r)

The percent of calls currently tracked by the circuit breaker which are either slow or failed.

The percent of calls currently tracked by the circuit breaker which are either
slow or failed.
sourceraw docstring

time-expired?clj

(time-expired? r duration-ms)

Has the provided duration-ms (in millis) expired since the last state transition for this circuit breaker?

Has the provided duration-ms (in millis) expired since the last state transition
for this circuit breaker?
sourceraw docstring

transitionclj

(transition spec state)
source

with-circuit-breakercljmacro

(with-circuit-breaker spec & body)

Evaluates body, guarded by the provided circuit breaker.

Evaluates body, guarded by the provided circuit breaker.
sourceraw docstring

with-circuit-breaker*clj

(with-circuit-breaker* {cb :com.potetm.fusebox.circuit-breaker/circuit-breaker
                        succ? :com.potetm.fusebox.circuit-breaker/success?
                        :as spec}
                       f)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close