Skip to main content

CompiledScanner

Struct CompiledScanner 

Source
pub struct CompiledScanner {
    pub config: ScannerConfig,
    /* private fields */
}

Fields§

§config: ScannerConfig

Detector-indexed entropy identities declared by the active TOML corpus. This keeps every active generic owner on its own identity without a scanner-global class table or detector-ID branch. A missing entry is a compile-time corpus error and is never replaced with a guessed label.

Implementations§

Source§

impl CompiledScanner

Source

pub fn compile(detectors: Vec<DetectorSpec>) -> Result<Self>

Compile detector specs into a CompiledScanner using the process-wide runtime GPU policy and default tuning. The common entry point.

Source

pub fn compile_with_gpu_policy( detectors: Vec<DetectorSpec>, gpu_policy: GpuInitPolicy, ) -> Result<Self>

Compile with an explicit GpuInitPolicy (overriding the runtime policy) and default scanner tuning.

Source

pub fn compile_with_gpu_policy_and_tuning( detectors: Vec<DetectorSpec>, gpu_policy: GpuInitPolicy, tuning_config: &ScannerTuningConfig, ) -> Result<Self>

Full-control compile entry point: explicit GpuInitPolicy and scanner ScannerTuningConfig. The other compile* methods delegate here.

Source

pub fn with_config(self, config: ScannerConfig) -> Self

Apply a custom configuration to the compiled scanner.

Source

pub fn with_tuning_config(self, config: ScannerTuningConfig) -> Self

Apply explicit performance-route tuning to this compiled scanner.

Source§

impl CompiledScanner

Source

pub fn default_execution_route(&self) -> ScanExecutionRoute

Configured recall-equivalent route used when a caller does not provide workload-specific autoroute evidence.

Source

pub fn execution_route_for_backend( &self, backend: ScanBackend, ) -> ScanExecutionRoute

Source

pub fn prepare_autoroute_calibration_gpu_artifact(&self) -> Result<(), String>

Compile the immutable GPU literal and phase-2 programs once for an autoroute sweep and remember their measured one-time costs. Per-workload calibration retains those programs while composing their costs into every matching GPU one-shot observation.

Source

pub fn initialize_simd_backend(&self) -> Result<(), String>

Materialize the SIMD peer and preserve its exact initialization error.

Source

pub fn simd_initialization_ns(&self) -> Option<u128>

One-time Hyperscan materialization cost recorded by this scanner.

Source

pub fn reset_autoroute_calibration_gpu_workload(&self) -> Result<(), String>

Reset workload-shaped GPU state while retaining immutable literal and phase-2 programs whose measured preparation costs are composed into cold evidence.

Source

pub fn autoroute_calibration_gpu_shared_cold_ns(&self) -> u128

Source

pub fn autoroute_calibration_gpu_backend_cold_ns( &self, backend: ScanBackend, ) -> Option<u128>

Measured one-time phase-2 program preparation cost for an eligible GPU backend. None means the backend is not eligible or was not prepared.

Source

pub fn simd_backend_available(&self) -> bool

Whether this scanner has a backend-neutral SIMD candidate plan. This census does not materialize a Hyperscan database.

Source

pub fn simd_backend_initialized(&self) -> bool

Whether this process has successfully materialized the SIMD candidate.

Source

pub fn try_resolve_matches( &self, matches: Vec<RawMatch>, ) -> Result<Vec<RawMatch>, String>

Resolve overlapping findings with the exact detector corpus compiled into this scanner. Reporting service names never select execution or resolution semantics, and an unknown finding identity is an error.

Source

pub fn warm(&self)

Warm regex transition caches in parallel before scanning.

Detector regexes are already builder-validated and seeded during scanner construction (see [crate::types::LazyRegex]), so this is now mostly DFA/transition-cache first-touch work plus generated/plain fallback regexes. For a LONG-lived or LARGE scan - the daemon, watch, scan-system, or a big repo where a detector fires across thousands of files - paying that warmup once, in parallel, avoids stalling worker threads inside the first hot source batch. Callers on those paths should warm() after building the scanner.

Idempotent and cheap to repeat: an already-compiled pattern is a OnceLock hit. Also the correct setup for a per-scan perf benchmark, which means to measure match throughput, not one-time compilation.

Source

pub fn runtime_status(&self) -> CompiledScannerRuntime

Stable scanner runtime status for CLI reporting and autoroute cache invalidation. This is the public diagnostics boundary; raw corpus inspection helpers stay crate-private so tests do not grow a second production API around internal matcher layout.

Source

pub fn gpu_degrade_count(&self) -> u64

Cumulative count of runtime GPU dispatch failures and recall-floor faults/recoveries recorded by this scanner (via the private runtime-fault recorder). Cheap (one relaxed atomic load) so routing and calibration can reject poisoned GPU evidence without recomputing the digests in runtime_status().

Source

pub fn dump_profile_reports(&self, label: &str)

Dump and reset every scanner-owned profile stream collected under the unified explicit profile switch. This is the only public boundary the CLI needs; it prevents CLI/orchestrator code from growing its own env reads for individual profiler shards.

Source

pub fn reset_profile_reports(&self)

Source

pub fn gpu_backend_candidates(&self) -> Vec<GpuBackendCandidateStatus>

Every compiled GPU driver peer and its census and initialization state.

Source

pub fn acquired_gpu_peer_identity( &self, backend: ScanBackend, ) -> Result<String, String>

Materialize one GPU route and return the identity of the exact peer that will execute it. Autoroute persists this value with timing evidence.

Source

pub fn warm_backend(&self, backend: ScanBackend) -> bool

Warm backend resources that are initialized lazily during scanning.

Source

pub fn scan(&self, chunk: &Chunk) -> Vec<RawMatch>

Scan a chunk of text and return all raw credential matches.

Source

pub fn scan_with_backend( &self, chunk: &Chunk, backend: ScanBackend, ) -> Vec<RawMatch>

Scan a chunk using a caller-selected backend.

This infallible API treats backend selection as a process contract. It terminates with exit 3 when selected SIMD is unavailable or exit 12 when a selected GPU stack or runtime dispatch cannot be honored; it never returns findings produced by another backend.

Source

pub fn scan_with_backend_and_admission_plan( &self, chunk: &Chunk, backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, ) -> Vec<RawMatch>

Scan one chunk while reusing an autoroute admission plan when it was produced for this exact chunk. A mismatched plan is ignored and the normal admission probe runs, preserving recall for library callers.

Source

pub fn scan_chunks_with_backend( &self, chunks: &[Chunk], backend: ScanBackend, ) -> Vec<Vec<RawMatch>>

Scan multiple chunks using a caller-selected backend.

This infallible API has the same hard process contract as Self::scan_with_backend: unavailable SIMD exits 3, and unavailable or failed GPU execution exits 12 instead of substituting CPU/SIMD.

Source

pub fn clear_fragment_cache(&self)

Reset the cross-file fragment-reassembly cache.

Source§

impl CompiledScanner

Source

pub fn phase1_admission_summary( &self, chunks: &[Chunk], ) -> Phase1AdmissionSummary

Classify direct-literal phase-1 work with the exact compiled prefilters production scanning uses. Decode work is intentionally separate and is represented by the scanner’s decode workload plan.

Source

pub fn phase1_admission_plan(&self, chunks: &[Chunk]) -> Phase1AdmissionPlan

Build the exact per-chunk admission evidence used by autoroute and retain it for the immediately following production scan. Reusing this plan removes a duplicate alphabet/bigram pass on SIMD and CPU routes; the scan boundary rejects a plan for a different chunk slice and recomputes admissions instead of trusting stale evidence.

Source§

impl CompiledScanner

Source

pub fn decode_workload_plan(&self) -> DecodeWorkloadPlan

Capture the effective decode policy consumed by this scanner.

Source§

impl CompiledScanner

Source

pub fn scan_coalesced_with_backend( &self, chunks: &[Chunk], backend: ScanBackend, ) -> Vec<Vec<RawMatch>>

High-throughput coalesced scan: all files scanned in parallel, zero overhead for non-hit files.

Direct library backend selection is a hard process contract. CLI orchestrators that own stable input replay use the fallible companion method below and record any automatic-route recovery explicitly.

Source

pub fn scan_coalesced_with_backend_and_admission( &self, chunks: &[Chunk], backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, ) -> Vec<Vec<RawMatch>>

Coalesced scan using admission evidence computed by the autoroute key builder. A mismatched plan is ignored and the scanner recomputes its own exact admissions, preserving recall over the optimization.

Source

pub fn scan_coalesced_with_backend_admission_and_route( &self, chunks: &[Chunk], backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, route: ScanExecutionRoute, ) -> Vec<Vec<RawMatch>>

Coalesced scan with an explicit recall-equivalent execution route.

Source

pub fn try_scan_coalesced_with_backend_and_admission( &self, chunks: &[Chunk], backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, ) -> Result<Vec<Vec<RawMatch>>>

Fallible production dispatch boundary for callers that require the selected backend as a hard contract. Automatic orchestrators use the recovery-aware companion below with an explicitly stable snapshot.

Source

pub fn try_scan_coalesced_with_backend_admission_and_route( &self, chunks: &[Chunk], backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, route: ScanExecutionRoute, ) -> Result<Vec<Vec<RawMatch>>>

Fallible production dispatch with an immutable per-request execution route.

Source

pub fn try_scan_coalesced_with_backend_admission_route_and_recovery( &self, chunks: &[Chunk], backend: ScanBackend, plan: Option<&Phase1AdmissionPlan>, route: ScanExecutionRoute, recover_gpu_dispatch_faults: bool, ) -> Result<CoalescedScanOutcome>

Fallible dispatch that may recover exact failed GPU dispatch ranges when the caller owns a stable input snapshot and explicitly permits recovery.

Source

pub fn scan_coalesced(&self, chunks: &[Chunk]) -> Vec<Vec<RawMatch>>

Deterministic portable reference scan over several chunks.

Accelerated callers use Self::scan_coalesced_with_backend with an explicit measured backend. Keeping the no-backend API on CpuFallback makes library results independent of host hardware and calibration state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more