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

Method refillCacheSlots

pkg/topom/topom_cache.go:83–102  ·  view source on GitHub ↗
(slots []*models.SlotMapping)

Source from the content-addressed store, hash-verified

81}
82
83func (s *Topom) refillCacheSlots(slots []*models.SlotMapping) ([]*models.SlotMapping, error) {
84 if slots == nil {
85 return s.store.SlotMappings()
86 }
87 for i, _ := range slots {
88 if slots[i] != nil {
89 continue
90 }
91 m, err := s.store.LoadSlotMapping(i, false)
92 if err != nil {
93 return nil, err
94 }
95 if m != nil {
96 slots[i] = m
97 } else {
98 slots[i] = &models.SlotMapping{Id: i}
99 }
100 }
101 return slots, nil
102}
103
104func (s *Topom) refillCacheGroup(group map[int]*models.Group) (map[int]*models.Group, error) {
105 if group == nil {

Callers 1

refillCacheMethod · 0.95

Calls 2

SlotMappingsMethod · 0.80
LoadSlotMappingMethod · 0.80

Tested by

no test coverage detected