Expand description
workspace_index salsa query — aggregates every file’s FileIndex into a
single structure with pre-built reverse maps.
Before Phase J, cross-file queries (workspace_symbols,
prepare_type_hierarchy, supertypes_of, subtypes_of,
find_implementations) called DocumentStore::all_indexes() on every
request. all_indexes() takes the host mutex once per file via
get_index_salsa → snapshot_query, so a workspace with 1600 files
paid 1600 lock acquisitions per lookup.
This query runs once per workspace revision and returns:
files: the flat(Url, Arc<FileIndex>)list every handler used to rebuild by hand,classes_by_name:name → [ClassRef]for constant-time prepare / supertype resolution,subtypes_of:name → [ClassRef]for constant-time subtype / implementation lookups.
All lookups on the aggregate run in memory against an already-materialised
Arc; edits invalidate the aggregate through file_index dependency
tracking as usual.
Structs§
- Class
Ref - Back-pointer into
WorkspaceIndexData.files:(file_idx, class_idx)whereclass_idxindexes intofiles[file_idx].1.classes. - Workspace
Index Arc - Arc wrapper with the same
Arc::ptr_eq-basedUpdateimpl used throughoutsrc/db/. The innerWorkspaceIndexDatanever compares structurally. - Workspace
Index Data - Aggregated workspace-level index. Constructed once per salsa revision by
workspace_indexand held behind anArcfor cheap cross-request sharing.
Functions§
- workspace_
index - Build the aggregate workspace index.