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

Method merge

atomic-core/src/change/format_v3/hash_table.rs:666–671  ·  view source on GitHub ↗

Merge another set of hashes into this table. This is useful during parallel recording where each thread collects referenced hashes independently, then the main thread merges them into a single table. Hashes that already exist in the table are skipped (idempotent). # Arguments `hashes` - Iterator of hashes to add. # Errors - [`FormatError::HashTableFull`] if merging would exceed capacity. #

(&mut self, hashes: impl Iterator<Item = [u8; 32]>)

Source from the content-addressed store, hash-verified

664 /// assert_eq!(table.len(), 3); // self + 2 new (dup skipped)
665 /// ```
666 pub fn merge(&mut self, hashes: impl Iterator<Item = [u8; 32]>) -> FormatResult<()> {
667 for hash in hashes {
668 self.insert(hash)?;
669 }
670 Ok(())
671 }
672
673 /// Return statistics about the table for debugging and logging.
674 ///

Callers 3

test_merge_new_hashesFunction · 0.45

Calls 1

insertMethod · 0.45

Tested by 3

test_merge_new_hashesFunction · 0.36