renameID makes a string with the size and the other identifiers of the requested rename strategies it may return an empty string in which case no hash could be made
(obj fs.Object, renamesStrategy trackRenamesStrategy, precision time.Duration)
| 760 | // |
| 761 | // it may return an empty string in which case no hash could be made |
| 762 | func (s *syncCopyMove) renameID(obj fs.Object, renamesStrategy trackRenamesStrategy, precision time.Duration) string { |
| 763 | var builder strings.Builder |
| 764 | |
| 765 | fmt.Fprintf(&builder, "%d", obj.Size()) |
| 766 | |
| 767 | if renamesStrategy.hash() { |
| 768 | var err error |
| 769 | hash, err := obj.Hash(s.ctx, s.commonHash) |
| 770 | if err != nil { |
| 771 | fs.Debugf(obj, "Hash failed: %v", err) |
| 772 | return "" |
| 773 | } |
| 774 | if hash == "" { |
| 775 | return "" |
| 776 | } |
| 777 | |
| 778 | builder.WriteRune(',') |
| 779 | builder.WriteString(hash) |
| 780 | } |
| 781 | |
| 782 | // for renamesStrategy.modTime() we don't add to the hash but we check the times in |
| 783 | // popRenameMap |
| 784 | |
| 785 | if renamesStrategy.leaf() { |
| 786 | builder.WriteRune(',') |
| 787 | builder.WriteString(path.Base(obj.Remote())) |
| 788 | } |
| 789 | |
| 790 | return builder.String() |
| 791 | } |
| 792 | |
| 793 | // pushRenameMap adds the object with hash to the rename map |
| 794 | func (s *syncCopyMove) pushRenameMap(hash string, obj fs.Object) { |