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.
Instance Method Summary collapse
-
#get_all_internal(kind) ⇒ Hash
Retrieves all entities of the specified kind.
-
#get_internal(kind, key) ⇒ Hash
Retrieves a single entity.
-
#init_internal(all_data) ⇒ void
Initializes the store.
-
#initialized_internal? ⇒ Boolean
Checks whether this store has been initialized.
-
#stop ⇒ void
Performs any necessary cleanup to shut down the store when the client is being shut down.
-
#upsert_internal(kind, item) ⇒ Hash
Attempts to add or update an entity.
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.
205 206 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 205 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.
192 193 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 192 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.
179 180 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 179 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.
233 234 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 233 def initialized_internal? end |
#stop ⇒ void
This method returns an undefined value.
Performs any necessary cleanup to shut down the store when the client is being shut down.
241 242 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 241 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.
222 223 |
# File 'lib/ldclient-rb/integrations/util/store_wrapper.rb', line 222 def upsert_internal(kind, item) end |