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

Method from_records

atomic-repository/src/git_binding/pack.rs:379–395  ·  view source on GitHub ↗

Quarantine every record of a decoded pack, enforcing the object-count budget before decoding anything. The pack indexes changes by their decoded **identity** hash (see [`quarantine_change_record`]).

(
        records: &[ObjectRecord],
        limits: &BindingPackLimits,
    )

Source from the content-addressed store, hash-verified

377 /// budget before decoding anything. The pack indexes changes by their
378 /// decoded **identity** hash (see [`quarantine_change_record`]).
379 pub fn from_records(
380 records: &[ObjectRecord],
381 limits: &BindingPackLimits,
382 ) -> Result<Self, BindingPackError> {
383 if records.len() > limits.max_objects {
384 return Err(BindingPackError::TooManyObjects {
385 limit: limits.max_objects,
386 found: records.len(),
387 });
388 }
389 let mut changes = HashMap::with_capacity(records.len());
390 for record in records {
391 let (identity, change) = quarantine_change_record(record)?;
392 changes.insert(identity, change);
393 }
394 Ok(QuarantinedPack { changes })
395 }
396
397 /// The quarantined change for `hash`, if the pack carries it.
398 pub fn get(&self, hash: &Hash) -> Option<&Change> {

Callers

nothing calls this directly

Calls 3

quarantine_change_recordFunction · 0.85
lenMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected