azureblob: implement --use-server-modtime

This patch implements --use-server-modtime for the Azureblob backend.

It does this by not reading the time from the metadata if the global
flag is set.
This commit is contained in:
Abdullah Saglam 2022-12-15 15:10:53 +00:00 committed by Nick Craig-Wood
parent 6f8112ff67
commit 7be9855a70
2 changed files with 10 additions and 2 deletions

View File

@ -1590,7 +1590,9 @@ func (o *Object) setMetadata(metadata map[string]string) {
for k, v := range metadata {
o.meta[strings.ToLower(k)] = v
}
if modTime, ok := o.meta[modTimeKey]; ok {
// Set o.modTime from metadata if it exists and
// UseServerModTime isn't in use.
if modTime, ok := o.meta[modTimeKey]; !o.fs.ci.UseServerModTime && ok {
when, err := time.Parse(timeFormatIn, modTime)
if err != nil {
fs.Debugf(o, "Couldn't parse %v = %q: %v", modTimeKey, modTime, err)

View File

@ -80,7 +80,13 @@ docs](/docs/#fast-list) for more details.
The modified time is stored as metadata on the object with the `mtime`
key. It is stored using RFC3339 Format time with nanosecond
precision. The metadata is supplied during directory listings so
there is no overhead to using it.
there is no performance overhead to using it.
If you wish to use the Azure standard `LastModified` time stored on
the object as the modified time, then use the `--use-server-modtime`
flag. Note that rclone can't set `LastModified`, so using the
`--update` flag when syncing is recommended if using
`--use-server-modtime`.
### Performance