"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
cache: implement rclone backend stats command
Nick Craig-Wood90d738b561c1
diff --git a/backend/cache/cache.go b/backend/cache/cache.goindex 000c4bc2f..8b1263cad 100644--- a/backend/cache/cache.go+++ b/backend/cache/cache.go@@ -65,6 +65,7 @@ func init() {Name: "cache",Description: "Cache a remote",NewFs: NewFs,+ CommandHelp: commandHelp,Options: []fs.Option{{Name: "remote",Help: "Remote to cache.\nNormally should contain a ':' and a path, eg \"myremote:path/to/dir\",\n\"myremote:bucket\" or maybe \"myremote:\" (not recommended).",@@ -1882,6 +1883,31 @@ func (f *Fs) Disconnect(ctx context.Context) error {return do(ctx)}+var commandHelp = []fs.CommandHelp{+ {+ Name: "stats",+ Short: "Print stats on the cache backend in JSON format.",+ },+}++// Command the backend to run a named command+//+// The command run is name+// args may be used to read arguments from+// opts may be used to read optional arguments from+//+// The result should be capable of being JSON encoded+// If it is a string or a []string it will be shown to the user+// otherwise it will be JSON encoded and shown to the user like that+func (f *Fs) Command(ctx context.Context, name string, arg []string, opt map[string]string) (interface{}, error) {+ switch name {+ case "stats":+ return f.Stats()+ default:+ return nil, fs.ErrorCommandNotFound+ }+}+// Check the interfaces are satisfiedvar (_ fs.Fs = (*Fs)(nil)@@ -1899,4 +1925,5 @@ var (_ fs.Abouter = (*Fs)(nil)_ fs.UserInfoer = (*Fs)(nil)_ fs.Disconnecter = (*Fs)(nil)+ _ fs.Commander = (*Fs)(nil))