整理了初始化过程,现在更容易被继承了。
This commit is contained in:
@@ -88,6 +88,13 @@ class BaseDataSource(ABC):
|
||||
self._poll_interval = max(0, poll_interval)
|
||||
self._sm_runtime: Optional[StateMachineRuntime] = None
|
||||
|
||||
def set_target_project_ids(self, target_project_ids: List[str]) -> None:
|
||||
self._target_project_ids = [str(item) for item in target_project_ids if str(item)]
|
||||
|
||||
@property
|
||||
def target_project_ids(self) -> List[str]:
|
||||
return list(self._target_project_ids)
|
||||
|
||||
def _ensure_sm_runtime(self) -> StateMachineRuntime:
|
||||
if self._sm_runtime is None:
|
||||
cfg_path = Path(__file__).resolve().parents[1] / "config" / "node_state_machine.yaml"
|
||||
@@ -957,6 +964,10 @@ class BaseDataSource(ABC):
|
||||
|
||||
return summary
|
||||
|
||||
async def initialize(self) -> None:
|
||||
"""初始化数据源资源(子类可覆盖)"""
|
||||
return None
|
||||
|
||||
async def close(self) -> None:
|
||||
"""关闭数据源资源(子类可覆盖以实现特定的清理逻辑)"""
|
||||
pass # 基类默认空实现
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user