MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / metric_source

Function metric_source

libatomic/src/review/analysis.rs:233–247  ·  view source on GitHub ↗
(bytes: Result<Option<Vec<u8>>, String>, remaining: &mut usize)

Source from the content-addressed store, hash-verified

231}
232
233fn metric_source(bytes: Result<Option<Vec<u8>>, String>, remaining: &mut usize) -> Source {
234 match bytes {
235 // The caller has already verified selected change membership in the
236 // source view. A successful None is recorded absence, not a failed read.
237 Ok(None) => Source::Absent,
238 Ok(Some(bytes))
239 if bytes.len() <= atomic_semantic::MAX_SOURCE_BYTES && bytes.len() <= *remaining =>
240 {
241 *remaining -= bytes.len();
242 Source::from_bytes(bytes)
243 }
244 Ok(Some(_)) => Source::Unavailable("Recorded metric source byte budget exceeded".into()),
245 Err(reason) => Source::Unavailable(reason),
246 }
247}
248
249fn checks(
250 report: &mut AnalysisReport,

Callers 1

analyze_changeFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected