mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
accounting: change stats interface
This is done to make clear ownership over accounting object and prepare for removing global stats object. Stats elapsed time calculation has been altered to account for actual transfer time instead of stats creation time.
This commit is contained in:
committed by
Nick Craig-Wood
parent
2d561b51db
commit
be0464f5f1
@@ -110,7 +110,7 @@ func (mc *multiThreadCopyState) calculateChunks() {
|
||||
}
|
||||
|
||||
// Copy src to (f, remote) using streams download threads and the OpenWriterAt feature
|
||||
func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object, streams int) (newDst fs.Object, err error) {
|
||||
func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object, streams int, tr *accounting.Transfer) (newDst fs.Object, err error) {
|
||||
openWriterAt := f.Features().OpenWriterAt
|
||||
if openWriterAt == nil {
|
||||
return nil, errors.New("multi-thread copy: OpenWriterAt not supported")
|
||||
@@ -132,8 +132,7 @@ func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object,
|
||||
mc.calculateChunks()
|
||||
|
||||
// Make accounting
|
||||
mc.acc = accounting.NewAccount(nil, src)
|
||||
defer fs.CheckClose(mc.acc, &err)
|
||||
mc.acc = tr.Account(nil)
|
||||
|
||||
// create write file handle
|
||||
mc.wc, err = openWriterAt(gCtx, remote, mc.size)
|
||||
|
||||
Reference in New Issue
Block a user