Skip to content

ItemInfo: add mtime field (storage-side modification timestamp) - #212

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:iteminfo-mtime
Aug 11, 2026
Merged

ItemInfo: add mtime field (storage-side modification timestamp)#212
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:iteminfo-mtime

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Add an mtime field to ItemInfo: the last modification UNIX timestamp, stamped by the storage side's clock, 0 if unknown.

  • posixfs: st_mtime (free, the stat is already fetched)
  • sftp: st_mtime from SFTPAttributes (already on the wire); also plumbs the previously-missing atime
  • s3: LastModified (stamped by the S3 service)
  • rest: new X-BorgStore-Mtime header (HEAD) and "mtime" JSON key (list); old servers without it degrade to 0 on the client side
  • rclone: stays 0 — rclone's ModTime is a client-supplied timestamp preserved across upload, not a storage-side clock reading, and fetching it would cost extra per-object metadata reads on some remotes (noModTime stays True)

The field lets clients compare timestamps across writers within the storage's clock domain, e.g. borg's clock-skew handling for repository locks (borgbackup/borg#9870). Targets a 0.6.1 release (the borg PR pins ~= 0.6.1).

The mtime field is appended after atime with a default of 0, so positional construction with fewer fields keeps working.

Tests: full suite passes locally (265 passed / 12 skipped), incl. new mtime assertions for posixfs and the rest server/client.

🤖 Generated with Claude Code

Add an mtime field to ItemInfo: the last modification UNIX timestamp,
stamped by the *storage side's* clock, 0 if unknown.

- posixfs: st_mtime (free, stat is already fetched)
- sftp: st_mtime from SFTPAttributes (already on the wire);
  also plumb the previously-missing atime
- s3: LastModified (stamped by the S3 service)
- rest: new X-BorgStore-Mtime header (HEAD) and "mtime" JSON key (list);
  old servers without it degrade to 0 on the client side
- rclone: stays 0 - rclone's ModTime is a client-supplied timestamp
  preserved across upload, not a storage-side clock reading, and
  fetching it would cost extra per-object metadata reads on some
  remotes (noModTime stays True)

The field enables clients to compare timestamps across writers in the
storage's clock domain, e.g. borg's clock-skew handling for repository
locks (borgbackup/borg#9870).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ThomasWaldmann
ThomasWaldmann merged commit 992e3cd into borgbackup:master Aug 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant