sync: 鍚屾灞€鍩熺綉鏈€鏂颁唬鐮?(source master @ b69568e4)
This commit is contained in:
1 parent
4f7f07504a
commit
8bc8b0e082
1651 files changed
+278599
-11416
No files matched your search
+130
-5
@@ -14,8 +14,102 @@ class LlmWikiIndexStore(ABC):
|
||||
@abstractmethod
|
||||
async def get_page(self, mapping_id: str, slug: str) -> dict[str, Any] | None: ...
|
||||
|
||||
async def search_pages_by_keywords(
|
||||
self,
|
||||
mapping_ids: list[str],
|
||||
tokens: list[str],
|
||||
*,
|
||||
limit: int = 100,
|
||||
include_drafts: bool = False,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Return local Wiki body pages containing any token.
|
||||
|
||||
The default keeps lightweight test doubles and third-party stores
|
||||
backward compatible. Database and in-memory stores override it.
|
||||
"""
|
||||
|
||||
return []
|
||||
|
||||
async def list_pages(
|
||||
self,
|
||||
mapping_ids: list[str],
|
||||
*,
|
||||
limit: int = 500,
|
||||
include_drafts: bool = False,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Return a bounded, newest-first Wiki page snapshot.
|
||||
|
||||
Smart-reasoning regex search applies its expression in Python so the
|
||||
behavior stays identical on SQLite, MySQL and GaussDB. Third-party
|
||||
stores may keep the empty default; the tool then uses the remote Wiki
|
||||
API fallback.
|
||||
"""
|
||||
|
||||
return []
|
||||
|
||||
async def replace_graph_edges(
|
||||
self,
|
||||
mapping_id: str,
|
||||
edges: list[dict[str, Any]],
|
||||
*,
|
||||
owner: str,
|
||||
sync_id: str,
|
||||
) -> dict[str, Any] | None:
|
||||
"""Replace one mapping's directed Wiki graph snapshot.
|
||||
|
||||
The default keeps lightweight third-party/test stores compatible. An
|
||||
implementation must resolve both endpoints inside ``mapping_id`` and
|
||||
discard dangling or cross-mapping edges. ``None`` means the caller no
|
||||
longer owns the supplied sync lease and no mutation was made.
|
||||
"""
|
||||
|
||||
return {"edge_count": 0, "changed": False}
|
||||
|
||||
async def get_adjacent_pages(
|
||||
self,
|
||||
mapping_ids: list[str],
|
||||
seed_slugs: dict[str, list[str]] | list[str],
|
||||
*,
|
||||
direction: str = "both",
|
||||
limit: int = 100,
|
||||
include_drafts: bool = False,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Return one-hop neighbors within the explicitly allowed mappings.
|
||||
|
||||
Passing a ``{mapping_id: [slug, ...]}`` mapping is preferred because it
|
||||
retains the exact seed provenance. A flat slug list is applied only to
|
||||
the supplied ``mapping_ids`` and never broadens authorization.
|
||||
"""
|
||||
|
||||
return []
|
||||
|
||||
@abstractmethod
|
||||
async def touch_page(self, page_id: str, sync_id: str) -> None: ...
|
||||
async def touch_page(
|
||||
self,
|
||||
page_id: str,
|
||||
sync_id: str,
|
||||
*,
|
||||
mapping_id: str | None = None,
|
||||
owner: str | None = None,
|
||||
) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
async def refresh_page_metadata(
|
||||
self,
|
||||
*,
|
||||
page: dict[str, Any],
|
||||
sync_id: str,
|
||||
owner: str,
|
||||
) -> dict[str, Any] | None:
|
||||
"""Refresh a mirrored page without replacing its vectors.
|
||||
|
||||
The write is fenced by the mapping sync lease. ``None`` means the
|
||||
caller no longer owns that lease (or the expected page disappeared),
|
||||
while the returned ``changed`` flag reports whether durable page
|
||||
metadata changed. The page is always marked as seen by ``sync_id``.
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
async def replace_page_vectors(
|
||||
@@ -25,13 +119,34 @@ class LlmWikiIndexStore(ABC):
|
||||
vectors: list[dict[str, Any]],
|
||||
fingerprint: str,
|
||||
sync_id: str,
|
||||
) -> dict[str, Any]: ...
|
||||
owner: str | None = None,
|
||||
) -> dict[str, Any] | None: ...
|
||||
|
||||
@abstractmethod
|
||||
async def record_page_failure(self, *, page: dict[str, Any], sync_id: str, error: str) -> None: ...
|
||||
async def record_page_failure(
|
||||
self,
|
||||
*,
|
||||
page: dict[str, Any],
|
||||
sync_id: str,
|
||||
error: str,
|
||||
owner: str | None = None,
|
||||
) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
async def mark_missing_pages_deleted(self, mapping_id: str, sync_id: str) -> int: ...
|
||||
async def mark_missing_pages_deleted(
|
||||
self,
|
||||
mapping_id: str,
|
||||
sync_id: str,
|
||||
*,
|
||||
owner: str,
|
||||
) -> int | None:
|
||||
"""Retire pages absent from a fenced full scan.
|
||||
|
||||
``None`` means the supplied owner/sync pair no longer owns the mapping
|
||||
lease and no mutation was made.
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
async def load_vector_snapshot(self, mapping_id: str, fingerprint: str) -> dict[str, Any]: ...
|
||||
@@ -73,7 +188,17 @@ class LlmWikiIndexStore(ABC):
|
||||
) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
async def finish_sync(self, mapping_id: str, *, owner: str, sync_id: str, success: bool, remote_page_count: int, error: str | None = None) -> None: ...
|
||||
async def finish_sync(
|
||||
self,
|
||||
mapping_id: str,
|
||||
*,
|
||||
owner: str,
|
||||
sync_id: str,
|
||||
success: bool,
|
||||
remote_page_count: int,
|
||||
error: str | None = None,
|
||||
result: dict[str, Any] | None = None,
|
||||
) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
async def list_index_status(self, mapping_ids: list[str] | None = None) -> list[dict[str, Any]]: ...
|
||||
|
||||
Reference in new issue
Block a user