Created
May 5, 2010 07:23
-
-
Save krukow/390485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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