A service that monitors a {@link SnapshotRepository} and makes callbackswhen changes occur.
This implementation works as follows. It repeatedly scans all the {@link DocumentSnapshot} entries returned by{@link SnapshotRepository#iterator()}. On each pass, it compares the current contents of the repository to a record of what it saw on the previous pass. The record is stored as a file in the local repository. Each discrepancy is propagated to the client.
Using a local snapshot of the repository has some serious flaws for continuous crawl:
- The local snapshot can diverge from the actual contents of the GSA. This can lead to situations where discrepancies are not corrected.
- If the local snapshot gets corrupted, there is no way to recover short of deleting all on the GSA and starting again.
A much more robust solution is to obtain snapshots directly from the GSA at least part of the time. (However, to save bandwidth, it may still be useful to keep local snapshots and only get an "authoritative" snapshot from the cloud occasionally. E.g., once a week or if the local snapshot is corrupted.)
When an API to do that is available, this implementation should be fixed to use it.
@since 2.8