mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
accounting: Make checkers show what they are doing
Before this change, all types of checkers showed "checking" after the file name despite the fact that not all of them were checking. After this change, they can show - checking - deleting - hashing - importing - listing - merging - moving - renaming See: https://forum.rclone.org/t/what-is-rclone-checking-during-a-purge/35931/
This commit is contained in:
@@ -120,7 +120,7 @@ func (c *checkMarch) SrcOnly(src fs.DirEntry) (recurse bool) {
|
||||
// check to see if two objects are identical using the check function
|
||||
func (c *checkMarch) checkIdentical(ctx context.Context, dst, src fs.Object) (differ bool, noHash bool, err error) {
|
||||
ci := fs.GetConfig(ctx)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(src)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(src, "checking")
|
||||
defer func() {
|
||||
tr.Done(ctx, err)
|
||||
}()
|
||||
@@ -450,7 +450,7 @@ func (c *checkMarch) checkSum(ctx context.Context, obj fs.Object, download bool,
|
||||
}
|
||||
|
||||
var err error
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(obj)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(obj, "hashing")
|
||||
defer tr.Done(ctx, err)
|
||||
|
||||
if !sumFound {
|
||||
|
||||
@@ -286,7 +286,7 @@ func dedupeFindDuplicateDirs(ctx context.Context, f fs.Fs) (duplicateDirs [][]*d
|
||||
ci := fs.GetConfig(ctx)
|
||||
err = walk.ListR(ctx, f, "", false, ci.MaxDepth, walk.ListAll, func(entries fs.DirEntries) error {
|
||||
for _, entry := range entries {
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(entry)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(entry, "merging")
|
||||
|
||||
remote := entry.Remote()
|
||||
parentRemote := path.Dir(remote)
|
||||
@@ -438,7 +438,7 @@ func Deduplicate(ctx context.Context, f fs.Fs, mode DeduplicateMode, byHash bool
|
||||
files := map[string][]fs.Object{}
|
||||
err := walk.ListR(ctx, f, "", false, ci.MaxDepth, walk.ListObjects, func(entries fs.DirEntries) error {
|
||||
entries.ForObject(func(o fs.Object) {
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o, "checking")
|
||||
defer tr.Done(ctx, nil)
|
||||
|
||||
var remote string
|
||||
|
||||
@@ -544,7 +544,7 @@ func SameObject(src, dst fs.Object) bool {
|
||||
// be nil.
|
||||
func Move(ctx context.Context, fdst fs.Fs, dst fs.Object, remote string, src fs.Object) (newDst fs.Object, err error) {
|
||||
ci := fs.GetConfig(ctx)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(src)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(src, "moving")
|
||||
defer func() {
|
||||
if err == nil {
|
||||
accounting.Stats(ctx).Renames(1)
|
||||
@@ -633,7 +633,7 @@ func SuffixName(ctx context.Context, remote string) string {
|
||||
// deleting
|
||||
func DeleteFileWithBackupDir(ctx context.Context, dst fs.Object, backupDir fs.Fs) (err error) {
|
||||
ci := fs.GetConfig(ctx)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(dst)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(dst, "deleting")
|
||||
defer func() {
|
||||
tr.Done(ctx, err)
|
||||
}()
|
||||
@@ -938,7 +938,7 @@ func List(ctx context.Context, f fs.Fs, w io.Writer) error {
|
||||
func ListLong(ctx context.Context, f fs.Fs, w io.Writer) error {
|
||||
ci := fs.GetConfig(ctx)
|
||||
return ListFn(ctx, f, func(o fs.Object) {
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o, "listing")
|
||||
defer func() {
|
||||
tr.Done(ctx, nil)
|
||||
}()
|
||||
@@ -996,7 +996,7 @@ func hashSum(ctx context.Context, ht hash.Type, base64Encoded bool, downloadFlag
|
||||
return "ERROR", fmt.Errorf("hasher returned an error: %w", err)
|
||||
}
|
||||
} else {
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o)
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(o, "hashing")
|
||||
defer func() {
|
||||
tr.Done(ctx, err)
|
||||
}()
|
||||
@@ -1929,7 +1929,6 @@ func moveOrCopyFile(ctx context.Context, fdst fs.Fs, fsrc fs.Fs, dstFileName str
|
||||
|
||||
_, err = Op(ctx, fdst, dstObj, dstFileName, srcObj)
|
||||
} else {
|
||||
tr := accounting.Stats(ctx).NewCheckingTransfer(srcObj)
|
||||
if !cp {
|
||||
if ci.IgnoreExisting {
|
||||
fs.Debugf(srcObj, "Not removing source file as destination file exists and --ignore-existing is set")
|
||||
@@ -1937,7 +1936,6 @@ func moveOrCopyFile(ctx context.Context, fdst fs.Fs, fsrc fs.Fs, dstFileName str
|
||||
err = DeleteFile(ctx, srcObj)
|
||||
}
|
||||
}
|
||||
tr.Done(ctx, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user