/** * Persistence for the graph centrality layer (`symbol_rank`, `file_rank`). * * Ranks are always written as a whole: the score is a property of the entire * graph, so a partial update would leave the table describing a graph that no * longer exists. Both writers therefore delete and re-insert rather than * upserting row by row — at ~66k symbols that is a single fast statement plus * a ladder-chunked bulk insert, well inside the index run's existing budget. */ import type { DatabaseSync } from 'node:sqlite'; import type { FileRankRow, SymbolRankRow } from './graph-rank.js'; type Statement = ReturnType; type PrepareStatement = (sql: string) => Statement; /** Replace the whole `symbol_rank` table with `rows`. */ export declare function replaceSymbolRanksWithStatement(stmt: PrepareStatement, maxSqlVars: number, rows: readonly SymbolRankRow[]): void; /** Replace the whole `file_rank` table with `rows`. */ export declare function replaceFileRanksWithStatement(stmt: PrepareStatement, maxSqlVars: number, rows: readonly FileRankRow[]): void; /** * Highest-ranked files, most central first. * * `limit` is applied in SQL — this is a plain single-table read, so none of * the chunked-query constraints that forbid `LIMIT` elsewhere apply here. */ export declare function getTopFileRanksWithStatement(stmt: PrepareStatement, limit: number): FileRankRow[]; /** A ranked file joined with the metadata the repo map needs to group it. */ export interface RankedFileRow extends FileRankRow { /** Code Atlas grouping label from `files.package` — '' when unlabelled. */ package: string; lang: string; symbolCount: number; } /** * Highest-ranked files with their package label, for repo-map clustering. * * Joined here rather than in two round trips because the repo map always * needs both, and `file_rank` is keyed by the same absolute path as `files`. */ export declare function getRankedFilesWithStatement(stmt: PrepareStatement, limit: number): RankedFileRow[]; /** * True indexed-file count per package label. * * The repo map only fetches its top few hundred ranked files, so counting * cluster membership from that slice would report "core has 154 files" for a * package with thousands. The count has to come from `files` itself. */ export declare function getPackageFileCountsWithStatement(stmt: PrepareStatement): Map; /** Highest-ranked symbols, most central first. */ export declare function getTopSymbolRanksWithStatement(stmt: PrepareStatement, limit: number): SymbolRankRow[]; /** * How many symbols declare each ambiguous symbol's name, keyed by symbol id. * * Counted per `(name, language family)` because that is exactly the scope ref * resolution matches within (`FAMILY_MATCH_SQL`) — a Go `Read` and a * TypeScript `Read` never compete for the same ref, so counting them together * would understate the confidence of both. * * Only names with more than one declaration are returned: on this repo that * is roughly a seventh of all names, so the map stays small and every absent * id means "unambiguous, full weight". */ export declare function getSymbolNameCandidatesWithStatement(stmt: PrepareStatement): Map; /** * File-to-file import edges, as `source file → set of imported files`. * * Built from the import refs the module resolver managed to resolve to a real * path (`refs.to_file`). Used by the rank pass to tell a cross-file reference * that is genuinely visible from one the resolver merely guessed at. */ export declare function getImportVisibilityWithStatement(stmt: PrepareStatement): Map>; /** Whole-table `file → rank` lookup, for joining ranks onto graph reads. */ export declare function getFileRankMapWithStatement(stmt: PrepareStatement): Map; /** Row counts, for index stats and for deciding whether the layer is populated. */ export declare function getRankCountsWithStatement(stmt: PrepareStatement): { symbols: number; files: number; }; export {}; //# sourceMappingURL=writer-rank.d.ts.map