MCPcopy
hub / github.com/rclone/rclone / _applyPendingModTime

Method _applyPendingModTime

vfs/file.go:486–516  ·  view source on GitHub ↗

Apply a pending mod time Call with the mutex held

()

Source from the content-addressed store, hash-verified

484// Apply a pending mod time
485// Call with the mutex held
486func (f *File) _applyPendingModTime() error {
487 if f.pendingModTime.IsZero() {
488 return nil
489 }
490 defer func() { f.pendingModTime = time.Time{} }()
491
492 if f.o == nil {
493 return errors.New("cannot apply ModTime, file object is not available")
494 }
495
496 dt := f.pendingModTime.Sub(f.o.ModTime(f.ctx))
497 modifyWindow := f.o.Fs().Precision()
498 if dt < modifyWindow && dt > -modifyWindow {
499 fs.Debugf(f.o, "Not setting pending mod time %v as it is already set", f.pendingModTime)
500 return nil
501 }
502
503 // set the time of the object
504 err := f.o.SetModTime(f.ctx, f.pendingModTime)
505 switch err {
506 case nil:
507 fs.Debugf(f.o, "Applied pending mod time %v OK", f.pendingModTime)
508 case fs.ErrorCantSetModTime, fs.ErrorCantSetModTimeWithoutDelete:
509 // do nothing, in order to not break "touch somefile" if it exists already
510 default:
511 fs.Errorf(f.o, "Failed to apply pending mod time %v: %v", f.pendingModTime, err)
512 return err
513 }
514
515 return nil
516}
517
518// Apply a pending mod time
519func (f *File) applyPendingModTime() error {

Callers 3

SetModTimeMethod · 0.95
applyPendingModTimeMethod · 0.95
setObjectMethod · 0.95

Calls 7

DebugfFunction · 0.92
ErrorfFunction · 0.92
IsZeroMethod · 0.80
ModTimeMethod · 0.65
PrecisionMethod · 0.65
FsMethod · 0.65
SetModTimeMethod · 0.65

Tested by

no test coverage detected