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
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
.
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_defaults ⇒ Hash (readonly)
Returns A hash of default options to be used when creating new circuits. See Circuit::Options for a full list.
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 |
#listeners ⇒ Array (readonly)
Returns listeners Faulty event listeners.
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 |
#notifier ⇒ Events::Notifier (readonly)
Returns A Faulty notifier. If given, listeners are ignored.
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 |
#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
.
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 |