Files
python-repositories/python_repositories/interfaces/connection_aware_interface.py
T
Brian Bjarke JensenandCursor 5149299c1b
Code Quality Pipeline / code-quality (pull_request) Failing after 35s
PR Title Check / check-title (pull_request) Successful in 6s
Test Python Package / test (pull_request) Successful in 1m9s
Strengthen is_connected with cached health probes.
Convert is_connected to a method that verifies backend liveness via TTL-cached ping (Redis) or bucket_exists (MinIO), with cache invalidation on connect/disconnect.

Co-authored-by: Cursor <[email protected]>
2026-07-05 15:28:25 +02:00

26 lines
645 B
Python

"""Definition of ConnectionAwareInterface abstract base class."""
from abc import ABC, abstractmethod
class ConnectionAwareInterface(ABC):
"""Interface that defines connection-related methods."""
@abstractmethod
def connect(self) -> None:
"""Connect to resource."""
...
@abstractmethod
def disconnect(self) -> None:
"""Disconnect from resource."""
...
@abstractmethod
def is_connected(self) -> bool:
"""Return whether the adapter has an active, reachable connection.
Implementations may perform a cached network probe to verify liveness.
"""
...