"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
accounting: make stats response consistent
Aleksandar Jankovic4ba65329159d
diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.goindex 4d3c2af4a..7fa21a292 100644--- a/fs/accounting/accounting.go+++ b/fs/accounting/accounting.go@@ -8,6 +8,8 @@ import ("time""unicode/utf8"+ "github.com/ncw/rclone/fs/rc"+"github.com/ncw/rclone/fs""github.com/ncw/rclone/fs/asyncreader""github.com/ncw/rclone/fs/fserrors"@@ -318,8 +320,8 @@ func (acc *Account) String() string {}// RemoteStats produces stats for this file-func (acc *Account) RemoteStats() (out map[string]interface{}) {- out = make(map[string]interface{})+func (acc *Account) RemoteStats() (out rc.Params) {+ out = make(rc.Params)a, b := acc.progress()out["bytes"] = aout["size"] = bdiff --git a/fs/accounting/stats.go b/fs/accounting/stats.goindex a3747e7b9..9f4f07aad 100644--- a/fs/accounting/stats.go+++ b/fs/accounting/stats.go@@ -76,24 +76,39 @@ func (s *StatsInfo) RemoteStats() (out rc.Params, err error) {out["checking"] = c}if !s.transferring.empty() {- var t []interface{}s.transferring.mu.RLock()- defer s.transferring.mu.RUnlock()++ var t []rc.Paramsfor name := range s.transferring.items {if acc := s.inProgress.get(name); acc != nil {t = append(t, acc.RemoteStats())} else {- t = append(t, name)+ t = append(t, s.transferRemoteStats(name))}}out["transferring"] = t+ s.transferring.mu.RUnlock()}if s.errors > 0 {- out["lastError"] = s.lastError+ out["lastError"] = s.lastError.Error()}return out, nil}+func (s *StatsInfo) transferRemoteStats(name string) rc.Params {+ s.mu.RLock()+ defer s.mu.RUnlock()+ for _, tr := range s.startedTransfers {+ if tr.remote == name {+ return rc.Params{+ "name": name,+ "size": tr.size,+ }+ }+ }+ return rc.Params{"name": name}+}+type timeRange struct {start time.Timeend time.Time