Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ldclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
DataStoreStatusProvider,
DataStoreUpdateSink,
FeatureStore,
FlagTracker
FlagTracker,
ReadOnlyStore
)
from ldclient.migrations import OpTracker, Stage
from ldclient.plugin import (
Expand Down Expand Up @@ -272,7 +273,7 @@ def __start_up(self, start_wait: float):
self._data_system.data_source_status_provider
)
self.__flag_tracker = self._data_system.flag_tracker
self._store: FeatureStore = self._data_system.store # type: ignore
self._store: ReadOnlyStore = self._data_system.store

big_segment_store_manager = BigSegmentStoreManager(self._config.big_segments)
self.__big_segment_store_manager = big_segment_store_manager
Expand Down
11 changes: 10 additions & 1 deletion ldclient/impl/datasystem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
DataSourceState,
DataSourceStatusProvider,
DataStoreStatusProvider,
FlagTracker
FlagTracker,
ReadOnlyStore
)


Expand Down Expand Up @@ -141,6 +142,14 @@ def target_availability(self) -> DataAvailability:
"""
raise NotImplementedError

@property
@abstractmethod
def store(self) -> ReadOnlyStore:
"""
Returns the data store used by the data system.
"""
raise NotImplementedError


class SelectorStore(Protocol):
"""
Expand Down
3 changes: 2 additions & 1 deletion ldclient/impl/datasystem/fdv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
DataStoreStatusProvider,
FeatureStore,
FlagTracker,
ReadOnlyStore,
UpdateProcessor
)

Expand Down Expand Up @@ -110,7 +111,7 @@ def stop(self):
self._update_processor.stop()

@property
def store(self) -> FeatureStore:
def store(self) -> ReadOnlyStore:
return self._store_wrapper

def set_flag_value_eval_fn(self, eval_fn):
Expand Down
5 changes: 3 additions & 2 deletions ldclient/impl/datasystem/fdv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
DataStoreStatus,
DataStoreStatusProvider,
FeatureStore,
FlagTracker
FlagTracker,
ReadOnlyStore
)
from ldclient.versioned_data_kind import VersionedDataKind

Expand Down Expand Up @@ -500,7 +501,7 @@ def _recovery_condition(self, status: DataSourceStatus) -> bool:
return interrupted_at_runtime or healthy_for_too_long or cannot_initialize

@property
def store(self) -> FeatureStore:
def store(self) -> ReadOnlyStore:
"""Get the underlying store for flag evaluation."""
return self._store.get_active_store()

Expand Down
4 changes: 1 addition & 3 deletions ldclient/impl/datasystem/protocolv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,7 @@ class Change:
kind: ObjectKind
key: str
version: int
object: Any = (
None # TODO(fdv2): At some point, we should define a better type for this.
)
object: Optional[dict] = None


@dataclass(frozen=True)
Expand Down
Loading