@launchdarkly/js-server-sdk-common - v2.26.8
    Preparing search index...

    Class PersistentDataStoreWrapper

    Internal implementation of LDFeatureStore that delegates the basic functionality to an instance of PersistentDataStore. It provides optional caching behavior and other logic that would otherwise be repeated in every data store implementation. This makes it easier to create new database integrations by implementing only the database-specific logic.

    Implements

    Index
    isStoreAvailable?: (callback: (isAvailable: boolean) => void) => void

    Check if the underlying storage can be accessed.

    This method is only present when the PersistentDataStore used by this wrapper implements it.

    • Delete an entity from the store.

      Deletion should be implemented by storing a placeholder object with the property deleted: true and a version property equal to the provided version. In other words, it should be exactly the same as calling upsert with such an object.

      Parameters

      • kind: DataKind

        The type of data to be accessed. The actual type of this parameter is interfaces.DataKind.

      • key: string

        The unique key of the entity within the specified collection.

      • version: number

        A number that must be greater than the version property of the existing entity in order for it to be deleted. If it is less than or equal to the existing version, the method should do nothing.

      • callback: () => void

        Will be called when the delete operation is complete.

      Returns void

    • Initialize the store, overwriting any existing data.

      Parameters

      • allData: LDFeatureStoreDataStorage

        An object in which each key is the "namespace" of a collection (e.g. "features") and the value is an object that maps keys to entities. The actual type of this parameter is interfaces.FullDataSet<VersionedData>.

      • callback: (err?: Error) => void

        Will be called when the store has been initialized. If the store could not apply the data, then it may be called with an error. Implementations are not required to report errors.

      Returns void

    • Tests whether the store is initialized.

      "Initialized" means that the store has been populated with data, either by the client having called init() within this process, or by another process (if this is a shared database).

      Parameters

      • callback: (isInitialized: boolean) => void

        Will be called back with the boolean result.

      Returns void