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 bigram_prefilter_status(&self) -> BigramPrefilterStatus

Build-time Layer-0.5 bigram-prefilter density and health.

This performs one 1024-word population-count pass on explicit status requests. It is never called from the per-chunk scan path.

Source

pub fn bigram_prefilter_corpus_status<'a, I>( &self, corpus_name: &'a str, inputs: I, ) -> BigramPrefilterCorpusStatus<'a>
where I: IntoIterator<Item = &'a [u8]>,

Measure Layer-0.5 rejection over one explicitly named diagnostic corpus.

Inputs are borrowed and walked without collection. Saturated or invalid filters are fail-open and therefore report zero rejected inputs.

Source

pub fn gpu_degrade_count(&self) -> u64

Cumulative count of scanner-local GPU region-dispatch failures.

Per-request GPU MoE recovery is returned on CoalescedScanOutcome; it is deliberately excluded here so concurrent scanners cannot affect another request’s correctness decision.

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) -> Result<Vec<RawMatch>>

Scan a chunk on the deterministic portable backend.

Runtime failures return ScanError and never terminate the host.

Source

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

Scan a chunk using exactly the caller-selected backend.

Backend initialization and runtime dispatch failures return ScanError; this library boundary never terminates the embedding process or invents a clean empty scan for a failed backend.

Source

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

Scan one chunk with optional reusable admission evidence.

The outcome retains an exact recovery receipt when mismatched admission evidence is discarded and recomputed by the shared coalesced boundary. Backend failures return ScanError without terminating the host.

Source

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

Scan multiple chunks using exactly the caller-selected backend.

Backend initialization and runtime dispatch failures return ScanError; successful results preserve one output row per input chunk.

Source

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

Scan multiple chunks with the bigram gate explicitly bypassed.

This diagnostic-only oracle preserves the alphabet screen, selected backend, and all downstream matching. Comparing its result with Self::scan_chunks_with_backend proves whether bigram rejection changed any finding identity or location.

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 exact per-chunk evidence for autoroute and the next production scan. Reuse avoids duplicate gates; malformed or mismatched identity is recomputed with an exact recovery receipt.

Source

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

Build admission evidence with only the bigram gate bypassed.

This is a diagnostic oracle for corpus differential benchmarks. The alphabet screen and every downstream matcher remain unchanged, so an enabled-versus-bypassed comparison isolates whether the bigram gate dropped a finding. Production scans must use Self::phase1_admission_plan.

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, ) -> Result<Vec<Vec<RawMatch>>>

High-throughput coalesced scan using exactly the selected backend.

Initialization and dispatch failures return ScanError; the library never terminates the host or substitutes a different backend.

Source

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

Coalesced scan using admission evidence computed by the autoroute key builder. This receipt-blind boundary fails closed when identity recovery is required; callers retaining recomputed findings use the recovery-aware outcome boundary.

Source

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

Coalesced scan with an explicit recall-equivalent execution route. Recovery metadata is never discarded; completed recovery requires the recovery-aware boundary that returns its receipt.

Source

pub fn 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>

Dispatch that returns an exact recovery receipt when untrusted admission evidence must be recomputed, and may recover exact failed GPU dispatch ranges when the caller owns a stable input snapshot.

Source

pub fn scan_coalesced(&self, chunks: &[Chunk]) -> Result<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