Class: LaunchDarkly::Impl::FeatureStoreClientWrapper
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::FeatureStoreClientWrapper
- Includes:
- LaunchDarkly::Interfaces::FeatureStore
- Defined in:
- lib/ldclient-rb/impl/store_client_wrapper.rb
Overview
Provides additional behavior that the client requires before or after feature store operations. This just means sorting the data set for init() and dealing with data store status listeners.
Instance Method Summary collapse
- #all(kind) ⇒ Object
- #delete(kind, key, version) ⇒ Object
- #get(kind, key) ⇒ Object
- #init(all_data) ⇒ Object
-
#initialize(store, store_update_sink, logger) ⇒ FeatureStoreClientWrapper
constructor
A new instance of FeatureStoreClientWrapper.
- #initialized? ⇒ Boolean
- #monitoring_enabled? ⇒ Boolean
- #stop ⇒ Object
- #upsert(kind, item) ⇒ Object
Constructor Details
#initialize(store, store_update_sink, logger) ⇒ FeatureStoreClientWrapper
Returns a new instance of FeatureStoreClientWrapper.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 14 def initialize(store, store_update_sink, logger) # @type [LaunchDarkly::Interfaces::FeatureStore] @store = store @monitoring_enabled = does_store_support_monitoring? # @type [LaunchDarkly::Impl::DataStore::UpdateSink] @store_update_sink = store_update_sink @logger = logger @mutex = Mutex.new # Covers the following variables @last_available = true # @type [LaunchDarkly::Impl::RepeatingTask, nil] @poller = nil end |
Instance Method Details
#all(kind) ⇒ Object
38 39 40 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 38 def all(kind) wrapper { @store.all(kind) } end |
#delete(kind, key, version) ⇒ Object
46 47 48 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 46 def delete(kind, key, version) wrapper { @store.delete(kind, key, version) } end |
#get(kind, key) ⇒ Object
34 35 36 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 34 def get(kind, key) wrapper { @store.get(kind, key) } end |
#init(all_data) ⇒ Object
30 31 32 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 30 def init(all_data) wrapper { @store.init(FeatureStoreDataSetSorter.sort_all_collections(all_data)) } end |
#initialized? ⇒ Boolean
50 51 52 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 50 def initialized? @store.initialized? end |
#monitoring_enabled? ⇒ Boolean
64 65 66 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 64 def monitoring_enabled? @monitoring_enabled end |
#stop ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 54 def stop @store.stop @mutex.synchronize do return if @poller.nil? @poller.stop @poller = nil end end |
#upsert(kind, item) ⇒ Object
42 43 44 |
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 42 def upsert(kind, item) wrapper { @store.upsert(kind, item) } end |