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

Method refillCache

pkg/topom/topom_cache.go:51–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51func (s *Topom) refillCache() error {
52 for i := s.cache.hooks.Len(); i != 0; i-- {
53 e := s.cache.hooks.Front()
54 s.cache.hooks.Remove(e).(func())()
55 }
56 if slots, err := s.refillCacheSlots(s.cache.slots); err != nil {
57 log.ErrorErrorf(err, "store: load slots failed")
58 return errors.Errorf("store: load slots failed")
59 } else {
60 s.cache.slots = slots
61 }
62 if group, err := s.refillCacheGroup(s.cache.group); err != nil {
63 log.ErrorErrorf(err, "store: load group failed")
64 return errors.Errorf("store: load group failed")
65 } else {
66 s.cache.group = group
67 }
68 if proxy, err := s.refillCacheProxy(s.cache.proxy); err != nil {
69 log.ErrorErrorf(err, "store: load proxy failed")
70 return errors.Errorf("store: load proxy failed")
71 } else {
72 s.cache.proxy = proxy
73 }
74 if sentinel, err := s.refillCacheSentinel(s.cache.sentinel); err != nil {
75 log.ErrorErrorf(err, "store: load sentinel failed")
76 return errors.Errorf("store: load sentinel failed")
77 } else {
78 s.cache.sentinel = sentinel
79 }
80 return nil
81}
82
83func (s *Topom) refillCacheSlots(slots []*models.SlotMapping) ([]*models.SlotMapping, error) {
84 if slots == nil {

Callers 1

newContextMethod · 0.95

Calls 7

refillCacheSlotsMethod · 0.95
refillCacheGroupMethod · 0.95
refillCacheProxyMethod · 0.95
refillCacheSentinelMethod · 0.95
ErrorErrorfMethod · 0.80
ErrorfMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected