MCPcopy
hub / github.com/CodisLabs/codis / handleOverview

Method handleOverview

cmd/admin/proxy.go:69–105  ·  view source on GitHub ↗
(d map[string]interface{})

Source from the content-addressed store, hash-verified

67}
68
69func (t *cmdProxy) handleOverview(d map[string]interface{}) {
70 c := t.newProxyClient(false)
71
72 log.Debugf("call rpc overview to proxy %s", t.addr)
73 o, err := c.Overview()
74 if err != nil {
75 log.PanicErrorf(err, "call rpc overview to proxy %s failed", t.addr)
76 }
77 log.Debugf("call rpc overview OK")
78
79 var cmd string
80 for _, s := range []string{"config", "model", "slots", "stats"} {
81 if d[s].(bool) {
82 cmd = s
83 }
84 }
85
86 var obj interface{}
87 switch cmd {
88 default:
89 obj = o
90 case "config":
91 obj = o.Config
92 case "model":
93 obj = o.Model
94 case "slots":
95 obj = o.Slots
96 case "stats":
97 obj = o.Stats
98 }
99
100 b, err := json.MarshalIndent(obj, "", " ")
101 if err != nil {
102 log.PanicErrorf(err, "json marshal failed")
103 }
104 fmt.Println(string(b))
105}
106
107func (t *cmdProxy) handleStart(d map[string]interface{}) {
108 c := t.newProxyClient(true)

Callers 1

MainMethod · 0.95

Calls 5

newProxyClientMethod · 0.95
DebugfMethod · 0.80
PanicErrorfMethod · 0.80
PrintlnMethod · 0.80
OverviewMethod · 0.45

Tested by

no test coverage detected