cooklang_sync_client::indexer

Function run

Source
pub async fn run(
    pool: &ConnectionPool,
    storage_path: &Path,
    namespace_id: i32,
    local_file_update_rx: Receiver<DebounceEventResult>,
    updated_tx: Sender<IndexerUpdateEvent>,
) -> Result<(), SyncError>
Expand description

Indexer main loop. It doesn’t manipulate files, but only compares what we have in filesystem with what we have in DB. If it finds a difference it will update DB records. When any change made it will send a message in channel that Syncer is listening.

It runs both on interval and on any event coming from FS watcher.