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
# 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

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



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

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



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

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



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

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



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

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



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

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



64
65
66
# File 'lib/ldclient-rb/impl/store_client_wrapper.rb', line 64

def monitoring_enabled?
  @monitoring_enabled
end

#stopObject

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



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

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



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

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