diff options
Diffstat (limited to 'src/object_table.rs')
-rw-r--r-- | src/object_table.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/object_table.rs b/src/object_table.rs index 626c00b2..092dddf8 100644 --- a/src/object_table.rs +++ b/src/object_table.rs @@ -47,20 +47,25 @@ impl Entry<String, String> for Object { &self.key } - fn merge(&mut self, other: &Self) { + fn merge(&mut self, other: &Self) -> bool { + let mut has_change = false; + for other_v in other.versions.iter() { match self.versions.binary_search_by(|v| (v.timestamp, &v.uuid).cmp(&(other_v.timestamp, &other_v.uuid))) { Ok(i) => { let mut v = &mut self.versions[i]; if other_v.size > v.size { v.size = other_v.size; + has_change = true; } - if other_v.is_complete { + if other_v.is_complete && !v.is_complete { v.is_complete = true; + has_change = true; } } Err(i) => { self.versions.insert(i, other_v.clone()); + has_change = true; } } } @@ -73,6 +78,8 @@ impl Entry<String, String> for Object { if let Some(last_vi) = last_complete { self.versions = self.versions.drain(last_vi..).collect::<Vec<_>>(); } + + has_change } } |