class Faulty::Storage::CircuitProxy
A circuit wrapper for storage backends
This class uses an internal {Circuit} to prevent the storage backend from causing application issues. If the backend fails continuously, this circuit will trip to prevent cascading failures. This internal circuit uses an independent in-memory backend by default.
Constants
- Options
Options
for {CircuitProxy}@!attribute [r] circuit
@return [Circuit] A replacement for the internal circuit. When modifying this, be careful to use only a reliable storage backend so that you don't introduce cascading failures.
@!attribute [r] notifier
@return [Events::Notifier] A Faulty notifier to use for circuit notifications. If `circuit` is given, this is ignored.
Attributes
options[R]
Public Class Methods
new(storage, **options, &block)
click to toggle source
@param storage [Storage::Interface] The storage backend to wrap @param options [Hash] Attributes for {Options} @yield [Options] For setting options in a block
# File lib/faulty/storage/circuit_proxy.rb, line 45 def initialize(storage, **options, &block) @storage = storage @options = Options.new(options, &block) end
Public Instance Methods
fault_tolerant?()
click to toggle source
This cache makes any storage fault tolerant, so this is always `true`
@return [true]
# File lib/faulty/storage/circuit_proxy.rb, line 59 def fault_tolerant? @storage.fault_tolerant? end