relate-executor 1.5.0

In-memory graph and Cypher physical executor
Documentation
//! The frontier NFA and BFS traversal engine (ADR-0478).

#[allow(clippy::module_inception)]
pub(crate) mod frontier;
#[cfg(test)]
mod frontier_tests;

pub(crate) mod frontier_tables;
#[cfg(test)]
mod frontier_tables_tests;

pub(crate) mod frontier_cost;
#[cfg(test)]
mod frontier_cost_tests;

pub(crate) mod frontier_match;
#[cfg(test)]
mod frontier_match_tests;

pub(crate) mod frontier_emit;
#[cfg(test)]
mod frontier_emit_tests;

#[cfg(test)]
mod frontier_charge_tests;

#[cfg(test)]
pub(crate) mod frontier_rider_tests;
pub(crate) mod frontier_run;

pub(crate) mod frontier_count;
#[cfg(test)]
mod frontier_count_tests;

#[cfg(test)]
mod frontier_differential_tests;

#[cfg(test)]
mod frontier_pair_tests;

#[cfg(test)]
mod frontier_short_cap_tests;

#[cfg(test)]
mod frontier_decline_tests;

pub(crate) mod guard_memo;

pub(crate) mod nfa;
#[cfg(test)]
mod nfa_tests;

pub(crate) mod rearival;
#[cfg(test)]
mod rearival_tests;

#[cfg(test)]
use std::cell::Cell;

#[cfg(test)]
thread_local! {
    /// Test hook: stand the frontier family down (the GPM DFS), so a
    /// differential test can run the very same statement both ways.
    pub(crate) static FRONTIER_DISABLED: Cell<bool> = const { Cell::new(false) };
    /// Test hook: shrink the frontier family's per-run
    /// table-allocation ceiling.
    pub(crate) static FRONTIER_TABLE_BUDGET_OVERRIDE: Cell<Option<u64>> = const { Cell::new(None) };
    /// Test hook: shrink the capped emission's deferred-pass rule work budget.
    pub(crate) static REARRIVAL_DEFERRED_BUDGET_OVERRIDE: Cell<Option<u64>> = const { Cell::new(None) };
}

#[cfg(test)]
pub(crate) fn frontier_disabled() -> bool {
    FRONTIER_DISABLED.with(Cell::get)
}

pub(crate) fn frontier_stood_down(graph: &crate::graph::Graph) -> bool {
    #[cfg(test)]
    return crate::exec::kernels::kernels_stood_down(graph) || frontier_disabled();
    #[cfg(not(test))]
    crate::exec::kernels::kernels_stood_down(graph)
}

#[cfg(test)]
pub(crate) fn frontier_table_budget_override() -> Option<u64> {
    FRONTIER_TABLE_BUDGET_OVERRIDE.with(Cell::get)
}

#[cfg(test)]
pub(crate) fn with_frontier_table_budget<R>(bytes: u64, f: impl FnOnce() -> R) -> R {
    crate::exec::test_support::with_override(&FRONTIER_TABLE_BUDGET_OVERRIDE, bytes, f)
}

#[cfg(test)]
pub(crate) fn rearival_deferred_budget_override() -> Option<u64> {
    REARRIVAL_DEFERRED_BUDGET_OVERRIDE.with(Cell::get)
}

#[cfg(test)]
pub(crate) fn with_rearival_deferred_budget<R>(work: u64, f: impl FnOnce() -> R) -> R {
    crate::exec::test_support::with_override(&REARRIVAL_DEFERRED_BUDGET_OVERRIDE, work, f)
}

#[cfg(test)]
pub(crate) fn with_frontier_disabled<R>(f: impl FnOnce() -> R) -> R {
    crate::exec::test_support::with_flag_disabled(&FRONTIER_DISABLED, f)
}