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

#initialize

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:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/faulty.rb', line 157

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:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/faulty.rb', line 157

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:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/faulty.rb', line 157

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:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/faulty.rb', line 157

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:


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/faulty.rb', line 157

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