Update the cache by replacing entries from the divergence point with new entries from the remote.
(&mut self, divergence: u64, entries: &[ChangelistEntry])
| 235 | /// Update the cache by replacing entries from the divergence point |
| 236 | /// with new entries from the remote. |
| 237 | pub fn update_from_changelist(&mut self, divergence: u64, entries: &[ChangelistEntry]) { |
| 238 | // Remove stale entries at or after divergence |
| 239 | self.truncate_from(divergence); |
| 240 | |
| 241 | // Insert new entries |
| 242 | for entry in entries { |
| 243 | let node = entry.to_node(); |
| 244 | self.insert(entry.sequence, node); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | impl fmt::Display for RemoteState { |