Scry.Scanner (scry v0.1.22)

Copy Markdown View Source

Beam discovery and change detection for the compiler driver.

scan/1 globs the project's ebin (and dependency ebins when include_deps is set) into a module => beam_path map, applying module-level ignores at discovery so ignored modules are never even extracted.

sync/3 diffs the scan against the previous run's source metadata and updates the roux inputs: an mtime+size match skips the file without reading it (mix-grade staleness, same trade as the Elixir compiler); anything else is read and content-hashed, and Input.set's equality cutoff absorbs recompiled-but-identical beams. Modules whose beams are gone are GC'd out of the input space.

Summary

Types

Per-beam manifest metadata: the mtime+size prefilter plus a content hash.

The result of syncing a scan into the database.

Functions

Discovers the beams to analyze: module => beam_path.

Syncs a scan into the database inputs, diffing against the prior run's source metadata (the manifest's sources map). Returns the fresh metadata to persist, plus which modules changed or disappeared.

Types

meta()

@type meta() :: %{mtime: integer(), size: non_neg_integer(), hash: binary()}

Per-beam manifest metadata: the mtime+size prefilter plus a content hash.

sync_result()

@type sync_result() :: %{
  sources: %{optional(String.t()) => meta()},
  changed: [module()],
  removed: [module()]
}

The result of syncing a scan into the database.

Functions

scan(config)

@spec scan(Scry.Config.t()) :: %{optional(module()) => String.t()}

Discovers the beams to analyze: module => beam_path.

sync(db, discovered, prior_sources)

@spec sync(Roux.Database.t(), %{optional(module()) => String.t()}, %{
  optional(String.t()) => meta()
}) ::
  sync_result()

Syncs a scan into the database inputs, diffing against the prior run's source metadata (the manifest's sources map). Returns the fresh metadata to persist, plus which modules changed or disappeared.