Class: LaunchDarkly::Impl::DataStore::UpdateSink
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::DataStore::UpdateSink
- Defined in:
- lib/ldclient-rb/impl/data_store.rb
Overview
Instance Attribute Summary collapse
- #broadcaster ⇒ LaunchDarkly::Impl::Broadcaster readonly
- #last_status ⇒ Concurrent::AtomicReference readonly
Instance Method Summary collapse
-
#initialize(broadcaster) ⇒ UpdateSink
constructor
A new instance of UpdateSink.
- #update_status(status) ⇒ Object
Constructor Details
#initialize(broadcaster) ⇒ UpdateSink
Returns a new instance of UpdateSink.
93 94 95 96 97 98 |
# File 'lib/ldclient-rb/impl/data_store.rb', line 93 def initialize(broadcaster) @broadcaster = broadcaster @last_status = Concurrent::AtomicReference.new( LaunchDarkly::Interfaces::DataStore::Status.new(true, false) ) end |
Instance Attribute Details
#broadcaster ⇒ LaunchDarkly::Impl::Broadcaster (readonly)
88 89 90 |
# File 'lib/ldclient-rb/impl/data_store.rb', line 88 def broadcaster @broadcaster end |
#last_status ⇒ Concurrent::AtomicReference (readonly)
91 92 93 |
# File 'lib/ldclient-rb/impl/data_store.rb', line 91 def last_status @last_status end |
Instance Method Details
#update_status(status) ⇒ Object
100 101 102 103 104 105 |
# File 'lib/ldclient-rb/impl/data_store.rb', line 100 def update_status(status) return if status.nil? old_status = @last_status.get_and_set(status) @broadcaster.broadcast(status) unless old_status == status end |