Skip to content

Instantly share code, notes, and snippets.

@krukow
Created May 5, 2010 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krukow/390485 to your computer and use it in GitHub Desktop.
Save krukow/390485 to your computer and use it in GitHub Desktop.
(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