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

Method resyncSlotMappings

pkg/topom/topom_proxy.go:147–171  ·  view source on GitHub ↗
(ctx *context, slots ...*models.SlotMapping)

Source from the content-addressed store, hash-verified

145}
146
147func (s *Topom) resyncSlotMappings(ctx *context, slots ...*models.SlotMapping) error {
148 if len(slots) == 0 {
149 return nil
150 }
151 var fut sync2.Future
152 for _, p := range ctx.proxy {
153 fut.Add()
154 go func(p *models.Proxy) {
155 err := s.newProxyClient(p).FillSlots(ctx.toSlotSlice(slots, p)...)
156 if err != nil {
157 log.ErrorErrorf(err, "proxy-[%s] resync slots failed", p.Token)
158 }
159 fut.Done(p.Token, err)
160 }(p)
161 }
162 for t, v := range fut.Wait() {
163 switch err := v.(type) {
164 case error:
165 if err != nil {
166 return errors.Errorf("proxy-[%s] resync slots failed", t)
167 }
168 }
169 }
170 return nil
171}

Callers 6

GroupPromoteServerMethod · 0.95
SlotActionCompleteMethod · 0.95
SlotsAssignGroupMethod · 0.95
SlotsAssignOfflineMethod · 0.95

Calls 8

AddMethod · 0.95
newProxyClientMethod · 0.95
DoneMethod · 0.95
WaitMethod · 0.95
toSlotSliceMethod · 0.80
ErrorErrorfMethod · 0.80
ErrorfMethod · 0.80
FillSlotsMethod · 0.45

Tested by

no test coverage detected