pub struct CompiledScanner {
pub config: ScannerConfig,
/* private fields */
}Fields§
§config: ScannerConfigDetector-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
impl CompiledScanner
Sourcepub fn compile(detectors: Vec<DetectorSpec>) -> Result<Self>
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.
Sourcepub fn compile_with_gpu_policy(
detectors: Vec<DetectorSpec>,
gpu_policy: GpuInitPolicy,
) -> Result<Self>
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.
Sourcepub fn compile_with_gpu_policy_and_tuning(
detectors: Vec<DetectorSpec>,
gpu_policy: GpuInitPolicy,
tuning_config: &ScannerTuningConfig,
) -> Result<Self>
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.
Sourcepub fn with_config(self, config: ScannerConfig) -> Self
pub fn with_config(self, config: ScannerConfig) -> Self
Apply a custom configuration to the compiled scanner.
Sourcepub fn with_tuning_config(self, config: ScannerTuningConfig) -> Self
pub fn with_tuning_config(self, config: ScannerTuningConfig) -> Self
Apply explicit performance-route tuning to this compiled scanner.
Source§impl CompiledScanner
impl CompiledScanner
Sourcepub fn default_execution_route(&self) -> ScanExecutionRoute
pub fn default_execution_route(&self) -> ScanExecutionRoute
Configured recall-equivalent route used when a caller does not provide workload-specific autoroute evidence.
pub fn execution_route_for_backend( &self, backend: ScanBackend, ) -> ScanExecutionRoute
Sourcepub fn prepare_autoroute_calibration_gpu_artifact(&self) -> Result<(), String>
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.
Sourcepub fn initialize_simd_backend(&self) -> Result<(), String>
pub fn initialize_simd_backend(&self) -> Result<(), String>
Materialize the SIMD peer and preserve its exact initialization error.
Sourcepub fn simd_initialization_ns(&self) -> Option<u128>
pub fn simd_initialization_ns(&self) -> Option<u128>
One-time Hyperscan materialization cost recorded by this scanner.
Sourcepub fn reset_autoroute_calibration_gpu_workload(&self) -> Result<(), String>
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.
Sourcepub fn autoroute_calibration_gpu_backend_cold_ns(
&self,
backend: ScanBackend,
) -> Option<u128>
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.
Sourcepub fn simd_backend_available(&self) -> bool
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.
Sourcepub fn simd_backend_initialized(&self) -> bool
pub fn simd_backend_initialized(&self) -> bool
Whether this process has successfully materialized the SIMD candidate.
Sourcepub fn try_resolve_matches(
&self,
matches: Vec<RawMatch>,
) -> Result<Vec<RawMatch>, String>
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.
Sourcepub fn warm(&self)
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.
Sourcepub fn runtime_status(&self) -> CompiledScannerRuntime
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.
Sourcepub fn bigram_prefilter_status(&self) -> BigramPrefilterStatus
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.
Sourcepub fn bigram_prefilter_corpus_status<'a, I>(
&self,
corpus_name: &'a str,
inputs: I,
) -> BigramPrefilterCorpusStatus<'a>where
I: IntoIterator<Item = &'a [u8]>,
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.
Sourcepub fn gpu_degrade_count(&self) -> u64
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.
Sourcepub fn dump_profile_reports(&self, label: &str)
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.
pub fn reset_profile_reports(&self)
Sourcepub fn gpu_backend_candidates(&self) -> Vec<GpuBackendCandidateStatus>
pub fn gpu_backend_candidates(&self) -> Vec<GpuBackendCandidateStatus>
Every compiled GPU driver peer and its census and initialization state.
Sourcepub fn acquired_gpu_peer_identity(
&self,
backend: ScanBackend,
) -> Result<String, String>
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.
Sourcepub fn warm_backend(&self, backend: ScanBackend) -> bool
pub fn warm_backend(&self, backend: ScanBackend) -> bool
Warm backend resources that are initialized lazily during scanning.
Sourcepub fn scan(&self, chunk: &Chunk) -> Result<Vec<RawMatch>>
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.
Sourcepub fn scan_with_backend(
&self,
chunk: &Chunk,
backend: ScanBackend,
) -> Result<Vec<RawMatch>>
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.
Sourcepub fn scan_with_backend_and_admission_plan(
&self,
chunk: &Chunk,
backend: ScanBackend,
plan: Option<&Phase1AdmissionPlan>,
) -> Result<CoalescedScanOutcome>
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.
Sourcepub fn scan_chunks_with_backend(
&self,
chunks: &[Chunk],
backend: ScanBackend,
) -> Result<Vec<Vec<RawMatch>>>
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.
Sourcepub fn scan_chunks_with_backend_bypassing_bigram_for_diagnostics(
&self,
chunks: &[Chunk],
backend: ScanBackend,
) -> Result<Vec<Vec<RawMatch>>>
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.
Sourcepub fn clear_fragment_cache(&self)
pub fn clear_fragment_cache(&self)
Reset the cross-file fragment-reassembly cache.
Source§impl CompiledScanner
impl CompiledScanner
Sourcepub fn phase1_admission_summary(
&self,
chunks: &[Chunk],
) -> Phase1AdmissionSummary
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.
Sourcepub fn phase1_admission_plan(&self, chunks: &[Chunk]) -> Phase1AdmissionPlan
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.
Sourcepub fn phase1_admission_plan_bypassing_bigram_for_diagnostics(
&self,
chunks: &[Chunk],
) -> Phase1AdmissionPlan
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
impl CompiledScanner
Sourcepub fn decode_workload_plan(&self) -> DecodeWorkloadPlan
pub fn decode_workload_plan(&self) -> DecodeWorkloadPlan
Capture the effective decode policy consumed by this scanner.
Source§impl CompiledScanner
impl CompiledScanner
Sourcepub fn scan_coalesced_with_backend(
&self,
chunks: &[Chunk],
backend: ScanBackend,
) -> Result<Vec<Vec<RawMatch>>>
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.
Sourcepub fn scan_coalesced_with_backend_and_admission(
&self,
chunks: &[Chunk],
backend: ScanBackend,
plan: Option<&Phase1AdmissionPlan>,
) -> Result<Vec<Vec<RawMatch>>>
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.
Sourcepub fn scan_coalesced_with_backend_admission_and_route(
&self,
chunks: &[Chunk],
backend: ScanBackend,
plan: Option<&Phase1AdmissionPlan>,
route: ScanExecutionRoute,
) -> Result<Vec<Vec<RawMatch>>>
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.
Sourcepub 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>
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.
Sourcepub fn scan_coalesced(&self, chunks: &[Chunk]) -> Result<Vec<Vec<RawMatch>>>
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§
impl !Freeze for CompiledScanner
impl !RefUnwindSafe for CompiledScanner
impl !UnwindSafe for CompiledScanner
impl Send for CompiledScanner
impl Sync for CompiledScanner
impl Unpin for CompiledScanner
impl UnsafeUnpin for CompiledScanner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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