1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-08 19:43:58 +00:00

Refactor Account interface

This commit is contained in:
Nick Craig-Wood
2017-02-17 09:15:24 +00:00
parent ac62ef430d
commit 033d1eb7af
4 changed files with 16 additions and 36 deletions

View File

@@ -29,7 +29,7 @@ func newReadFileHandle(o fs.Object) (*ReadFileHandle, error) {
}
fh := &ReadFileHandle{
o: o,
r: fs.NewAccountWithBuffer(r, o), // account the transfer
r: fs.NewAccount(r, o).WithBuffer(), // account the transfer
}
fs.Stats.Transferring(fh.o.Remote())
return fh, nil

View File

@@ -38,7 +38,7 @@ func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, e
file: f,
}
fh.pipeReader, fh.pipeWriter = io.Pipe()
r := fs.NewAccountSizeNameWithBuffer(fh.pipeReader, 0, src.Remote()) // account the transfer
r := fs.NewAccountSizeName(fh.pipeReader, 0, src.Remote()).WithBuffer() // account the transfer
go func() {
o, err := d.f.Put(r, src)
fh.o = o