整理代码

This commit is contained in:
strepsiades
2026-04-03 09:18:44 +08:00
parent 543c3ff906
commit f5729d5a18
50 changed files with 305 additions and 296 deletions
@@ -163,6 +163,11 @@ class BaseDataSource(ABC):
"""Datasource-specific hook after a FAILED result is applied to node."""
return
def _prepare_handler_for_registration(self, handler: "NodeHandler") -> None:
"""Allow subclasses to inject datasource-specific dependencies before registration."""
if self._collection is not None:
handler.set_collection(self._collection)
async def _handle_success_result(self, node: "SyncNode", result: "TaskResult") -> None:
previous_data_id = node.data_id
ok = self._apply_sync_execute_state(
@@ -371,6 +376,7 @@ class BaseDataSource(ABC):
示例:
datasource.add_handler(ContractNodeHandler(api_client))
"""
self._prepare_handler_for_registration(handler)
self._handlers[handler.node_type] = handler
def get_handler(self, node_type: str) -> "NodeHandler":