Class: Faulty::Storage::CircuitProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/faulty/storage/circuit_proxy.rb

Overview

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.

Defined Under Namespace

Classes: Options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storage, **options) {|Options| ... } ⇒ CircuitProxy

Returns a new instance of CircuitProxy.

Parameters:

Yields:

  • (Options)

    For setting options in a block



43
44
45
46
# File 'lib/faulty/storage/circuit_proxy.rb', line 43

def initialize(storage, **options, &block)
  @storage = storage
  @options = Options.new(options, &block)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/faulty/storage/circuit_proxy.rb', line 12

def options
  @options
end

Instance Method Details

#fault_tolerant?true

This cache makes any storage fault tolerant, so this is always true

Returns:

  • (true)


71
72
73
# File 'lib/faulty/storage/circuit_proxy.rb', line 71

def fault_tolerant?
  @storage.fault_tolerant?
end