Documentation
¶
Overview ¶
Package snapshot exports and imports the codegrapher index as INGR files.
Layout inside the output directory (default: codegraph/):
.ingitdb.yaml root inGitDB config README.md generated summary nodes/nodes.ingr node records edges/edges.ingr edge records files/files.ingr file records project_metadata/project_metadata.ingr metadata records
The directory is a valid inGitDB database (`ingitdb validate` exits 0). Records are sorted by primary key for byte-determinism. Volatile fields (updated_at, indexed_at, modified_at) are excluded. Two exports of the same code tree are byte-identical.
Uses github.com/ingr-io/ingr-go (official MIT library, pure Go).
Index ¶
- Constants
- func CompressGzip(data []byte) ([]byte, error)
- func CompressZstd(data []byte) ([]byte, error)
- func Export(dbPath, outDir, projectRoot string) error
- func ExportScoped(stores map[scope.Scope]*store.Store, baseOutDir, ref string) (Manifest, []RecordsetSize, error)
- func Import(dbPath, inDir string) error
- type Counts
- type Manifest
- type ManifestScope
- type RecordsetSize
Constants ¶
const DefaultSnapshotDir = "codegraph"
DefaultSnapshotDir is the default output/input directory for snapshots, relative to the project root (the path passed to export/import).
Variables ¶
This section is empty.
Functions ¶
func CompressGzip ¶
CompressGzip returns the deterministic gzip encoding of data. The gzip header carries no name and a zero mtime, so re-compressing identical input yields identical bytes.
func CompressZstd ¶
CompressZstd returns the zstd encoding of data at the default level. zstd is deterministic for a fixed input and level.
func Export ¶
Export writes INGR snapshot files for the index to outDir, structured as a valid inGitDB database. projectRoot is used to detect the git remote for the README; pass "" to fall back to the outDir parent name. outDir is created if it does not exist.
func ExportScoped ¶
func ExportScoped(stores map[scope.Scope]*store.Store, baseOutDir, ref string) (Manifest, []RecordsetSize, error)
ExportScoped writes each scope's graph under baseOutDir/{lang}/{version}/ as compressed-only INGR recordsets (*.ingr.zst + *.ingr.gz, no plain .ingr) and writes baseOutDir/manifest.json describing ref. It returns the manifest and a per-recordset size report.
Types ¶
type Counts ¶
type Counts struct {
Nodes int `json:"nodes"`
Files int `json:"files"`
Edges int `json:"edges"`
Coverage int `json:"coverage,omitempty"`
NodeCoverage int `json:"node_coverage,omitempty"`
}
Counts are the row counts of a scope, used for tree labels and progress.
type Manifest ¶
type Manifest struct {
Ref string `json:"ref"`
Scopes []ManifestScope `json:"scopes"`
}
Manifest describes the scopes available for one ref of a repo. It is written as codegraph/manifest.json and served by the DB server / read by the viewer.