Module: LaunchDarkly::Integrations::Util::FeatureStoreCore

Defined in:
lib/ldclient-rb/integrations/util/store_wrapper.rb

Overview

This module describes the methods that you must implement on your own object in order to use CachingStoreWrapper.

Since:

  • 5.5.0

Instance Method Summary collapse

Instance Method Details

#get_all_internal(kind) ⇒ Hash

Retrieves all entities of the specified kind. This is the same as LaunchDarkly::Interfaces::FeatureStore#all except that 1. the wrapper will take care of filtering out deleted entities by checking the :deleted property, so you can just return exactly what was in the data store, and 2. the wrapper will take care of checking and updating the cache if caching is enabled.

Since:

  • 5.5.0



194
195
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 194

def get_all_internal(kind)
end

#get_internal(kind, key) ⇒ Hash

Retrieves a single entity. This is the same as LaunchDarkly::Interfaces::FeatureStore#get except that 1. the wrapper will take care of filtering out deleted entities by checking the :deleted property, so you can just return exactly what was in the data store, and 2. the wrapper will take care of checking and updating the cache if caching is enabled.

Since:

  • 5.5.0



181
182
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 181

def get_internal(kind, key)
end

#init_internal(all_data) ⇒ void

This method returns an undefined value.

Initializes the store. This is the same as LaunchDarkly::Interfaces::FeatureStore#init, but the wrapper will take care of updating the cache if caching is enabled.

If possible, the store should update the entire data set atomically. If that is not possible, it should iterate through the outer hash and then the inner hash using the existing iteration order of those hashes (the SDK will ensure that the items were inserted into the hashes in the correct order), storing each item, and then delete any leftover items at the very end.

Since:

  • 5.5.0



168
169
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 168

def init_internal(all_data)
end

#initialized_internal?Boolean

Checks whether this store has been initialized. This is the same as LaunchDarkly::Interfaces::FeatureStore#initialized? except that there is less of a concern for efficiency, because the wrapper will use caching and memoization in order to call the method as little as possible.

Since:

  • 5.5.0



222
223
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 222

def initialized_internal?
end

#stopvoid

This method returns an undefined value.

Performs any necessary cleanup to shut down the store when the client is being shut down.

Since:

  • 5.5.0



230
231
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 230

def stop
end

#upsert_internal(kind, item) ⇒ Hash

Attempts to add or update an entity. This is the same as LaunchDarkly::Interfaces::FeatureStore#upsert except that 1. the wrapper will take care of updating the cache if caching is enabled, and 2. the method is expected to return the final state of the entity (i.e. either the item parameter if the update succeeded, or the previously existing entity in the store if the update failed; this is used for the caching logic).

Note that FeatureStoreCore does not have a delete method. This is because CachingStoreWrapper implements delete by simply calling upsert with an item whose :deleted property is true.

Since:

  • 5.5.0



211
212
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 211

def upsert_internal(kind, item)
end