You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 19f88eb
Browse filesBrowse the repository at this point in the historyBrowse files
feat: Add the override store, overlay, and data system wiring
Adds the override layer described by the OVERRIDE specification: an override
store that holds marked flag and segment definitions, an overlay at the store
read boundary that returns the override entry for a key in preference to
LaunchDarkly data and enumerates the union of both, and a sink that applies
each snapshot as a single replacement and notifies flag change listeners of
every flag whose evaluation may have changed, including flags that depend on
a changed prerequisite or segment.
The override source is an option of the FDv2 data system configuration:
DataSystemConfig.override_source and ConfigBuilder.overrides(). The source
is built with the data system, so invalid configuration raises from the
client constructor. It starts before the data system's own threads, so its
initial load completes before the constructor returns, and it is closed with
the client. OverrideSource and OverrideSink are public protocols so a custom
source can be supplied.
The client consults the override store before its not-initialized
short-circuit. An overridden flag is served before the client has
LaunchDarkly data, and a flag absent from the override store still returns
the client-not-ready default. The all-flags state reads through the overlay
and, while the client has no LaunchDarkly data, contains only the overridden
flags. The async client and data system receive the same changes, with
override change notifications delivered on the event loop.
The OVERRIDE specification test vectors run as a unit test through the full
client stack.
log.warning("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: "+str(default) +" for feature key: "+key)
log.warning("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: "+key+". This message is logged once.")
515
+
elifself._data_system.override_source_configured:
516
+
# No data from LaunchDarkly is available. The store read below still finds an
517
+
# entry that the override layer holds, and the SDK serves it. A miss returns the
518
+
# not-ready default.
519
+
no_launchdarkly_data=True
507
520
else:
508
-
log.warning("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: "+str(default) +" for feature key: "+key)
log.warning("all_flags_state() called before client has finished initializing! Using last known values from feature store. This message is logged once.")
594
+
elifself._data_system.override_source_configured:
595
+
# No data from LaunchDarkly is available. The store read below returns only the
596
+
# entries that the override layer holds. The result decides the state.
597
+
overrides_only=True
581
598
else:
582
599
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
log.error("Unable to read flags for all_flag_state: %s"%repr(e))
599
616
returnFeatureFlagsState(False)
600
617
618
+
ifoverrides_only:
619
+
iflen(flags_map) ==0:
620
+
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
621
+
returnFeatureFlagsState(False)
622
+
ifnotself._all_flags_overrides_only_warned:
623
+
self._all_flags_overrides_only_warned=True
624
+
log.warning("all_flags_state() called before client has finished initializing! Returning only flags from the override layer. This message is logged once.")
log.warning("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: "+str(default) +" for feature key: "+key)
log.warning("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: "+key+". This message is logged once.")
486
+
elifself._data_system.override_source_configured:
487
+
# No data from LaunchDarkly is available. The store read below still finds an
488
+
# entry that the override layer holds, and the SDK serves it. A miss returns the
489
+
# not-ready default.
490
+
no_launchdarkly_data=True
478
491
else:
479
-
log.warning("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: "+str(default) +" for feature key: "+key)
log.warning("all_flags_state() called before client has finished initializing! Using last known values from feature store. This message is logged once.")
569
+
elifself._data_system.override_source_configured:
570
+
# No data from LaunchDarkly is available. The store read below returns only the
571
+
# entries that the override layer holds. The result decides the state.
572
+
overrides_only=True
556
573
else:
557
574
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
log.error("Unable to read flags for all_flag_state: %s"%repr(e))
574
591
returnFeatureFlagsState(False)
575
592
593
+
ifoverrides_only:
594
+
iflen(flags_map) ==0:
595
+
log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state")
596
+
returnFeatureFlagsState(False)
597
+
ifnotself._all_flags_overrides_only_warned:
598
+
withself._cached_data_warning_lock:
599
+
ifnotself._all_flags_overrides_only_warned:
600
+
self._all_flags_overrides_only_warned=True
601
+
log.warning("all_flags_state() called before client has finished initializing! Returning only flags from the override layer. This message is logged once.")
0 commit comments