Skip to documentation
SLOP

tiny.smg.scan

Reference tiny.smg scan

Defined in tiny.smg.

API (27)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

No direct callersNo direct callstiny.smgscan
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: tools/smg/src/scan/pipeline/scan.zig:48

zig
pub const CachedProject = struct {    stats: Stats,    hits: usize,    misses: usize,    tombstones: usize,    timing: CachedProjectTiming,};

Source: tools/smg/src/scan/pipeline/scan.zig:56

zig
pub const CachedProjectTiming = struct {    manifest_ns: u64 = 0,    fragment_read_ns: u64 = 0,    fragment_validation_ns: u64 = 0,    fragment_fold_ns: u64 = 0,    fragment_scan_ns: u64 = 0,    suffix_index_ns: u64 = 0,    resolution_ns: u64 = 0,    call_metrics_ns: u64 = 0,    manifest_write_ns: u64 = 0,};

Source: tools/smg/src/scan/pipeline/scan.zig:43

zig
pub const Preparation = struct {    plan: reconcile.Plan,    nodes_removed: usize,};

Source: tools/smg/src/scan/pipeline/scan.zig:806

zig
pub fn clonePreparation(allocator: std.mem.Allocator, preparation: Preparation) !Preparation {    return .{        .plan = try reconcile.clonePlan(allocator, preparation.plan),        .nodes_removed = preparation.nodes_removed,    };}
Called byCallsNo direct callstest; no linktools.smg.src.scan.testtest: scan generation projection surv...scanclonePreparation
Static calls · unresolved targets: 0 · external targets: 1.

Source: tools/smg/src/scan/pipeline/scan.zig:785

zig
pub fn preparePathsWithOptions(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, paths: []const []const u8, clean: bool, options: Options) !Preparation {    var stats = Stats{};    var project_options = options;    project_options.excludes = try scan_files.projectExcludes(        allocator,        root,        options.excludes,        options.limits.scan,    );    const plan = try reconcile.prepare(        allocator,        graph,        root,        paths,        clean,        project_options,        &stats,    );    return .{ .plan = plan, .nodes_removed = stats.nodes_removed };}
Called byCallsNo direct callsscanscanPathsWithOptionsscanpreparePathsWithOptions
Static calls · unresolved targets: 0 · external targets: 2.

Source: tools/smg/src/scan/pipeline/scan.zig:762

zig
pub fn scanPaths(    allocator: std.mem.Allocator,    graph: *graph_mod.Graph,    root: []const u8,    paths: []const []const u8,    clean: bool,    limits: smg.Limits,) !Stats {    return try scanPathsWithOptions(        allocator,        graph,        root,        paths,        clean,        .{ .limits = limits },    );}
Called byCallstest; no linktools.smg.src.testtest: persisted clean rescan preserve...test; no linktools.smg.src.testtest: persisted ordinary scan retires...scanscanPathsWithOptionsscanscanPaths
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/scan/pipeline/scan.zig:780

zig
pub fn scanPathsWithOptions(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, paths: []const []const u8, clean: bool, options: Options) !Stats {    const preparation = try preparePathsWithOptions(allocator, graph, root, paths, clean, options);    return try scanPrepared(allocator, graph, root, preparation, options);}
Called byCallsdiffloadGraphFromGitscanscanPathswatchrescanscanpreparePathsWithOptionsscanscanPreparedscanscanPathsWithOptions
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/scan/pipeline/scan.zig:813

zig
pub fn scanPrepared(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, preparation: Preparation, options: Options) !Stats {    var stats = Stats.init(options.phases orelse allocator);    stats.nodes_removed = preparation.nodes_removed;    defer stats.retireDeferred();    defer stats.retireMetricInputs();    var phase_arena = std.heap.ArenaAllocator.init(options.phases orelse allocator);    defer phase_arena.deinit();    for (preparation.plan.files) |file| {        _ = phase_arena.reset(.retain_capacity);        const scratch = phase_arena.allocator();        const path = try std.fs.path.join(scratch, &.{ root, file });        const source = text.readFileZ(            scratch,            path,            options.limits.scan.max_source_file_bytes,        ) catch |err| switch (err) {            error.StreamTooLong => return error.MaxSourceFileBytesExceeded,            else => continue,        };        try scanFile(            allocator,            scratch,            graph,            root,            path,            source,            &stats,            options.limits,        );    }    _ = phase_arena.reset(.free_all);    try reconcile.finish(allocator, graph, preparation.plan, &stats);    try graph_mod.buildSuffixIndex(graph);    try resolveDeferredEdges(        allocator,        options.phases orelse allocator,        graph,        &stats,    );    _ = phase_arena.reset(.retain_capacity);    try updateCallMetrics(        allocator,        phase_arena.allocator(),        graph,        preparation.plan.files,        stats.resolution_failures.items,    );    stats.retireDeferred();    stats.retireMetricInputs();    return stats;}
Called byCallsscanscanPathsWithOptionsscan.Statsinitscan.StatsretireDeferredscan.StatsretireMetricInputsscan.scan_metricsupdateCallMetricsprivate; no linktools.smg.src.scan.pipeline.scanresolveDeferredEdgesprivate; no linktools.smg.src.scan.pipeline.scanscanFilescanscanPrepared
Static calls · unresolved targets: 0 · external targets: 6.

Source: tools/smg/src/scan/pipeline/scan.zig:872

zig
pub fn scanProjectCached(    allocator: std.mem.Allocator,    phases: std.mem.Allocator,    graph: *graph_mod.Graph,    root: []const u8,    state: scan_files.ProjectState,    executable: scan_files.SourceDigest,    limits: smg.Limits,) !CachedProject {    var timing: CachedProjectTiming = .{};    var phase_started = sys.time.nanoTimestamp();    var stats = Stats.init(phases);    defer stats.retireDeferred();    defer stats.retireMetricInputs();    var manifest = try fragment.loadManifest(        allocator,        phases,        root,        executable,        limits.scan,    );    timing.manifest_ns = elapsedNanoseconds(&phase_started);    defer manifest.deinit();    var scratch_arena = std.heap.ArenaAllocator.init(phases);    defer scratch_arena.deinit();    var scan_arena = std.heap.ArenaAllocator.init(phases);    defer scan_arena.deinit();    var hits: usize = 0;    var misses: usize = 0;    var stable = true;    for (state.sources) |source| {        const result = try scanProjectSource(            allocator,            &scratch_arena,            &scan_arena,            graph,            &stats,            &manifest,            root,            executable,            source,            &timing,            limits,        );        switch (result) {            .hit => hits += 1,            .miss => misses += 1,            .changed => {                misses += 1;                stable = false;            },            .unavailable => stable = false,        }    }    try finishCachedProject(        allocator,        phases,        graph,        state.sources,        &stats,        &timing,    );    _ = scratch_arena.reset(.free_all);    phase_started = sys.time.nanoTimestamp();    const tombstones = if (stable)        fragment.writeManifest(            allocator,            scratch_arena.allocator(),            root,            executable,            state.project,            &manifest,            state.sources,            limits.scan,        ) catch 0    else        0;    timing.manifest_write_ns = elapsedNanoseconds(&phase_started);    return .{        .stats = stats,        .hits = hits,        .misses = misses,        .tombstones = tombstones,        .timing = timing,    };}
Called byCallsNo direct callersscan.Statsinitscan.StatsretireDeferredscan.StatsretireMetricInputsscan.fragmentloadManifestscan.fragmentwriteManifest+3 morescanscanProjectCached
Static calls · unresolved targets: 0 · external targets: 5.

Source: tools/smg/src/root.zig:30

zig
pub const scan = @import("scan/root.zig");

Source: tools/smg/src/scan/root.zig

zig
const pipeline = @import("pipeline/root.zig");pub const core = @import("core/root.zig");pub const scan_files = @import("files.zig");pub const fragment = @import("fragment.zig");pub const scan_metrics = @import("metrics.zig");pub const chiclet = @import("chiclet.zig");pub const clike = @import("clike.zig");pub const python = @import("python.zig");pub const reconcile = @import("reconcile/root.zig");pub const script = @import("script.zig");pub const source_metadata = @import("source.zig");pub const Stats = pipeline.Stats;pub const Count = pipeline.Count;pub const SkippedEdgeSample = pipeline.SkippedEdgeSample;pub const OrphanedManualEdge = pipeline.OrphanedManualEdge;pub const ResolutionBucket = pipeline.ResolutionBucket;pub const ResolutionFailure = pipeline.ResolutionFailure;pub const Options = pipeline.Options;pub const Preparation = pipeline.Preparation;pub const scanPaths = pipeline.scanPaths;pub const scanPathsWithOptions = pipeline.scanPathsWithOptions;pub const preparePathsWithOptions = pipeline.preparePathsWithOptions;pub const clonePreparation = pipeline.clonePreparation;pub const scanPrepared = pipeline.scanPrepared;pub const scanProjectCached = pipeline.scanProjectCached;pub const CachedProject = pipeline.CachedProject;pub const CachedProjectTiming = pipeline.CachedProjectTiming;pub const CallMetricsIndex = @import("metrics.zig").CallMetricsIndex;

Complete call list for scan.scanProjectCached

8 direct calls.

Audit

Definitions10
Public names10
Members16
Version26.7.0
Revisiondaab053ee433