+struct SkipInfo {
+ oldest: i64,
+ newest: i64,
+ count: u64,
+}
+
+impl SkipInfo {
+ fn update(&mut self, backup_time: i64) {
+ self.count += 1;
+
+ if backup_time < self.oldest {
+ self.oldest = backup_time;
+ }
+
+ if backup_time > self.newest {
+ self.newest = backup_time;
+ }
+ }
+
+ fn affected(&self) -> Result<String, Error> {
+ match self.count {
+ 0 => Ok(String::new()),
+ 1 => proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest),
+ _ => {
+ Ok(format!(
+ "{} .. {}",
+ proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest)?,
+ proxmox::tools::time::epoch_to_rfc3339_utc(self.newest)?,
+ ))
+ }
+ }
+ }
+}
+
+impl std::fmt::Display for SkipInfo {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(
+ f,
+ "skipped: {} snapshot(s) ({}) older than the newest local snapshot",
+ self.count,
+ self.affected().map_err(|_| std::fmt::Error)?
+ )
+ }
+}
+