Class: LaunchDarkly::Impl::FeatureStoreClientWrapper Private

Inherits:
Object
  • Object
show all
Includes:
LaunchDarkly::Interfaces::FeatureStore
Defined in:
lib/ldclient-rb/impl/store_client_wrapper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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.

Since:

  • 5.5.0

Instance Method Summary collapse

Constructor Details

#initialize(store, store_update_sink, logger) ⇒ FeatureStoreClientWrapper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FeatureStoreClientWrapper.

Since:

  • 5.5.0



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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
  @stopped = false
  # @type [LaunchDarkly::Impl::RepeatingTask, nil]
  @poller = nil
end

Instance Method Details

#all(kind) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



39
40
41
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 39

def all(kind)
  wrapper { @store.all(kind) }
end

#delete(kind, key, version) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



47
48
49
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 47

def delete(kind, key, version)
  wrapper { @store.delete(kind, key, version) }
end

#get(kind, key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



35
36
37
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 35

def get(kind, key)
  wrapper { @store.get(kind, key) }
end

#init(all_data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



31
32
33
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 31

def init(all_data)
  wrapper { @store.init(FeatureStoreDataSetSorter.sort_all_collections(all_data)) }
end

#initialized? ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 5.5.0



51
52
53
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 51

def initialized?
  @store.initialized?
end

#monitoring_enabled? ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 5.5.0



67
68
69
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 67

def monitoring_enabled?
  @monitoring_enabled
end

#stop ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 55

def stop
  @store.stop

  poller = @mutex.synchronize do
    @stopped = true
    task = @poller
    @poller = nil
    task
  end
  poller&.stop
end

#upsert(kind, item) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0



43
44
45
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 43

def upsert(kind, item)
  wrapper { @store.upsert(kind, item) }
end