INNER CODE UNIT · Python
_IndexChangeTracker
pathwaycom/llm-app · serviette/server/main.py:97
class _IndexChangeTracker:
"""Notice index changes the stored timestamps cannot show.
Accessors derive ``last_indexed_at`` from the newest row's ``seen_at``,
so a deletion (or an edit that only removes chunks) silently rolls the
value back to an older document. The tracker compares successive stats
snapshots and, when the row count or newest timestamp moves, records the
wall-clock time of that observation; ``observe`` then reports whichever
is later. State is per server process: after a restart the backend's
own value is used until the next change.
"""
def __init__(self) -> None:
self._snapshot: tuple | None = None
self._changed_at: int | None = None
def observe(self, stats: dict[str, Any]) -> dict[str, Any]:
import time