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

Method dumpConfigV1

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

Source from the content-addressed store, hash-verified

108}
109
110func (t *cmdAdmin) dumpConfigV1(d map[string]interface{}) {
111 client := t.newTopomClient(d)
112 defer client.Close()
113
114 prefix := filepath.Join("/zk/codis", fmt.Sprintf("db_%s", t.product))
115 config := t.dumpConfigV1Recursively(client, prefix)
116 if m, ok := config.(map[string]interface{}); !ok || m == nil {
117 log.Panicf("cann't find product = %s [v1]", t.product)
118 }
119 b, err := json.MarshalIndent(config, "", " ")
120 if err != nil {
121 log.PanicErrorf(err, "json marshal failed")
122 }
123 fmt.Println(string(b))
124}
125
126func (t *cmdAdmin) dumpConfigV1Recursively(client models.Client, path string) interface{} {
127 files, err := client.List(path, false)

Callers 1

handleConfigDumpMethod · 0.95

Calls 6

newTopomClientMethod · 0.95
PanicfMethod · 0.80
PanicErrorfMethod · 0.80
PrintlnMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected