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.

See Also:

Returns:

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



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.

See Also:

Returns:

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



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.

See Also:

Returns:

  • listeners Faulty event listeners



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:

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



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.

See Also:

Returns:

  • The storage



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