1
mirror of https://github.com/rclone/rclone synced 2025-03-27 11:02:44 +01:00

add rc cache/stats

This commit is contained in:
seuffert 2018-03-22 00:11:20 +01:00 committed by Remus Bunduc
parent ce91289b09
commit d9c13bff83

@ -431,9 +431,29 @@ Params:
`, `,
}) })
rc.Add(rc.Call{
Path: "cache/stats",
Fn: f.httpStats,
Title: "Get cache stats",
Help: `
Show statistics for the cache remote.
`,
})
return f, fsErr return f, fsErr
} }
func (f *Fs) httpStats(in rc.Params) (out rc.Params, err error) {
out = make(rc.Params)
m, err := f.Stats()
if err != nil {
return out, errors.Errorf("error while getting cache stats")
}
out["status"] = "ok"
out["stats"] = m
return out, nil
}
func (f *Fs) httpExpireRemote(in rc.Params) (out rc.Params, err error) { func (f *Fs) httpExpireRemote(in rc.Params) (out rc.Params, err error) {
out = make(rc.Params) out = make(rc.Params)
remoteInt, ok := in["remote"] remoteInt, ok := in["remote"]