Pass over src/*.rs, webapp/src/**, and the in-app "?" docs prose: condensed multi-paragraph doc comments to single lines that state the non-obvious why, deleted comments that only restated adjacent code, and tightened the Docs.tsx help-panel wording. No logic, structure, or code formatting changed — verified via cargo test (143 passed) and tsc -b && vite build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
40 lines
1.5 KiB
Rust
40 lines
1.5 KiB
Rust
use crate::metric_primitive::MetricPrimitive;
|
|
use crate::timestamp::Timestamp;
|
|
use serde::Serialize;
|
|
use std::collections::BTreeMap;
|
|
|
|
/// Key type for the engine's primary index. Variant order matters: derived `Ord` compares the discriminant first, carving the map into contiguous ranges in declaration order (logs, params, metric declarations, buckets).
|
|
#[allow(dead_code)]
|
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
|
|
pub enum IndexKey {
|
|
/// Marker for the start of the whole range. Never inserted, only navigated to.
|
|
Start,
|
|
IngestedLog {
|
|
sequence: u64,
|
|
timestamp: Timestamp,
|
|
},
|
|
/// Marker between the log range and the param range.
|
|
LogParamSplit,
|
|
ParamDeclaration {
|
|
name: String,
|
|
},
|
|
/// Marker between the param range and the metric declaration range.
|
|
ParamMetricSplit,
|
|
MetricDeclaration {
|
|
name: String,
|
|
},
|
|
/// Marker between metric declarations and their buckets.
|
|
MetricBucketSplit,
|
|
Bucket {
|
|
metric_name: String,
|
|
labels: BTreeMap<String, MetricPrimitive>,
|
|
},
|
|
/// Internal bookkeeping tracking the last event timestamp per metric+label, so a `Duration` param's first occurrence (which pushes no `Bucket`) still lets the next occurrence compute elapsed time.
|
|
LastMetricEvent {
|
|
metric_name: String,
|
|
labels: BTreeMap<String, MetricPrimitive>,
|
|
},
|
|
/// Marker for the end of the whole range. Nothing sorts after this.
|
|
End,
|
|
}
|