Interface for a feature store component.

The feature store is what the client uses to store feature flag data that has been received from LaunchDarkly. By default, it uses an in-memory implementation; database integrations are also available. Read the SDK features guide. You will not need to use this interface unless you are writing your own implementation.

Feature store methods can and should call their callbacks directly whenever possible, rather than deferring them with setImmediate() or process.nextTick(). This means that if for any reason you are updating or querying a feature store directly in your application code (which is not part of normal use of the SDK) you should be aware that the callback may be executed immediately.

Hierarchy

  • EdgeFeatureStore

Implements

Constructors

Properties

_description: string
_edgeProvider: EdgeProvider
_logger: LDLogger
_rootKey: string
close: (() => void) = noop

Type declaration

    • (): void
    • Returns void

delete: (() => void) = noop

Type declaration

    • (): void
    • Returns void

upsert: (() => void) = noop

Type declaration

    • (): void
    • Returns void

Methods

  • Get all entities from a collection.

    The store should filter out any entities with the property deleted: true.

    Parameters

    • kind: DataKind

      The type of data to be accessed. The store should not make any assumptions about the format of the data, but just return an object in which each key is the key property of an entity and the value is the entity. The actual type of this parameter is interfaces.DataKind.

    • callback: ((res) => void) = noop

      Will be called with the resulting map. The actual type of the result value is interfaces.KeyedItems<VersionedData>.

    Returns Promise<void>

  • Get an entity from the store.

    The store should treat any entity with the property deleted: true as "not found".

    Parameters

    • kind: DataKind

      The type of data to be accessed. The store should not make any assumptions about the format of the data, but just return a JSON object. The actual type of this parameter is interfaces.DataKind.

    • dataKey: string

      The unique key of the entity within the specified collection.

    • callback: ((res) => void)

      Will be called with the retrieved entity, or null if not found. The actual type of the result value is interfaces.VersionedData.

    Returns Promise<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: (() => void)

      Will be called when the store has been initialized.

        • (): void
        • Returns void

    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) => void) = noop

      Will be called back with the boolean result.

        • (isInitialized): void
        • Parameters

          • isInitialized: boolean

          Returns void

    Returns Promise<void>

Generated using TypeDoc