MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / scan_logs

Method scan_logs

nodedb/src/engine/timeseries/query.rs:136–165  ·  view source on GitHub ↗

Scan all log entries for a series within a time range.

(
        &self,
        series_id: SeriesId,
        range: &TimeRange,
    )

Source from the content-addressed store, hash-verified

134
135 /// Scan all log entries for a series within a time range.
136 pub fn scan_logs(
137 &self,
138 series_id: SeriesId,
139 range: &TimeRange,
140 ) -> Result<Vec<nodedb_types::timeseries::LogEntry>, QueryError> {
141 let segments = self.segment_index.query(series_id, range);
142 if segments.is_empty() {
143 return Ok(Vec::new());
144 }
145
146 let mut all_entries = Vec::new();
147
148 for seg in &segments {
149 if seg.kind != SegmentKind::Log {
150 continue;
151 }
152
153 let path = self.l1_dir.join(&seg.path);
154 let data = reader::read_log_segment(&path, self.log_registry)?;
155
156 for entry in data.entries {
157 if range.contains(entry.timestamp_ms) {
158 all_entries.push(entry);
159 }
160 }
161 }
162
163 all_entries.sort_by_key(|e| e.timestamp_ms);
164 Ok(all_entries)
165 }
166}
167
168#[cfg(test)]

Callers

nothing calls this directly

Calls 6

read_log_segmentFunction · 0.85
joinMethod · 0.80
queryMethod · 0.45
is_emptyMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected