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

Function OnlineProxy

cmd/proxy/main.go:327–346  ·  view source on GitHub ↗
(p *proxy.Proxy, dashboard string)

Source from the content-addressed store, hash-verified

325}
326
327func OnlineProxy(p *proxy.Proxy, dashboard string) bool {
328 client := topom.NewApiClient(dashboard)
329 t, err := client.Model()
330 if err != nil {
331 log.WarnErrorf(err, "rpc fetch model failed")
332 return false
333 }
334 if t.ProductName != p.Config().ProductName {
335 log.Panicf("unexcepted product name, got model =\n%s", t.Encode())
336 }
337 client.SetXAuth(p.Config().ProductName)
338
339 if err := client.OnlineProxy(p.Model().AdminAddr); err != nil {
340 log.WarnErrorf(err, "rpc online proxy failed")
341 return false
342 } else {
343 log.Warnf("rpc online proxy seems OK")
344 return true
345 }
346}

Callers 2

AutoOnlineWithDashboardFunction · 0.85

Calls 9

ModelMethod · 0.95
SetXAuthMethod · 0.95
OnlineProxyMethod · 0.95
WarnErrorfMethod · 0.80
PanicfMethod · 0.80
WarnfMethod · 0.80
ConfigMethod · 0.45
EncodeMethod · 0.45
ModelMethod · 0.45

Tested by

no test coverage detected