module LaunchDarkly::Integrations::Util::FeatureStoreCore
This module describes the methods that you must implement on your own object in order to use {CachingStoreWrapper}.
Public Instance Methods
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.
@param kind [Object] the kind of entity to get @return [Hash] a hash where each key is the entity's `:key` property and each value
is the entity
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 189 def get_all_internal(kind) end
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.
@param kind [Object] the kind of entity to get @param key [String] the unique key of the entity to get @return [Hash] the entity; nil if the key was not found
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 176 def get_internal(kind, key) end
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.
@param all_data [Hash] a hash where each key is one of the data kind objects, and each
value is in turn a hash of string keys to entities
@return [void]
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 163 def init_internal(all_data) end
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.
@return [Boolean] true if the store is in an initialized state
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 217 def initialized_internal? end
Performs any necessary cleanup to shut down the store when the client is being shut down.
@return [void]
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 225 def stop end
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.
@param kind [Object] the kind of entity to add or update @param item [Hash] the entity to add or update @return [Hash] the entity as it now exists in the store after the update
# File lib/ldclient-rb/integrations/util/store_wrapper.rb, line 206 def upsert_internal(kind, item) end