Class: ResilientCall::Storage::Base
- Inherits:
-
Object
- Object
- ResilientCall::Storage::Base
- Defined in:
- lib/resilient_call/storage/base.rb
Overview
Contract every storage backend must implement. A storage persists the mutable state of each named circuit as a serializable Hash:
{ status:, failure_count:, opened_at:, last_failure_message:, last_failure_class: }
Backends decide where that state lives (process memory, Redis, ...); the Circuit stays agnostic and only reads/writes through this interface.
Instance Method Summary collapse
- #read(circuit_name) ⇒ Object
- #reset(circuit_name) ⇒ Object
- #reset_all ⇒ Object
- #write(circuit_name, state) ⇒ Object
Instance Method Details
#read(circuit_name) ⇒ Object
13 14 15 |
# File 'lib/resilient_call/storage/base.rb', line 13 def read(circuit_name) raise NotImplementedError, "#{self.class}#read" end |
#reset(circuit_name) ⇒ Object
21 22 23 |
# File 'lib/resilient_call/storage/base.rb', line 21 def reset(circuit_name) raise NotImplementedError, "#{self.class}#reset" end |
#reset_all ⇒ Object
25 26 27 |
# File 'lib/resilient_call/storage/base.rb', line 25 def reset_all raise NotImplementedError, "#{self.class}#reset_all" end |
#write(circuit_name, state) ⇒ Object
17 18 19 |
# File 'lib/resilient_call/storage/base.rb', line 17 def write(circuit_name, state) raise NotImplementedError, "#{self.class}#write" end |