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
1 changed files with 20 additions and 0 deletions

View File

@ -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
}
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) {
out = make(rc.Params)
remoteInt, ok := in["remote"]