pub async fn start_eviction_loop(
store: Arc<SqliteStore>,
embedding: Option<Arc<EmbeddingStore>>,
config: EvictionConfig,
policy: Arc<dyn EvictionPolicy + 'static>,
cancel: CancellationToken,
)Expand description
Start the background eviction loop.
The loop runs every config.sweep_interval_secs seconds. Each iteration:
- Queries
SQLitefor all non-deleted entries and their eviction metadata. - Scores each entry using
policy. - If the count exceeds
config.max_entries, soft-deletes the excess lowest-scoring rows. - Queries for all soft-deleted rows, deletes their Qdrant vectors via
embedding(whenSome), then marks the rows clean. If deletion fails, clean-up is retried next sweep.
If config.max_entries == 0, the loop exits immediately without doing anything.
Pass embedding: None when Qdrant is disabled — the loop will still clean SQLite
bookkeeping without attempting any vector deletion.
§Errors (non-fatal)
Database and Qdrant errors are logged but do not stop the loop.