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

Method Reload

cmd/fe/main.go:259–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257}
258
259func (l *DynamicLoader) Reload() (map[string]string, error) {
260 var m = make(map[string]string)
261 list, err := l.client.List(models.CodisDir, false)
262 if err != nil {
263 return nil, errors.Trace(err)
264 }
265 for _, path := range list {
266 product := filepath.Base(path)
267 if b, err := l.client.Read(models.LockPath(product), false); err != nil {
268 log.WarnErrorf(err, "read topom of product %s failed", product)
269 } else if b != nil {
270 var t = &models.Topom{}
271 if err := json.Unmarshal(b, t); err != nil {
272 log.WarnErrorf(err, "decode json failed")
273 } else {
274 m[product] = t.AdminAddr
275 }
276 }
277 }
278 return m, nil
279}
280
281type ReverseProxy struct {
282 sync.Mutex

Callers

nothing calls this directly

Calls 4

LockPathMethod · 0.80
WarnErrorfMethod · 0.80
ListMethod · 0.65
ReadMethod · 0.65

Tested by

no test coverage detected