Skip to main content

Module memo

Module memo 

Source

Structsยง

DirPathsLower ๐Ÿ”’
Folded-name memo โ€” its own derived-cache slot (TypeId-keyed).
DirPathsOrig ๐Ÿ”’
Original-name memo โ€” separate slot, built only by orig-case path terms.
DirPathsPool ๐Ÿ”’
Memoized full paths for every directory, for one name pool. Only built when the query contains path terms โ€” and split per pool so a query only pays for the pool(s) it reads (nearly all path queries are folded). Entry paths are memo[parent] + name.
MtimePerm ๐Ÿ”’
Mtime order โ€” separate slot.
OffsetTable ๐Ÿ”’
Sorted (pool offset โ†’ entry id) table that maps pool-scan hits back to entries. name_off loses monotonicity after renames (new names append), so a sorted view is maintained per content generation via the indexโ€™s derived-cache slot โ€” incrementally when possible (Self::extend_from): pool appends are always at the tail, so a generation step is โ€œcopy + appendโ€, never a re-sort.
PathMemos ๐Ÿ”’
The path memos one query execution may read. None means the compiled query proved it never reads that pool โ€” most path queries are folded and skip the original-name memo entirely.
SizePerm ๐Ÿ”’
Size order โ€” its own derived-cache slot (TypeId-keyed).
SortPerm ๐Ÿ”’
Pre-sorted id order for one sort key, built on the first query that sorts by it and extended per content generation after that โ€” the same insertion-point in-place merge the name permutation uses, through the same cmp_by order (ADR-0006).

Constantsยง

STALE_REBUILD_DIVISOR ๐Ÿ”’
Past this stale fraction the copy-and-append loses to a clean rebuild.

Functionsยง

derived_cache_bytes
Bytes currently held by this indexโ€™s derived caches (offset table + dir-path memos), for the RAM accounting in IndexStats. Probes only โ€” never builds.
prewarm
Build the pool offset table ahead of the first query โ€” the engine calls this once a volume turns Ready so no keystroke pays the cold cost.
take_perm ๐Ÿ”’
Reuse the previous permutationโ€™s allocation when the cache slot held the only Arc, clone otherwise (same policy as the other derived caches).
take_pool ๐Ÿ”’
Reuse the previous memoโ€™s allocations when the cache slot held the only Arc (the common case โ€” no in-flight query still reads it), clone otherwise.