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

Method fetch_changes

atomic-cli/src/commands/git/transport.rs:631–656  ·  view source on GitHub ↗
(&mut self, wanted: &[atomic_core::Hash])

Source from the content-addressed store, hash-verified

629
630impl BindingChangeSource for HttpBindingChangeSource {
631 fn fetch_changes(&mut self, wanted: &[atomic_core::Hash]) -> Result<Vec<ObjectRecord>, String> {
632 let runtime = tokio::runtime::Builder::new_current_thread()
633 .enable_all()
634 .build()
635 .map_err(|error| format!("cannot start HTTP runtime: {error}"))?;
636 let mut records = Vec::new();
637 for hash in wanted {
638 match runtime.block_on(self.remote.download_change(&hash.to_base32())) {
639 Ok(bytes) => records.push(ObjectRecord::new(
640 ObjectFamily::Change,
641 hash.to_base32(),
642 bytes.to_vec(),
643 )),
644 Err(error) => {
645 print_warning(&format!(
646 "remote did not serve change {}: {error}",
647 hash.to_base32()
648 ));
649 }
650 }
651 }
652 if records.is_empty() && !wanted.is_empty() {
653 return Err("the Atomic remote served none of the wanted changes".to_string());
654 }
655 Ok(records)
656 }
657}
658
659impl HttpBindingChangeSource {

Callers

nothing calls this directly

Calls 6

print_warningFunction · 0.85
download_changeMethod · 0.80
buildMethod · 0.45
to_base32Method · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected