(&mut self, wanted: &[atomic_core::Hash])
| 629 | |
| 630 | impl 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 | |
| 659 | impl HttpBindingChangeSource { |
nothing calls this directly
no test coverage detected