#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KernelRungWire {
Chain { hops: i64 },
HubStar,
FrontierNfa,
Walker,
}
impl KernelRungWire {
pub const CHAIN: &'static str = "chain";
pub const HUB_STAR: &'static str = "hub-star";
pub const FRONTIER_NFA: &'static str = "frontier-nfa";
pub const WALKER: &'static str = "walker";
pub const NAMES: [&'static str; 4] = [
Self::CHAIN,
Self::HUB_STAR,
Self::FRONTIER_NFA,
Self::WALKER,
];
pub const fn as_str(self) -> &'static str {
match self {
KernelRungWire::Chain { .. } => Self::CHAIN,
KernelRungWire::HubStar => Self::HUB_STAR,
KernelRungWire::FrontierNfa => Self::FRONTIER_NFA,
KernelRungWire::Walker => Self::WALKER,
}
}
pub const fn hops(self) -> Option<i64> {
match self {
KernelRungWire::Chain { hops } => Some(hops),
KernelRungWire::HubStar | KernelRungWire::FrontierNfa | KernelRungWire::Walker => None,
}
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanMetricsWire {
pub rows: i64,
pub time_ns: i64,
pub db_hits: i64,
pub memory_bytes: i64,
pub expression_built_bytes: i64,
pub reads: PlanReadsWire,
pub phases: PlanPhasesWire,
pub start: Option<PlanStartWire>,
pub kernel: Option<KernelRungWire>,
pub batched: bool,
pub zone_skips: i64,
pub frontier: PlanFrontierWire,
pub frontier_decline: Option<&'static str>,
pub memo: Option<super::plan_memo::PlanMemoWire>,
pub intx: PlanInTxWire,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanFrontierWire {
pub edge_visits: i64,
pub levels: i64,
pub endpoints: i64,
pub cells: i64,
pub memo_hits: i64,
pub memo_misses: i64,
pub representative_proofs: i64,
pub search_proven: i64,
pub search_disproven: i64,
pub declined_exhausted: i64,
pub budget_fraction: f64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PlanInTxWire {
pub batches: i64,
pub committed: i64,
pub rolled_back: i64,
pub peak_input_rows_bytes: i64,
pub peak_output_rows_bytes: i64,
pub peak_scratch_bytes: i64,
pub peak_wal_bytes: i64,
}
impl PlanInTxWire {
pub fn ran(&self) -> bool {
self.batches > 0
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PlanProfiledFacts {
pub metrics: PlanMetricsWire,
pub total_time_ns: i64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanReadsWire {
pub hops: i64,
pub neighbor_walks: i64,
pub node_reads: i64,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct PlanPhasesWire {
pub seek_ns: i64,
pub walk_ns: i64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PlanStartWire {
pub element: i64,
pub backward: bool,
pub reason: &'static str,
}