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

Method dumpConfigV1Recursively

cmd/admin/admin.go:126–150  ·  view source on GitHub ↗
(client models.Client, path string)

Source from the content-addressed store, hash-verified

124}
125
126func (t *cmdAdmin) dumpConfigV1Recursively(client models.Client, path string) interface{} {
127 files, err := client.List(path, false)
128 if err != nil {
129 log.PanicErrorf(err, "list path = %s failed", path)
130 }
131 if len(files) != 0 {
132 var m = make(map[string]interface{})
133 for _, path := range files {
134 m[filepath.Base(path)] = t.dumpConfigV1Recursively(client, path)
135 }
136 return m
137 }
138 b, err := client.Read(path, false)
139 if err != nil {
140 log.PanicErrorf(err, "read file = %s failed", path)
141 }
142 if len(b) != 0 {
143 var v interface{}
144 if err := json.Unmarshal(b, &v); err != nil {
145 log.PanicErrorf(err, "json unmarshal failed")
146 }
147 return v
148 }
149 return nil
150}
151
152func (t *cmdAdmin) dumpConfigV3(d map[string]interface{}) {
153 store := t.newTopomStore(d)

Callers 1

dumpConfigV1Method · 0.95

Calls 3

PanicErrorfMethod · 0.80
ListMethod · 0.65
ReadMethod · 0.65

Tested by

no test coverage detected