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
6 changes: 3 additions & 3 deletions contract-tests/async_client_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
)
from ldclient.config import HTTPConfig
from ldclient.feature_store import CacheConfig
from ldclient.impl.datasourcev2.async_polling import (
from ldclient.impl.datasource.async_polling import (
AsyncFallbackToFDv1PollingDataSourceBuilder,
AsyncPollingDataSourceBuilder
)
from ldclient.impl.datasourcev2.async_streaming import (
from ldclient.impl.datasource.async_streaming import (
AsyncStreamingDataSourceBuilder
)
from ldclient.impl.util import Result
Expand Down Expand Up @@ -83,7 +83,7 @@ async def start(self):

datasystem_config = config_params.get('dataSystem')
if datasystem_config is not None:
opts["datasystem_config"] = _build_async_data_system(datasystem_config, opts)
opts["data_system"] = _build_async_data_system(datasystem_config, opts)

if config_params.get("events") is not None:
events = config_params["events"]
Expand Down
4 changes: 2 additions & 2 deletions contract-tests/client_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
streaming_ds_builder
)
from ldclient.feature_store import CacheConfig
from ldclient.impl.datasourcev2.polling import PollingDataSourceBuilder
from ldclient.impl.datasource.polling import PollingDataSourceBuilder
from ldclient.integrations import Consul, DynamoDB, Redis
from ldclient.interfaces import DataStoreMode

Expand Down Expand Up @@ -129,7 +129,7 @@ def __init__(self, tag, config):

datasystem.data_store(store, store_mode)

opts["datasystem_config"] = datasystem.build()
opts["data_system"] = datasystem.build()

if config.get("events") is not None:
events = config["events"]
Expand Down
8 changes: 4 additions & 4 deletions docs/api-testing.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Test fixtures
=============

ldclient.integrations.test_datav2 module
----------------------------------------
ldclient.integrations.test_data module
--------------------------------------

The entry point for this feature is :class:`ldclient.integrations.test_datav2.TestDataV2`.
The entry point for this feature is :class:`ldclient.integrations.test_data.TestData`.

.. automodule:: ldclient.integrations.test_datav2
.. automodule:: ldclient.integrations.test_data
:members:
:special-members: __init__
:show-inheritance:
16 changes: 8 additions & 8 deletions ldclient/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, config: AsyncConfig):

self._config = config
self._config._instance_id = str(uuid4())
self._datasystem_config = config.datasystem_config or async_datasystem.default().build()
self._data_system_config = config.data_system or async_datasystem.default().build()
self._lifecycle_lock = asyncio.Lock()

self._started = False
Expand Down Expand Up @@ -218,13 +218,13 @@ async def __start_up(self, start_wait: float):
# The data system builds its data sources from builders. Give the shared
# session to the builders before the data system starts.
if not self._config.offline:
self._wire_data_source_sessions(self._datasystem_config)
self._wire_data_source_sessions(self._data_system_config)

if self._config.offline:
log.info("Started LaunchDarkly Client in offline mode")
elif _is_daemon_mode(self._datasystem_config):
elif _is_daemon_mode(self._data_system_config):
log.info("Started LaunchDarkly Client in daemon mode")
elif _has_no_data_sources(self._datasystem_config):
elif _has_no_data_sources(self._data_system_config):
log.warning("The data system has no data sources and no persistent store. All evaluations will return default values.")

diagnostic_accumulator = self._set_event_processor(self._config)
Expand All @@ -237,7 +237,7 @@ async def __start_up(self, start_wait: float):
update_processor_ready = AsyncEvent()
self._data_system.start(update_processor_ready)

if not self._config.offline and not _is_daemon_mode(self._datasystem_config):
if not self._config.offline and not _is_daemon_mode(self._data_system_config):
if start_wait > 60:
log.warning(f"Client was configured to block for up to {start_wait} seconds when initializing. We recommend blocking no longer than 60.")

Expand All @@ -263,16 +263,16 @@ def _get_session(self):
def _make_data_system(self) -> AsyncDataSystem:
from ldclient.impl.datasystem.async_fdv2 import AsyncFDv2

return AsyncFDv2(self._config, self._datasystem_config)
return AsyncFDv2(self._config, self._data_system_config)

def _wire_data_source_sessions(self, data_system_config) -> None:
"""Provide the client's aiohttp session to any async data source
builders so the sources they build share the client's connection pool."""
from ldclient.impl.datasourcev2.async_polling import (
from ldclient.impl.datasource.async_polling import (
AsyncFallbackToFDv1PollingDataSourceBuilder,
AsyncPollingDataSourceBuilder
)
from ldclient.impl.datasourcev2.async_streaming import (
from ldclient.impl.datasource.async_streaming import (
AsyncStreamingDataSourceBuilder
)

Expand Down
10 changes: 5 additions & 5 deletions ldclient/async_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __init__(
plugins: Optional[List[AsyncPlugin]] = None,
enable_event_compression: bool = True,
omit_anonymous_contexts: bool = False,
datasystem_config: Optional[AsyncDataSystemConfig] = None,
data_system: Optional[AsyncDataSystemConfig] = None,
):
"""
:param sdk_key: The SDK key for your LaunchDarkly account. This is always required.
Expand Down Expand Up @@ -228,7 +228,7 @@ def __init__(
set this to False to prevent extra CPU use, because the Relay Proxy decompresses and recompresses
the payloads.
:param omit_anonymous_contexts: Sets whether anonymous contexts should be omitted from index and identify events.
:param datasystem_config: Configuration for the data system, which controls how the SDK gets flag and
:param data_system: Configuration for the data system, which controls how the SDK gets flag and
segment data. Build it with the functions in :mod:`ldclient.async_datasystem`. If it is not set, the
SDK uses :func:`ldclient.async_datasystem.default`.
"""
Expand Down Expand Up @@ -263,7 +263,7 @@ def __init__(
self.__enable_event_compression = enable_event_compression
self.__omit_anonymous_contexts = omit_anonymous_contexts
self.__instance_id: Optional[str] = None
self._datasystem_config = datasystem_config
self._data_system = data_system

# for internal use only - probably should be part of the client logic
def get_default(self, key, default):
Expand Down Expand Up @@ -416,12 +416,12 @@ def _instance_id(self, value: Optional[str]) -> None:
self.__instance_id = value

@property
def datasystem_config(self) -> Optional[AsyncDataSystemConfig]:
def data_system(self) -> Optional[AsyncDataSystemConfig]:
"""
Configuration for the data system, which controls how the SDK gets
flag and segment data.
"""
return self._datasystem_config
return self._data_system

def _validate(self):
if self.offline is False and self.sdk_key == '':
Expand Down
4 changes: 2 additions & 2 deletions ldclient/async_datasystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

from ldclient.async_config import AsyncDataSystemConfig
from ldclient.config import DataSourceBuilder
from ldclient.impl.datasourcev2.async_polling import (
from ldclient.impl.datasource.async_polling import (
AsyncFallbackToFDv1PollingDataSourceBuilder,
AsyncPollingDataSourceBuilder
)
from ldclient.impl.datasourcev2.async_streaming import (
from ldclient.impl.datasource.async_streaming import (
AsyncStreamingDataSourceBuilder
)
from ldclient.interfaces import (
Expand Down
12 changes: 6 additions & 6 deletions ldclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self, config: Config, start_wait: float = 5):
self._config = config
self._config._instance_id = str(uuid4())
self._config._validate()
self._datasystem_config = config.datasystem_config or datasystem.default().build()
self._data_system_config = config.data_system or datasystem.default().build()

self._event_processor = None
self._event_factory_default = EventFactory(False)
Expand Down Expand Up @@ -166,7 +166,7 @@ def _fork_breaks_client(self) -> bool:
"""
if self._config.offline:
return False
if _is_daemon_mode(self._datasystem_config) and not self._config.send_events:
if _is_daemon_mode(self._data_system_config) and not self._config.send_events:
return False
return True

Expand All @@ -177,7 +177,7 @@ def __start_up(self, start_wait: float):
self.__hooks_lock = ReadWriteLock()
self.__hooks = self._config.hooks + plugin_hooks # type: List[Hook]

self._data_system: DataSystem = FDv2(self._config, self._datasystem_config)
self._data_system: DataSystem = FDv2(self._config, self._data_system_config)

self.__flag_tracker = FlagTrackerImpl(
self._data_system.flag_change_listeners,
Expand All @@ -201,9 +201,9 @@ def __start_up(self, start_wait: float):

if self._config.offline:
log.info("Started LaunchDarkly Client in offline mode")
elif _is_daemon_mode(self._datasystem_config):
elif _is_daemon_mode(self._data_system_config):
log.info("Started LaunchDarkly Client in daemon mode")
elif _has_no_data_sources(self._datasystem_config):
elif _has_no_data_sources(self._data_system_config):
log.warning("The data system has no data sources and no persistent store. All evaluations will return default values.")

diagnostic_accumulator = self._set_event_processor(self._config)
Expand All @@ -216,7 +216,7 @@ def __start_up(self, start_wait: float):
update_processor_ready = threading.Event()
self._data_system.start(update_processor_ready)

if not self._config.offline and not _is_daemon_mode(self._datasystem_config):
if not self._config.offline and not _is_daemon_mode(self._data_system_config):
if start_wait > 60:
log.warning(f"Client was configured to block for up to {start_wait} seconds when initializing. We recommend blocking no longer than 60.")

Expand Down
10 changes: 5 additions & 5 deletions ldclient/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def __init__(
plugins: Optional[List[Plugin]] = None,
enable_event_compression: bool = True,
omit_anonymous_contexts: bool = False,
datasystem_config: Optional[DataSystemConfig] = None,
data_system: Optional[DataSystemConfig] = None,
):
"""
:param sdk_key: The SDK key for your LaunchDarkly account. This is always required.
Expand Down Expand Up @@ -371,7 +371,7 @@ def __init__(
set this to False to prevent extra CPU use, because the Relay Proxy decompresses and recompresses
the payloads.
:param omit_anonymous_contexts: Sets whether anonymous contexts should be omitted from index and identify events.
:param datasystem_config: Configuration for the data system, which controls how the SDK gets flag and
:param data_system: Configuration for the data system, which controls how the SDK gets flag and
segment data. Build it with the functions in :mod:`ldclient.datasystem`. If it is not set, the SDK
uses :func:`ldclient.datasystem.default`.
"""
Expand Down Expand Up @@ -406,7 +406,7 @@ def __init__(
self.__enable_event_compression = enable_event_compression
self.__omit_anonymous_contexts = omit_anonymous_contexts
self._instance_id: Optional[str] = None
self._datasystem_config = datasystem_config
self._data_system = data_system

def with_wrapper_information(self, wrapper_name: Optional[str], wrapper_version: Optional[str] = None) -> 'Config':
"""Returns a new ``Config`` instance that is the same as this one, except for having different wrapper information.
Expand Down Expand Up @@ -570,12 +570,12 @@ def omit_anonymous_contexts(self) -> bool:
return self.__omit_anonymous_contexts

@property
def datasystem_config(self) -> Optional[DataSystemConfig]:
def data_system(self) -> Optional[DataSystemConfig]:
"""
Configuration for the data system, which controls how the SDK gets
flag and segment data.
"""
return self._datasystem_config
return self._data_system

def _validate(self):
if self.offline is False and self.sdk_key == '':
Expand Down
12 changes: 6 additions & 6 deletions ldclient/datasystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from typing import List, Optional

from ldclient.config import DataSourceBuilder, DataSystemConfig
from ldclient.impl.datasourcev2.polling import (
from ldclient.impl.datasource.polling import (
FallbackToFDv1PollingDataSourceBuilder,
PollingDataSourceBuilder
)
from ldclient.impl.datasourcev2.streaming import StreamingDataSourceBuilder
from ldclient.impl.integrations.files.file_data_sourcev2 import (
FileDataSourceV2Builder
from ldclient.impl.datasource.streaming import StreamingDataSourceBuilder
from ldclient.impl.integrations.files.file_data_source import (
FileDataSourceBuilder
)
from ldclient.interfaces import (
DataStoreMode,
Expand Down Expand Up @@ -114,11 +114,11 @@ def streaming_ds_builder() -> StreamingDataSourceBuilder:
return StreamingDataSourceBuilder()


def file_ds_builder(paths: List[str]) -> FileDataSourceV2Builder:
def file_ds_builder(paths: List[str]) -> FileDataSourceBuilder:
"""
Returns a builder for a file-based data source.
"""
return FileDataSourceV2Builder(paths)
return FileDataSourceBuilder(paths)


def default() -> ConfigBuilder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from ldclient.impl.aio.concurrency import AsyncEvent
from ldclient.impl.aio.transport import AsyncHTTPTransport
from ldclient.impl.datasourcev2.polling_common import (
from ldclient.impl.datasource.polling_common import (
FDV1_POLLING_ENDPOINT,
PollAction,
fdv1_polling_payload_to_changeset,
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(
@property
def name(self) -> str:
"""Returns the name of the initializer."""
return "PollingDataSourceV2"
return "PollingDataSource"

async def fetch(self, ss: SelectorStore) -> BasisResult:
"""
Expand All @@ -114,7 +114,7 @@ async def sync(self, ss: SelectorStore) -> AsyncGenerator[Update, None]:
Update objects until the connection is closed or an unrecoverable error
occurs.
"""
log.info("Starting PollingDataSourceV2 synchronizer")
log.info("Starting PollingDataSource synchronizer")
self._interrupt_event.clear()
self._stop.clear()
try:
Expand All @@ -135,7 +135,7 @@ async def sync(self, ss: SelectorStore) -> AsyncGenerator[Update, None]:

async def stop(self):
"""Signals the synchronizer to stop."""
log.info("Stopping PollingDataSourceV2 synchronizer")
log.info("Stopping PollingDataSource synchronizer")
self._interrupt_event.set()
self._stop.set()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
HTTPConfig
)
from ldclient.impl.aio.transport import AsyncSSEFactory, make_client_session
from ldclient.impl.datasourcev2.streaming_common import (
from ldclient.impl.datasource.streaming_common import (
classify_stream_error,
process_message,
with_fallback_signal
Expand Down Expand Up @@ -241,7 +241,7 @@ async def stop(self):
"""
Stops the streaming synchronizer, closing any open connections.
"""
log.info("Stopping StreamingDataSourceV2 synchronizer")
log.info("Stopping StreamingDataSource synchronizer")
self._running = False
if self._sse:
await self._sse.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
DataSourceBuilderConfig,
HTTPConfig
)
from ldclient.impl.datasourcev2.polling_common import (
from ldclient.impl.datasource.polling_common import (
FDV1_POLLING_ENDPOINT,
PollAction,
fdv1_polling_payload_to_changeset,
Expand Down Expand Up @@ -93,7 +93,7 @@ def __init__(
@property
def name(self) -> str:
"""Returns the name of the initializer."""
return "PollingDataSourceV2"
return "PollingDataSource"

def fetch(self, ss: SelectorStore) -> BasisResult:
"""
Expand All @@ -107,7 +107,7 @@ def sync(self, ss: SelectorStore) -> Generator[Update, None, None]:
Update objects until the connection is closed or an unrecoverable error
occurs.
"""
log.info("Starting PollingDataSourceV2 synchronizer")
log.info("Starting PollingDataSource synchronizer")
self._interrupt_event.clear()
self._stop.clear()
while self._stop.is_set() is False:
Expand All @@ -125,7 +125,7 @@ def sync(self, ss: SelectorStore) -> Generator[Update, None, None]:

def stop(self):
"""Stops the synchronizer."""
log.info("Stopping PollingDataSourceV2 synchronizer")
log.info("Stopping PollingDataSource synchronizer")
self._interrupt_event.set()
self._stop.set()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
DataSourceBuilderConfig,
HTTPConfig
)
from ldclient.impl.datasourcev2.streaming_common import (
from ldclient.impl.datasource.streaming_common import (
classify_stream_error,
process_message,
with_fallback_signal
Expand Down Expand Up @@ -249,7 +249,7 @@ def stop(self):
"""
Stops the streaming synchronizer, closing any open connections.
"""
log.info("Stopping StreamingDataSourceV2 synchronizer")
log.info("Stopping StreamingDataSource synchronizer")
self._running = False
if self._sse:
self._sse.close()
Expand Down
Loading
Loading