"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
swift: add total/free space info in about command.
fsantagostinobietti26bc9826e569
diff --git a/backend/swift/swift.go b/backend/swift/swift.goindex edc774248..452d5f11a 100644--- a/backend/swift/swift.go+++ b/backend/swift/swift.go@@ -883,7 +883,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (// About gets quota informationfunc (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {- var total, objects int64+ var used, objects, total int64if f.rootContainer != "" {var container swift.Containererr = f.pacer.Call(func() (bool, error) {@@ -893,8 +893,9 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {if err != nil {return nil, fmt.Errorf("container info failed: %w", err)}- total = container.Bytes+ used = container.Bytesobjects = container.Count+ total = container.QuotaBytes} else {var containers []swift.Containererr = f.pacer.Call(func() (bool, error) {@@ -905,14 +906,19 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {return nil, fmt.Errorf("container listing failed: %w", err)}for _, c := range containers {- total += c.Bytes+ used += c.Bytesobjects += c.Count+ total += c.QuotaBytes}}usage = &fs.Usage{- Used: fs.NewUsageValue(total), // bytes in use+ Used: fs.NewUsageValue(used), // bytes in useObjects: fs.NewUsageValue(objects), // objects in use}+ if total > 0 {+ usage.Total = fs.NewUsageValue(total)+ usage.Free = fs.NewUsageValue(total - used)+ }return usage, nil}diff --git a/go.mod b/go.modindex c26d5f49b..e860ff31a 100644--- a/go.mod+++ b/go.mod@@ -51,7 +51,7 @@ require (github.com/minio/minio-go/v7 v7.0.74github.com/mitchellh/go-homedir v1.1.0github.com/moby/sys/mountinfo v0.7.2- github.com/ncw/swift/v2 v2.0.2+ github.com/ncw/swift/v2 v2.0.3github.com/oracle/oci-go-sdk/v65 v65.69.2github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/pkg/sftp v1.13.6diff --git a/go.sum b/go.sumindex 62cebef03..3b48fdf64 100644--- a/go.sum+++ b/go.sum@@ -461,8 +461,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/wgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=-github.com/ncw/swift/v2 v2.0.2 h1:jx282pcAKFhmoZBSdMcCRFn9VWkoBIRsCpe+yZq7vEk=-github.com/ncw/swift/v2 v2.0.2/go.mod h1:z0A9RVdYPjNjXVo2pDOPxZ4eu3oarO1P91fTItcb+Kg=+github.com/ncw/swift/v2 v2.0.3 h1:8R9dmgFIWs+RiVlisCEfiQiik1hjuR0JnOkLxaP9ihg=+github.com/ncw/swift/v2 v2.0.3/go.mod h1:cbAO76/ZwcFrFlHdXPjaqWZ9R7Hdar7HpjRXBfbjigk=github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=