MCPcopy Index your code
hub / github.com/CodisLabs/codis / newTopomClient

Method newTopomClient

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

Source from the content-addressed store, hash-verified

37}
38
39func (t *cmdAdmin) newTopomClient(d map[string]interface{}) models.Client {
40 var coordinator struct {
41 name string
42 addr string
43 auth string
44 }
45
46 switch {
47 case d["--zookeeper"] != nil:
48 coordinator.name = "zookeeper"
49 coordinator.addr = utils.ArgumentMust(d, "--zookeeper")
50 if d["--zookeeper-auth"] != nil {
51 coordinator.auth = utils.ArgumentMust(d, "--zookeeper-auth")
52 }
53
54 case d["--etcd"] != nil:
55 coordinator.name = "etcd"
56 coordinator.addr = utils.ArgumentMust(d, "--etcd")
57 if d["--etcd-auth"] != nil {
58 coordinator.auth = utils.ArgumentMust(d, "--etcd-auth")
59 }
60
61 case d["--filesystem"] != nil:
62 coordinator.name = "filesystem"
63 coordinator.addr = utils.ArgumentMust(d, "--filesystem")
64
65 default:
66 log.Panicf("invalid coordinator")
67 }
68
69 c, err := models.NewClient(coordinator.name, coordinator.addr, coordinator.auth, time.Minute)
70 if err != nil {
71 log.PanicErrorf(err, "create '%s' client to '%s' failed", coordinator.name, coordinator.addr)
72 }
73 return c
74}
75
76func (t *cmdAdmin) newTopomStore(d map[string]interface{}) *models.Store {
77 if err := models.ValidateProduct(t.product); err != nil {

Callers 3

newTopomStoreMethod · 0.95
dumpConfigV1Method · 0.95
handleDashboardListMethod · 0.95

Calls 2

PanicfMethod · 0.80
PanicErrorfMethod · 0.80

Tested by

no test coverage detected