#[cfg(any(test, feature = "diagnostics"))]
#[derive(Clone, Copy)]
pub(in crate::db) struct ProjectionMaterializationMetricsRecorder {
slot_rows_path_hit: fn(),
data_rows_path_hit: fn(),
data_rows_scalar_fallback_hit: fn(),
data_rows_slot_access: fn(bool),
distinct_candidate_row: fn(),
distinct_bounded_stop: fn(),
}
#[cfg(any(test, feature = "diagnostics"))]
impl ProjectionMaterializationMetricsRecorder {
pub(in crate::db) const fn new(
slot_rows_path_hit: fn(),
data_rows_path_hit: fn(),
data_rows_scalar_fallback_hit: fn(),
data_rows_slot_access: fn(bool),
distinct_candidate_row: fn(),
distinct_bounded_stop: fn(),
) -> Self {
Self {
slot_rows_path_hit,
data_rows_path_hit,
data_rows_scalar_fallback_hit,
data_rows_slot_access,
distinct_candidate_row,
distinct_bounded_stop,
}
}
pub(super) fn record_slot_rows_path_hit(self) {
(self.slot_rows_path_hit)();
}
pub(super) fn record_data_rows_path_hit(self) {
(self.data_rows_path_hit)();
}
pub(super) fn record_data_rows_scalar_fallback_hit(self) {
(self.data_rows_scalar_fallback_hit)();
}
pub(super) fn record_data_rows_slot_access(self, projected_slot: bool) {
(self.data_rows_slot_access)(projected_slot);
}
pub(super) fn record_distinct_candidate_row(self) {
(self.distinct_candidate_row)();
}
pub(super) fn record_distinct_bounded_stop(self) {
(self.distinct_bounded_stop)();
}
}
#[cfg(not(any(test, feature = "diagnostics")))]
#[derive(Clone, Copy)]
pub(in crate::db) struct ProjectionMaterializationMetricsRecorder;
#[cfg(not(any(test, feature = "diagnostics")))]
impl ProjectionMaterializationMetricsRecorder {
pub(in crate::db) const fn new() -> Self {
Self
}
pub(super) const fn record_slot_rows_path_hit(self) {
let _ = self;
}
pub(super) const fn record_data_rows_path_hit(self) {
let _ = self;
}
pub(super) const fn record_data_rows_scalar_fallback_hit(self) {
let _ = self;
}
pub(super) const fn record_data_rows_slot_access(self, projected_slot: bool) {
let _ = (self, projected_slot);
}
pub(super) const fn record_distinct_candidate_row(self) {
let _ = self;
}
pub(super) const fn record_distinct_bounded_stop(self) {
let _ = self;
}
}