icydb_core/db/query/trace.rs
1//! Module: query::trace
2//! Responsibility: compact semantic-reuse attribution for query diagnostics.
3//! Does not own: query semantics, plan hashing primitives, or executor routing policy.
4//! Boundary: read-only reuse signal assembled at query/session boundaries.
5
6///
7/// TraceReuseEvent
8///
9/// Trace-surface semantic reuse result for one query planning attempt.
10/// Reuse always refers to the shared prepared query plan, so the event owns
11/// only the exact-match hit or miss outcome.
12///
13#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14pub enum TraceReuseEvent {
15 /// The shared prepared query plan matched the current semantic identity.
16 Hit,
17 /// No shared prepared query plan matched the current semantic identity.
18 Miss,
19}
20
21impl TraceReuseEvent {
22 /// Return true when this event represents a semantic-reuse hit.
23 #[must_use]
24 pub const fn is_hit(self) -> bool {
25 matches!(self, Self::Hit)
26 }
27}