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

Method validate_v2

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

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

(&self)

Source from the content-addressed store, hash-verified

332
333 /// Validate canonical schema-version-2 facts and derived content hash.
334 pub fn validate_v2(&self) -> Result<(), ChangeError> {
335 self.hashed.validate_v2()?;
336 let computed = Hash::of(&self.contents);
337 if computed != self.hashed.contents_hash {
338 return Err(ChangeError::ContentsHashMismatch {
339 claimed: self.hashed.contents_hash.to_string(),
340 computed: computed.to_string(),
341 });
342 }
343 if let Some(span) = &self.hashed.span {
344 span.validate_content_ranges(self.contents.len() as u64)
345 .map_err(|error| ChangeError::Invalid(error.to_string()))?;
346 }
347 Ok(())
348 }
349
350 /// Get the change message.
351 pub fn message(&self) -> &str {

Callers 4

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