Incremental Updates
A warm graph is only useful if it stays current. The daemon folds changes into the existing graph rather than rebuilding from scratch — most of the time.
Fold-in vs. full rescan
edit a few files ──> incremental fold-in (~ a couple of seconds)
branch switch ──> one full rescan (collapses the batch)- Ordinary edits are folded into the graph incrementally, usually within a couple of seconds.
- A large batch — switching branches, say — collapses into a single full rescan instead of thousands of tiny updates. Rebuilding once is cheaper than folding in a whole tree's worth of changes.
Explicit updates
Without --watch, or to force a refresh, ask the daemon to update:
cgraph-client update '{"path":"."}'Persistence
Incremental state is re-persisted to cgraph-out/ in the background and on
shutdown, so the next start resumes from the current graph rather than a cold
build.
Building vs. empty
While the graph is under construction, queries return graph_state: "building",
so a caller can tell "not ready yet" apart from "genuinely no results".
The numbers behind this behavior are defaults in DaemonServerOptions in the
public source (daemon_server.hpp): the
watcher polls the tree every 2 seconds, a save burst on one file coalesces after
250ms of quiet, more than 256 pending file events collapse into one full rescan,
and incremental changes are re-persisted at most 30 seconds apart. For the full
walk-through, see
Fold-in vs full rescan.