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

Method handleSentinelCommand

cmd/admin/dashboard.go:635–671  ·  view source on GitHub ↗
(d map[string]interface{})

Source from the content-addressed store, hash-verified

633}
634
635func (t *cmdDashboard) handleSentinelCommand(d map[string]interface{}) {
636 c := t.newTopomClient()
637
638 switch {
639
640 case d["--sentinel-add"].(bool):
641
642 addr := utils.ArgumentMust(d, "--addr")
643
644 log.Debugf("call rpc add-sentinel to dashboard %s", t.addr)
645 if err := c.AddSentinel(addr); err != nil {
646 log.PanicErrorf(err, "call rpc add-sentinel to dashboard %s failed", t.addr)
647 }
648 log.Debugf("call rpc add-sentinel OK")
649
650 case d["--sentinel-del"].(bool):
651
652 addr := utils.ArgumentMust(d, "--addr")
653
654 force := d["--force"].(bool)
655
656 log.Debugf("call rpc del-sentinel to dashboard %s", t.addr)
657 if err := c.DelSentinel(addr, force); err != nil {
658 log.PanicErrorf(err, "call rpc del-sentinel to dashboard %s failed", t.addr)
659 }
660 log.Debugf("call rpc del-sentinel OK")
661
662 case d["--sentinel-resync"].(bool):
663
664 log.Debugf("call rpc resync-sentinels to dashboard %s", t.addr)
665 if err := c.ResyncSentinels(); err != nil {
666 log.PanicErrorf(err, "call rpc resync-sentinels to dashboard %s failed", t.addr)
667 }
668 log.Debugf("call rpc resync-sentinels OK")
669
670 }
671}
672
673func (t *cmdDashboard) handleSyncActionCommand(d map[string]interface{}) {
674 c := t.newTopomClient()

Callers 1

MainMethod · 0.95

Calls 6

newTopomClientMethod · 0.95
DebugfMethod · 0.80
PanicErrorfMethod · 0.80
AddSentinelMethod · 0.45
DelSentinelMethod · 0.45
ResyncSentinelsMethod · 0.45

Tested by

no test coverage detected