accounting: make it so we can account directories as well as files

This commit is contained in:
Nick Craig-Wood 2022-11-08 20:18:58 +00:00
parent 919e28b8bf
commit 47b04580db
2 changed files with 4 additions and 4 deletions

View File

@ -675,7 +675,7 @@ func (s *StatsInfo) RetryAfter() time.Time {
} }
// NewCheckingTransfer adds a checking transfer to the stats, from the object. // NewCheckingTransfer adds a checking transfer to the stats, from the object.
func (s *StatsInfo) NewCheckingTransfer(obj fs.Object) *Transfer { func (s *StatsInfo) NewCheckingTransfer(obj fs.DirEntry) *Transfer {
tr := newCheckingTransfer(s, obj) tr := newCheckingTransfer(s, obj)
s.checking.add(tr) s.checking.add(tr)
return tr return tr
@ -697,7 +697,7 @@ func (s *StatsInfo) GetTransfers() int64 {
} }
// NewTransfer adds a transfer to the stats from the object. // NewTransfer adds a transfer to the stats from the object.
func (s *StatsInfo) NewTransfer(obj fs.Object) *Transfer { func (s *StatsInfo) NewTransfer(obj fs.DirEntry) *Transfer {
tr := newTransfer(s, obj) tr := newTransfer(s, obj)
s.transferring.add(tr) s.transferring.add(tr)
s.startAverageLoop() s.startAverageLoop()

View File

@ -63,12 +63,12 @@ type Transfer struct {
} }
// newCheckingTransfer instantiates new checking of the object. // newCheckingTransfer instantiates new checking of the object.
func newCheckingTransfer(stats *StatsInfo, obj fs.Object) *Transfer { func newCheckingTransfer(stats *StatsInfo, obj fs.DirEntry) *Transfer {
return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), true) return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), true)
} }
// newTransfer instantiates new transfer. // newTransfer instantiates new transfer.
func newTransfer(stats *StatsInfo, obj fs.Object) *Transfer { func newTransfer(stats *StatsInfo, obj fs.DirEntry) *Transfer {
return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), false) return newTransferRemoteSize(stats, obj.Remote(), obj.Size(), false)
} }