Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / method
_sync
codeintel.indexer.CodeIndexer._sync
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| list_files | git_source.py | unique name |
| _delete_resources | indexer.py | same file |
| _index_batch | indexer.py | same file |
| _repoint_unchanged | indexer.py | same file |
| _skip_reason | indexer.py | same file |
| heartbeat | jobs.py | unique name |
| Symbol | File | Resolved by |
|---|---|---|
| index | indexer.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| CodeIndexer | indexer.py | same file |
codeintel.indexer.CodeIndexer._syncbackend/app/codeintel/indexer.py, lines 245–289Open source
def _sync(self, repo_id, ref: RepoRef, checkout: Checkout, stats: IndexStats, *, rewrite_all: bool) -> None: existing = { path: (rid, sha, cov) for rid, path, sha, cov in self.db.execute( select(Resource.id, Resource.identifier, Resource.content_sha, Resource.coverage).where( Resource.repository_id == repo_id ) ) } wanted: dict[str, TreeEntry] = {} for entry in checkout.list_files(): stats.files_tracked += 1 reason = self._skip_reason(entry) if reason: stats.skipped[reason] += 1 continue if len(wanted) >= self.max_files: stats.skipped["max_files_exceeded"] += 1 continue wanted[entry.path] = entry deleted = [existing[p][0] for p in existing if p not in wanted] changed: list[TreeEntry] = [] unchanged: list[tuple[str, str]] = [] # (resource_id, old_commit) for path, entry in wanted.items(): prev = existing.get(path) if prev is None or rewrite_all or prev[1] != entry.blob_sha: changed.append(entry) else: unchanged.append((prev[0], prev[2])) if deleted: self._delete_resources(deleted) stats.files_deleted = len(deleted) self.db.commit() self._repoint_unchanged(repo_id, unchanged, checkout.commit) stats.files_unchanged = len(unchanged) self.db.commit() for i in range(0, len(changed), FILE_BATCH): self._index_batch(repo_id, ref, checkout, changed[i : i + FILE_BATCH], existing, stats) self.db.commit() self.heartbeat()What the index recorded
- Signature
def _sync(self, repo_id, ref: RepoRef, checkout: Checkout, stats: IndexStats, *, rewrite_all: bool) -> None:- File
backend/app/codeintel/indexer.py- Lines
- 245–289
- Parser
- python-ast
- Git blob
e8fdfa7b5545e821f7649d68cfadd2aae85b89d0- Call sites
- 15 named, 9 resolved, 6 left unlinked
- Outside this subset
- 3 more edges reach code outside the graph shown here
