Skip to main content

Module depgraph

Module depgraph 

Source
Expand description

Page dependency graph for incremental rebuilds.

DepGraph tracks four things:

  1. Edges — consumer → set<dependency>. A page declares a dependency on every template, partial, and data file the compiler will read while rendering it. Edges are reflexive (a page depends on itself).
  2. Outputs — source → set<output>. The compiler may emit several artefacts per source (foo.md → public/foo/index.html, plus a sitemap entry, an RSS entry, an SBOM entry). The output set drives the AC5 delete sweep.
  3. Hashes — path → sha256. The freshness key. A source is “changed” iff its current SHA-256 differs from the cached value (or no cached value exists, i.e. it’s new).
  4. Schema version — bumped when the on-disk JSON layout changes. Loading a graph with a stale version triggers a poisoning-resistant fallback to a full rebuild (AC6).

Transitive edges are resolved on demand by DepGraph::invalidated via BFS over the reverse edge map. Persistence is atomic — the graph is written to .tmp then renamed (POSIX guarantee).

Structs§

DepGraph
Dependency graph mapping consumers to their dependencies.
Diff
Result of DepGraph::diff.

Constants§

CACHE_DIRNAME
Subdirectory of the cache root where the graph lives.
DEP_GRAPH_FILE
Filename used for the persisted graph under target/ssg-cache/. Issue #524 spec.

Functions§

current_hashes
Walks every tracked source on disk and returns path → sha256(content). Used by DepGraph::diff on the incremental hot path. Sources that disappear silently drop out.
populate
Reads every .md file under content_dir and every .html file under template_dir, recording: