Documentation
¶
Overview ¶
Package cache persists per-file extraction results so `graphify update` can rebuild the graph after re-parsing only the files that changed. The expensive step is the tree-sitter parse; resolving and assembling the whole graph from cached per-file results is cheap, so caching the results (not just hashes) lets an incremental rebuild produce output byte-identical to a full build.
Index ¶
Constants ¶
const FileName = ".graphify_cache.json"
FileName is the cache file written under graphify-out alongside graph.json.
const StatFileName = ".graphify_stat.json"
StatFileName is the stat sidecar written alongside FileName. It lets an incremental run skip re-reading and re-hashing files whose size and mtime are unchanged — the same trade-off make(1) makes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type StatEntry ¶ added in v0.6.0
type StatEntry struct {
Size int64 `json:"size"`
MtimeNs int64 `json:"mtime_ns"`
Hash string `json:"hash"`
}
StatEntry records a file's size, modification time, and content hash so an unchanged file (matching size+mtime) can reuse its hash without being read.
func HashFile ¶ added in v0.6.0
func HashFile(absPath string, prev StatEntry, prevOK bool) (hash string, entry StatEntry, src []byte, ok bool)
HashFile returns the content hash of the file at absPath plus the StatEntry to persist for it, using a make(1)-style stat fastpath: when prev (the previous run's entry for this path, prevOK) matches the file's current size and mtime, its hash is reused and the file is not read; src is then nil. Otherwise the file is read and hashed, and src holds its bytes for the caller to parse. It is best-effort: a stat failure falls through to a full read. A read failure returns ok=false so the caller can skip the file.