refactor: 收口 V3 分层架构与插件兼容边界

This commit is contained in:
jxxghp
2026-08-18 13:22:02 +08:00
parent cca99bd421
commit 8472bcff43
274 changed files with 10730 additions and 6130 deletions
+11
View File
@@ -41,6 +41,10 @@ class SiteMutationRepository(Protocol):
"""暂存一组站点优先级变更。"""
...
async def stage_reset(self) -> None:
"""暂存清空全部站点。"""
...
SiteIndexerLoader = Callable[[str], Awaitable[Optional[dict]]]
SiteEventPublisher = Callable[[dict], Awaitable[None]]
@@ -133,6 +137,13 @@ class SiteMutationCommand:
await self._publish_deleted({"site_id": site_id})
return SiteMutationResult(True)
async def reset(self) -> SiteMutationResult:
"""清空全部站点,并在提交后发布通配站点删除事件。"""
await self._repository.stage_reset()
await self._commit()
await self._publish_deleted({"site_id": "*"})
return SiteMutationResult(True)
async def _commit(self) -> None:
"""提交当前站点事务,失败时回滚并保留原始异常。"""
try: