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

Method dumpConfigV3

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

Source from the content-addressed store, hash-verified

150}
151
152func (t *cmdAdmin) dumpConfigV3(d map[string]interface{}) {
153 store := t.newTopomStore(d)
154 defer store.Close()
155
156 group, err := store.ListGroup()
157 if err != nil {
158 log.PanicErrorf(err, "list group failed")
159 }
160 proxy, err := store.ListProxy()
161 if err != nil {
162 log.PanicErrorf(err, "list proxy failed")
163 }
164
165 if len(group) == 0 && len(proxy) == 0 {
166 log.Panicf("cann't find product = %s [v3]", t.product)
167 }
168
169 slots, err := store.SlotMappings()
170 if err != nil {
171 log.PanicErrorf(err, "list slots failed")
172 }
173
174 config := &ConfigV3{
175 Slots: slots,
176 Group: models.SortGroup(group),
177 Proxy: models.SortProxy(proxy),
178 }
179
180 b, err := json.MarshalIndent(config, "", " ")
181 if err != nil {
182 log.PanicErrorf(err, "json marshal failed")
183 }
184 fmt.Println(string(b))
185}
186
187func (t *cmdAdmin) loadJsonConfigV1(file string) map[string]interface{} {
188 b, err := ioutil.ReadFile(file)

Callers 1

handleConfigDumpMethod · 0.95

Calls 8

newTopomStoreMethod · 0.95
ListGroupMethod · 0.80
PanicErrorfMethod · 0.80
ListProxyMethod · 0.80
PanicfMethod · 0.80
SlotMappingsMethod · 0.80
PrintlnMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected