remove delegation-auto-updater
diff --git a/src/client.rs b/src/client.rs
index 57b3d75..9ee4acb 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,7 +1,5 @@
//! Clients for high level interactions with TUF repositories.
-use std::collections::{HashSet, VecDeque};
-
use Result;
use error::Error;
use interchange::DataInterchange;
@@ -96,23 +94,7 @@
}
};
- let de = match Self::update_delegations(
- &mut self.tuf,
- &mut self.local,
- self.config.min_bytes_per_second,
- ) {
- Ok(b) => b,
- Err(e) => {
- warn!(
- "Error updating delegation metadata from local sources: {:?}",
- e
- );
- // TODO this might be untrue because of a partial update
- false
- }
- };
-
- Ok(r || ts || sn || ta || de)
+ Ok(r || ts || sn || ta)
}
/// Update TUF metadata from the remote repository.
@@ -141,13 +123,8 @@
&mut self.remote,
self.config.min_bytes_per_second,
)?;
- let de = Self::update_delegations(
- &mut self.tuf,
- &mut self.remote,
- self.config.min_bytes_per_second,
- )?;
- Ok(r || ts || sn || ta || de)
+ Ok(r || ts || sn || ta)
}
/// Returns `true` if an update occurred and `false` otherwise.
@@ -297,75 +274,6 @@
tuf.update_targets(targets)
}
- /// Returns `true` if an update occurred and `false` otherwise.
- fn update_delegations<T>(
- tuf: &mut Tuf<D>,
- repo: &mut T,
- min_bytes_per_second: u32,
- ) -> Result<bool>
- where
- T: Repository<D>,
- {
- let _ = match tuf.snapshot() {
- Some(s) => s,
- None => return Err(Error::MissingMetadata(Role::Snapshot)),
- }.clone();
- let targets = match tuf.targets() {
- Some(t) => t,
- None => return Err(Error::MissingMetadata(Role::Targets)),
- }.clone();
- let delegations = match targets.delegations() {
- Some(d) => d,
- None => return Ok(false),
- }.clone();
-
- let mut visited = HashSet::new();
- let mut to_visit = VecDeque::new();
-
- for role in delegations.roles().iter().map(|r| r.role()) {
- let _ = to_visit.push_back(role.clone());
- }
-
- let mut updated = false;
- while let Some(role) = to_visit.pop_front() {
- if visited.contains(&role) {
- continue;
- }
- let _ = visited.insert(role.clone());
-
- let delegation = match repo.fetch_metadata(
- &Role::Targets,
- &role,
- &MetadataVersion::None,
- &None,
- min_bytes_per_second,
- None,
- ) {
- Ok(d) => d,
- Err(e) => {
- warn!("Failed to fetuch delegation {:?}: {:?}", role, e);
- continue;
- }
- };
-
- match tuf.update_delegation(&role, delegation) {
- Ok(u) => updated |= u,
- Err(e) => {
- warn!("Failed to update delegation {:?}: {:?}", role, e);
- continue;
- }
- };
-
- if let Some(ds) = tuf.delegations().get(&role).and_then(|t| t.delegations()) {
- for d in ds.roles() {
- let _ = to_visit.push_back(d.role().clone());
- }
- }
- }
-
- Ok(updated)
- }
-
/// Fetch a target from the remote repo and write it to the local repo.
pub fn fetch_target(&mut self, target: &TargetPath) -> Result<()> {
let target_description = self.tuf.target_description(target)?;