Skip to main content

Module incremental_cache

Module incremental_cache 

Source
Expand description

Incremental fact cache for the ICB server.

§Purpose

Avoid re‑parsing source files that have not changed since the previous analysis. The first run extracts facts from every file and saves them into a cache directory together with a SHA‑256 hash of the file content. On subsequent runs the hash is compared; if it matches, the facts are loaded directly from the cache, skipping the parser entirely.

§Cache layout

Given a cache directory (e.g. .icb_cache) and a file modules/api/src/admin_controller.cpp, two files are created:

.icb_cache/
  modules_api_src_admin_controller_cpp.facts.bincode
  modules_api_src_admin_controller_cpp.hash

The sanitised name replaces every / and \ with _.

§Safety

The hash is computed with SHA‑256, making accidental collisions practically impossible. The facts are serialised with bincode, which is fast and produces a compact binary representation.

Structs§

FileFacts
Stores facts for a single file, along with the relative path.
IncrementalCache
Manages the cache directory and provides the core process_file method.

Type Aliases§

ParseFn
A boxed closure that takes a source string and returns parsed facts.