Skip to main content

Module cache

Module cache 

Source
Expand description

Change-detection cache backed by redb.

For each indexed file we remember (inode, mtime, size, content_hash) plus where the current version lives (segment_id, doc_id). On a re-index or a filesystem event we do a cheap mtime+size pre-check before hashing, and only re-index when the fast hash actually changed. This rejects spurious touches and lets us tombstone the stale doc.

The cache is purely an optimization: it can always be rebuilt by re-indexing. That property drives two design choices below — a stored schema version that wipes the cache on any FileRecord layout change (degrading to a re-index instead of a hard deserialize error), and relaxed write durability on the hot apply path (a crash just costs a re-index).

Structs§

Cache
Handle to the on-disk change-detection cache.
FileRecord
Per-file record used for incremental indexing.

Functions§

fast_hash
Compute the fast content hash used for change detection.
stat_key
Extract (inode, mtime_ns, size) from filesystem metadata.