Class: Faulty::Options

Inherits:
Struct
  • Object
show all
Includes:
ImmutableOptions
Defined in:
lib/faulty.rb

Overview

Options for Faulty

Instance Attribute Summary collapse

Method Summary

Methods included from ImmutableOptions

#dup_with, #initialize, #setup

Instance Attribute Details

#cacheCache::Interface (readonly)

Returns A cache backend if you want to use Faulty's cache support. Automatically wrapped in a Cache::AutoWire. Default Cache::AutoWire.new.

Returns:

  • (Cache::Interface)

    A cache backend if you want to use Faulty's cache support. Automatically wrapped in a Cache::AutoWire. Default Cache::AutoWire.new.

See Also:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/faulty.rb', line 195

Options = Struct.new(
  :cache,
  :circuit_defaults,
  :storage,
  :listeners,
  :notifier
) do
  include ImmutableOptions

  private

  def finalize
    self.notifier ||= Events::Notifier.new(listeners || [])
    self.storage = Storage::AutoWire.wrap(storage, notifier: notifier)
    self.cache = Cache::AutoWire.wrap(cache, notifier: notifier)
  end

  def required
    %i[cache circuit_defaults storage notifier]
  end

  def defaults
    {
      circuit_defaults: {},
      listeners: [Events::LogListener.new]
    }
  end
end

#circuit_defaultsHash (readonly)

Returns A hash of default options to be used when creating new circuits. See Circuit::Options for a full list.

Returns:

  • (Hash)

    A hash of default options to be used when creating new circuits. See Circuit::Options for a full list.

See Also:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/faulty.rb', line 195

Options = Struct.new(
  :cache,
  :circuit_defaults,
  :storage,
  :listeners,
  :notifier
) do
  include ImmutableOptions

  private

  def finalize
    self.notifier ||= Events::Notifier.new(listeners || [])
    self.storage = Storage::AutoWire.wrap(storage, notifier: notifier)
    self.cache = Cache::AutoWire.wrap(cache, notifier: notifier)
  end

  def required
    %i[cache circuit_defaults storage notifier]
  end

  def defaults
    {
      circuit_defaults: {},
      listeners: [Events::LogListener.new]
    }
  end
end

#listenersArray (readonly)

Returns listeners Faulty event listeners.

Returns:

  • (Array)

    listeners Faulty event listeners

See Also:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/faulty.rb', line 195

Options = Struct.new(
  :cache,
  :circuit_defaults,
  :storage,
  :listeners,
  :notifier
) do
  include ImmutableOptions

  private

  def finalize
    self.notifier ||= Events::Notifier.new(listeners || [])
    self.storage = Storage::AutoWire.wrap(storage, notifier: notifier)
    self.cache = Cache::AutoWire.wrap(cache, notifier: notifier)
  end

  def required
    %i[cache circuit_defaults storage notifier]
  end

  def defaults
    {
      circuit_defaults: {},
      listeners: [Events::LogListener.new]
    }
  end
end

#notifierEvents::Notifier (readonly)

Returns A Faulty notifier. If given, listeners are ignored.

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/faulty.rb', line 195

Options = Struct.new(
  :cache,
  :circuit_defaults,
  :storage,
  :listeners,
  :notifier
) do
  include ImmutableOptions

  private

  def finalize
    self.notifier ||= Events::Notifier.new(listeners || [])
    self.storage = Storage::AutoWire.wrap(storage, notifier: notifier)
    self.cache = Cache::AutoWire.wrap(cache, notifier: notifier)
  end

  def required
    %i[cache circuit_defaults storage notifier]
  end

  def defaults
    {
      circuit_defaults: {},
      listeners: [Events::LogListener.new]
    }
  end
end

#storageStorage::Interface+ (readonly)

backend. Automatically wrapped in a Storage::AutoWire, so this can also be given an array of prioritized backends. Default Storage::AutoWire.new.

Returns:

See Also:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/faulty.rb', line 195

Options = Struct.new(
  :cache,
  :circuit_defaults,
  :storage,
  :listeners,
  :notifier
) do
  include ImmutableOptions

  private

  def finalize
    self.notifier ||= Events::Notifier.new(listeners || [])
    self.storage = Storage::AutoWire.wrap(storage, notifier: notifier)
    self.cache = Cache::AutoWire.wrap(cache, notifier: notifier)
  end

  def required
    %i[cache circuit_defaults storage notifier]
  end

  def defaults
    {
      circuit_defaults: {},
      listeners: [Events::LogListener.new]
    }
  end
end