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

Method validate_v2

atomic-core/src/change/change.rs:324–338  ·  view source on GitHub ↗

Validate canonical schema-version-2 facts and derived content hash.

(&self)

Source from the content-addressed store, hash-verified

322
323 /// Validate canonical schema-version-2 facts and derived content hash.
324 pub fn validate_v2(&self) -> Result<(), ChangeError> {
325 self.hashed.validate_v2()?;
326 let computed = Hash::of(&self.contents);
327 if computed != self.hashed.contents_hash {
328 return Err(ChangeError::ContentsHashMismatch {
329 claimed: self.hashed.contents_hash.to_string(),
330 computed: computed.to_string(),
331 });
332 }
333 if let Some(span) = &self.hashed.span {
334 span.validate_content_ranges(self.contents.len() as u64)
335 .map_err(|error| ChangeError::Invalid(error.to_string()))?;
336 }
337 Ok(())
338 }
339
340 /// Get the change message.
341 pub fn message(&self) -> &str {

Callers 3

with_classificationMethod · 0.80
serializeMethod · 0.80
deserializeMethod · 0.80

Calls 13

git_parentsMethod · 0.80
is_snapshotMethod · 0.80
is_nativeMethod · 0.80
is_durableMethod · 0.80
lenMethod · 0.45
validateMethod · 0.45
iterMethod · 0.45
algorithmMethod · 0.45
as_bytesMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected