Class: Faulty::Options
- Inherits:
-
Struct
- Object
- Struct
- Faulty::Options
- Includes:
- ImmutableOptions
- Defined in:
- lib/faulty.rb
Overview
Options for Faulty
Instance Attribute Summary collapse
-
#cache ⇒ Cache::Interface
readonly
A cache backend if you want to use Faulty's cache support.
-
#circuit_defaults ⇒ Hash
readonly
A hash of default options to be used when creating new circuits.
-
#listeners ⇒ Array
readonly
Listeners Faulty event listeners.
-
#notifier ⇒ Events::Notifier
readonly
A Faulty notifier.
-
#storage ⇒ Storage::Interface+
readonly
backend.
Method Summary
Methods included from ImmutableOptions
#dup_with, #initialize, #setup
Instance Attribute Details
#cache ⇒ Cache::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
.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/faulty.rb', line 186 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_defaults ⇒ Hash (readonly)
Returns A hash of default options to be used when creating new circuits. See Circuit::Options for a full list.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/faulty.rb', line 186 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 |
#listeners ⇒ Array (readonly)
Returns listeners Faulty event listeners.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/faulty.rb', line 186 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 |
#notifier ⇒ Events::Notifier (readonly)
Returns A Faulty notifier. If given, listeners are ignored.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/faulty.rb', line 186 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 |
#storage ⇒ Storage::Interface+ (readonly)
backend. Automatically wrapped in a Storage::AutoWire, so this can also
be given an array of prioritized backends. Default Storage::AutoWire.new
.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/faulty.rb', line 186 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 |