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

Method canonicalize

atomic-core/src/operation/mod.rs:196–212  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

194
195impl OperationPayload {
196 fn canonicalize(&mut self) -> Result<(), OperationCodecError> {
197 self.parents.sort_unstable();
198 self.parents.dedup();
199 self.evidence.sort_unstable();
200 self.evidence.dedup();
201 self.git_observed
202 .sort_by(|left, right| left.name.cmp(&right.name));
203 reject_duplicate_git_ref_names(&self.git_observed)?;
204 for note in &mut self.lossy {
205 note.evidence.sort_unstable();
206 note.evidence.dedup();
207 }
208 self.lossy.sort_unstable();
209 self.lossy.dedup();
210 self.delta.canonicalize()?;
211 self.validate_canonical()
212 }
213
214 pub(crate) fn validate_canonical(&self) -> Result<(), OperationCodecError> {
215 ensure_strictly_sorted(&self.parents, "operation parents")?;

Calls 3

validate_canonicalMethod · 0.80
cmpMethod · 0.45