1
0
mirror of https://github.com/rclone/rclone.git synced 2026-02-13 06:53:29 +00:00

azureblob: add server side copy real time accounting

This commit is contained in:
Nick Craig-Wood
2026-02-12 16:34:06 +00:00
parent d516515dfe
commit 983a4c3686

View File

@@ -52,6 +52,7 @@ import (
"github.com/rclone/rclone/lib/multipart"
"github.com/rclone/rclone/lib/pacer"
"github.com/rclone/rclone/lib/pool"
"github.com/rclone/rclone/lib/transferaccounter"
"golang.org/x/sync/errgroup"
)
@@ -1878,10 +1879,12 @@ func (f *Fs) copyMultipart(ctx context.Context, remote, dstContainer, dstPath st
blockIDs = make([]string, numParts) // list of blocks for finalize
g, gCtx = errgroup.WithContext(ctx)
checker = newCheckForInvalidBlockOrBlob("copy", o)
account = transferaccounter.Get(ctx)
)
g.SetLimit(f.opt.CopyConcurrency)
fs.Debugf(o, "Starting multipart copy with %d parts of size %v", numParts, fs.SizeSuffix(partSize))
account.Start()
for partNum := uint64(0); partNum < uint64(numParts); partNum++ {
// Fail fast, in case an errgroup managed function returns an error
// gCtx is cancelled. There is no point in uploading all the other parts.
@@ -1929,6 +1932,7 @@ func (f *Fs) copyMultipart(ctx context.Context, remote, dstContainer, dstPath st
return fmt.Errorf("multipart copy: failed to copy chunk %d with %v bytes: %w", partNum+1, -1, err)
}
blockIDs[partNum] = blockID
account.Add(partSize)
return nil
})
}