Files
python-repositories/python_repositories/interfaces/connection_aware_interface.py
T
Brian Bjarke JensenandCursor 67bb88fbb4
PR Title Check / check-title (pull_request) Successful in 5s
Test Python Package / unit-tests (pull_request) Successful in 13s
Test Python Package / integration-tests (pull_request) Successful in 30s
Test Python Package / coverage-report (pull_request) Failing after 15s
Code Quality Pipeline / code-quality (pull_request) Successful in 53s
Align Redis and MinIO connect() idempotency in ConnectionAwareAdapter.
Move shared connect orchestration into the base adapter so both backends short-circuit when already healthy and only reconnect after a failed probe.

Co-authored-by: Cursor <[email protected]>
2026-07-09 15:46:39 +02:00

30 lines
773 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.
Implementations should be idempotent: calling connect while already
connected and healthy is a no-op.
"""
...
@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.
"""
...