pub struct IndexingCoordinator { /* private fields */ }Expand description
Daemon-side coordinator for global dependency indexing and cross-project symbol reference tracking.
Owns a DependencyIndex (backed by SQLite at
StorageLayout::global_dependency_db()) and an in-memory XrefGraph
for cross-project symbol edges.
§Thread safety
IndexingCoordinator is Send + Sync – the DependencyIndex uses an
internal Mutex<Connection> and the XrefGraph is wrapped in a
Mutex here.
Implementations§
Source§impl IndexingCoordinator
impl IndexingCoordinator
Sourcepub fn new(layout: &StorageLayout) -> Result<Self, IndexingError>
pub fn new(layout: &StorageLayout) -> Result<Self, IndexingError>
Create a new indexing coordinator.
Opens (or creates) the dependency index database at
layout.global_dependency_db() and initialises an empty cross-project
reference graph.
§Errors
Returns IndexingError::DependencyIndex if the database cannot be
opened or initialised.
Sourcepub fn index_project_deps(
&self,
project_root: &Path,
) -> Result<usize, IndexingError>
pub fn index_project_deps( &self, project_root: &Path, ) -> Result<usize, IndexingError>
Parse project manifests and index their dependencies into the global dependency database.
Detects the manifest type (Cargo.toml, go.mod, package.json,
pyproject.toml) from files present in project_root and inserts all
discovered dependencies. Returns the count of dependencies indexed.
§Errors
Returns IndexingError::DependencyIndex if the manifest cannot be
read, parsed, or written to the database.
Sourcepub fn rebuild_xrefs(
&self,
worktree_id: &WorktreeId,
new_edges: Vec<XrefEdge>,
) -> Result<usize, IndexingError>
pub fn rebuild_xrefs( &self, worktree_id: &WorktreeId, new_edges: Vec<XrefEdge>, ) -> Result<usize, IndexingError>
Rebuild cross-project symbol references for the given worktree.
Marks existing edges for this project as stale, prunes them, and
inserts the provided new_edges. Returns the number of new edges
added.
The project identifier used for the xref graph is derived from the worktree’s graph directory path.
§Errors
Returns IndexingError::Xref if the internal mutex is poisoned.
Sourcepub fn query_xrefs(
&self,
symbol: &str,
_worktree_id: &WorktreeId,
) -> Result<Vec<XrefEdge>, IndexingError>
pub fn query_xrefs( &self, symbol: &str, _worktree_id: &WorktreeId, ) -> Result<Vec<XrefEdge>, IndexingError>
Query cross-project symbol references for a given symbol within a worktree context.
Returns all non-stale XrefEdges that reference symbol in either
direction (incoming and outgoing).
§Errors
Returns IndexingError::Xref if the internal mutex is poisoned.
Sourcepub fn projects_using_dep(
&self,
dep_name: &str,
) -> Result<Vec<DependencyEntry>, IndexingError>
pub fn projects_using_dep( &self, dep_name: &str, ) -> Result<Vec<DependencyEntry>, IndexingError>
Query which projects depend on the named library.
Delegates to DependencyIndex::projects_using.
§Errors
Returns IndexingError::DependencyIndex if the database query fails.
Sourcepub fn project_dependencies(
&self,
project_path: &str,
) -> Result<Vec<DependencyEntry>, IndexingError>
pub fn project_dependencies( &self, project_path: &str, ) -> Result<Vec<DependencyEntry>, IndexingError>
Query all dependencies of a given project.
Delegates to DependencyIndex::dependencies_of.
§Errors
Returns IndexingError::DependencyIndex if the database query fails.