Class: Faulty::Scope::Options
- Inherits:
-
Struct
- Object
- Struct
- Faulty::Scope::Options
- Includes:
- ImmutableOptions
- Defined in:
- lib/faulty/scope.rb
Overview
Options for Faulty::Scope
Instance Attribute Summary collapse
-
#cache ⇒ Cache::Interface
readonly
A cache backend if you want to use Faulty's cache support.
-
#listeners ⇒ Array
readonly
Listeners Faulty event listeners.
-
#notifier ⇒ Events::Notifier
readonly
A Faulty notifier.
-
#storage ⇒ Storage::Interface
readonly
The storage 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::FaultTolerantProxy. Default Cache::Default.new.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/faulty/scope.rb', line 32 Options = Struct.new( :cache, :storage, :listeners, :notifier ) do include ImmutableOptions private def finalize self.notifier ||= Events::Notifier.new(listeners || []) self.storage ||= Storage::Memory.new unless storage.fault_tolerant? self.storage = Storage::FaultTolerantProxy.new(storage, notifier: notifier) end self.cache ||= Cache::Default.new unless cache.fault_tolerant? self.cache = Cache::FaultTolerantProxy.new(cache, notifier: notifier) end end def required %i[cache storage notifier] end def defaults { listeners: [Events::LogListener.new] } end end |
#listeners ⇒ Array (readonly)
Returns listeners Faulty event listeners.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/faulty/scope.rb', line 32 Options = Struct.new( :cache, :storage, :listeners, :notifier ) do include ImmutableOptions private def finalize self.notifier ||= Events::Notifier.new(listeners || []) self.storage ||= Storage::Memory.new unless storage.fault_tolerant? self.storage = Storage::FaultTolerantProxy.new(storage, notifier: notifier) end self.cache ||= Cache::Default.new unless cache.fault_tolerant? self.cache = Cache::FaultTolerantProxy.new(cache, notifier: notifier) end end def required %i[cache storage notifier] end def defaults { listeners: [Events::LogListener.new] } end end |
#notifier ⇒ Events::Notifier (readonly)
Returns A Faulty notifier. If given, listeners are ignored.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/faulty/scope.rb', line 32 Options = Struct.new( :cache, :storage, :listeners, :notifier ) do include ImmutableOptions private def finalize self.notifier ||= Events::Notifier.new(listeners || []) self.storage ||= Storage::Memory.new unless storage.fault_tolerant? self.storage = Storage::FaultTolerantProxy.new(storage, notifier: notifier) end self.cache ||= Cache::Default.new unless cache.fault_tolerant? self.cache = Cache::FaultTolerantProxy.new(cache, notifier: notifier) end end def required %i[cache storage notifier] end def defaults { listeners: [Events::LogListener.new] } end end |
#storage ⇒ Storage::Interface (readonly)
Returns The storage backend.
Automatically wrapped in a Faulty::Storage::FaultTolerantProxy.
Default Storage::Memory.new.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/faulty/scope.rb', line 32 Options = Struct.new( :cache, :storage, :listeners, :notifier ) do include ImmutableOptions private def finalize self.notifier ||= Events::Notifier.new(listeners || []) self.storage ||= Storage::Memory.new unless storage.fault_tolerant? self.storage = Storage::FaultTolerantProxy.new(storage, notifier: notifier) end self.cache ||= Cache::Default.new unless cache.fault_tolerant? self.cache = Cache::FaultTolerantProxy.new(cache, notifier: notifier) end end def required %i[cache storage notifier] end def defaults { listeners: [Events::LogListener.new] } end end |