Module: Philiprehberger::Circuit::Callbacks
- Included in:
- Breaker
- Defined in:
- lib/philiprehberger/circuit/callbacks.rb
Overview
Callback registration and firing for state transitions
Instance Method Summary collapse
- #on_close ⇒ Object
- #on_half_open ⇒ Object
- #on_open ⇒ Object
-
#on_reset {|from_state, to_state| ... } ⇒ Object
Register a callback for any state transition.
Instance Method Details
#on_close ⇒ Object
8 |
# File 'lib/philiprehberger/circuit/callbacks.rb', line 8 def on_close(&) = register_callback(:close, &) |
#on_half_open ⇒ Object
9 |
# File 'lib/philiprehberger/circuit/callbacks.rb', line 9 def on_half_open(&) = register_callback(:half_open, &) |
#on_open ⇒ Object
7 |
# File 'lib/philiprehberger/circuit/callbacks.rb', line 7 def on_open(&) = register_callback(:open, &) |
#on_reset {|from_state, to_state| ... } ⇒ Object
Register a callback for any state transition
13 14 15 16 |
# File 'lib/philiprehberger/circuit/callbacks.rb', line 13 def on_reset(&block) @mutex.synchronize { @reset_callbacks << block } self end |