1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: add vfs/stats remote control to show statistics - fixes #5816

This commit is contained in:
Nick Craig-Wood
2021-11-17 16:11:08 +00:00
parent 729117af68
commit d252816706
5 changed files with 123 additions and 0 deletions

View File

@@ -389,3 +389,51 @@ func rcList(ctx context.Context, in rc.Params) (out rc.Params, err error) {
out["vfses"] = names
return out, nil
}
func init() {
rc.Add(rc.Call{
Path: "vfs/stats",
Title: "Stats for a VFS.",
Help: `
This returns stats for the selected VFS.
{
// Status of the disk cache - only present if --vfs-cache-mode > off
"diskCache": {
"bytesUsed": 0,
"erroredFiles": 0,
"files": 0,
"hashType": 1,
"outOfSpace": false,
"path": "/home/user/.cache/rclone/vfs/local/mnt/a",
"pathMeta": "/home/user/.cache/rclone/vfsMeta/local/mnt/a",
"uploadsInProgress": 0,
"uploadsQueued": 0
},
"fs": "/mnt/a",
"inUse": 1,
// Status of the in memory metadata cache
"metadataCache": {
"dirs": 1,
"files": 0
},
// Options as returned by options/get
"opt": {
"CacheMaxAge": 3600000000000,
// ...
"WriteWait": 1000000000
}
}
` + getVFSHelp,
Fn: rcStats,
})
}
func rcStats(ctx context.Context, in rc.Params) (out rc.Params, err error) {
vfs, err := getVFS(in)
if err != nil {
return nil, err
}
return vfs.Stats(), nil
}