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
9 changes: 0 additions & 9 deletions ldclient/impl/stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ def start(self):
def stop(self):
pass

def is_alive(self):
return False

def send_event(self, event):
pass

Expand All @@ -36,9 +33,6 @@ def start(self):
def stop(self):
pass

def is_alive(self):
return False

def initialized(self):
return True

Expand All @@ -54,9 +48,6 @@ def start(self):
async def stop(self):
pass

def is_alive(self):
return False

def send_event(self, event):
pass

Expand Down
28 changes: 8 additions & 20 deletions ldclient/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,37 +526,25 @@ async def initialized_internal(self) -> bool:
# not declared here as required methods.


# Internal use only. Common methods for components that perform a task in the background.
class BackgroundOperation:
class UpdateProcessor(ABC):
"""
Interface for the component that obtains feature flag data in some way and passes it to a
:class:`FeatureStore`. The built-in implementations of this are the client's standard streaming
or polling behavior. For testing purposes, there is also :func:`ldclient.integrations.Files.new_data_source()`.
"""

# noinspection PyMethodMayBeStatic
def start(self):
"""
Starts an operation in the background. Should return immediately and not block.
Starts the update processor in the background. Returns immediately and does not block.
"""
pass

def stop(self):
"""
Stops an operation running in the background. May return before the operation is actually stopped.
Stops the update processor. Can return before the background work stops.
"""
pass

# noinspection PyMethodMayBeStatic
def is_alive(self) -> bool:
"""
Returns whether the operation is alive or not
"""
return True


class UpdateProcessor(BackgroundOperation, ABC):
"""
Interface for the component that obtains feature flag data in some way and passes it to a
:class:`FeatureStore`. The built-in implementations of this are the client's standard streaming
or polling behavior. For testing purposes, there is also :func:`ldclient.integrations.Files.new_data_source()`.
"""

def initialized(self) -> bool: # type: ignore[empty-body]
"""
Returns whether the update processor has received feature flags and has initialized its feature store.
Expand Down
3 changes: 0 additions & 3 deletions ldclient/testing/mock_async_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,3 @@ async def stop(self):

def initialized(self) -> bool:
return True

def is_alive(self) -> bool:
return True
6 changes: 0 additions & 6 deletions ldclient/testing/stub_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ def stop(self):
def start(self):
self._running = True

def is_alive(self):
return self._running

def send_event(self, event):
self._events.append(event)

Expand Down Expand Up @@ -176,9 +173,6 @@ def start(self):
def stop(self):
pass

def is_alive(self):
return True

def initialized(self):
return True

Expand Down
Loading