Create a gist now

Instantly share code, notes, and snippets.

(defprotocol CircuitBreakerTransitions
"Transition functions for circuit-breaker states"
(proceed [s] "true if breaker should proceed with call in this state")
(on-success [s] "transition from s to this state after a successful call")
(on-error [s] "transition from s to this state after an unsuccessful call")
(on-before-call [s] "transition from s to this state before a call"))
(def #^{:private true
:doc "Default shared transition functions"}
def-transitions
{:proceed (constantly false)
:on-success identity
:on-error identity
:on-before-call identity})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment