49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
|
|
"""Incremental-sync coordination layer (Task 2.7).
|
||
|
|
|
||
|
|
This package ties the scrapers (``app.scraper.*``) and the persistence layer
|
||
|
|
(``app.storage.repos``) together with **resumable, incremental** sync via the
|
||
|
|
``SyncState`` watermark table and the ``SyncRun`` audit log.
|
||
|
|
|
||
|
|
Public surface:
|
||
|
|
|
||
|
|
* :mod:`app.sync.watermarks` — SyncState CRUD (per-entity / per-channel /
|
||
|
|
per-scope cursor get/set + convenience accessors).
|
||
|
|
* :mod:`app.sync.orchestrator` — the sync brain. One entrypoint per entity
|
||
|
|
(``sync_wechat_messages`` / ``sync_wechat_friends`` / ...) plus a coordinator
|
||
|
|
(:func:`app.sync.orchestrator.sync_all_wechat`). Each run is logged as a
|
||
|
|
``SyncRun`` row (started → success/failed) so the dashboard / ops view can
|
||
|
|
report progress and errors.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from app.sync.orchestrator import (
|
||
|
|
SyncResult,
|
||
|
|
sync_all_wechat,
|
||
|
|
sync_departments,
|
||
|
|
sync_wechat_accounts,
|
||
|
|
sync_wechat_friends,
|
||
|
|
sync_wechat_groups,
|
||
|
|
sync_wechat_messages,
|
||
|
|
sync_wechat_voice_calls,
|
||
|
|
)
|
||
|
|
from app.sync.watermarks import (
|
||
|
|
get_last_timestamp,
|
||
|
|
get_last_version,
|
||
|
|
get_watermark,
|
||
|
|
set_watermark,
|
||
|
|
)
|
||
|
|
|
||
|
|
__all__ = [
|
||
|
|
"SyncResult",
|
||
|
|
"get_last_timestamp",
|
||
|
|
"get_last_version",
|
||
|
|
"get_watermark",
|
||
|
|
"set_watermark",
|
||
|
|
"sync_all_wechat",
|
||
|
|
"sync_departments",
|
||
|
|
"sync_wechat_accounts",
|
||
|
|
"sync_wechat_friends",
|
||
|
|
"sync_wechat_groups",
|
||
|
|
"sync_wechat_messages",
|
||
|
|
"sync_wechat_voice_calls",
|
||
|
|
]
|