Class: ResilientCall::Storage::Base

Inherits:
Object
  • Object
show all
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.

Direct Known Subclasses

Memory, Redis

Instance Method Summary collapse

Instance Method Details

#read(circuit_name) ⇒ Object

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/resilient_call/storage/base.rb', line 21

def reset(circuit_name)
  raise NotImplementedError, "#{self.class}#reset"
end

#reset_allObject

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/resilient_call/storage/base.rb', line 17

def write(circuit_name, state)
  raise NotImplementedError, "#{self.class}#write"
end