MCPcopy Index your code
hub / github.com/cortexproject/cortex / hasReplicationSetChangedExcluding

Function hasReplicationSetChangedExcluding

pkg/ring/replication_set.go:172–196  ·  view source on GitHub ↗

Do comparison of replicasets, but apply a function first to be able to exclude (reset) some values

(before, after ReplicationSet, exclude func(*InstanceDesc))

Source from the content-addressed store, hash-verified

170// Do comparison of replicasets, but apply a function first
171// to be able to exclude (reset) some values
172func hasReplicationSetChangedExcluding(before, after ReplicationSet, exclude func(*InstanceDesc)) bool {
173 beforeInstances := before.Instances
174 afterInstances := after.Instances
175
176 if len(beforeInstances) != len(afterInstances) {
177 return true
178 }
179
180 sort.Sort(ByAddr(beforeInstances))
181 sort.Sort(ByAddr(afterInstances))
182
183 for i := range beforeInstances {
184 b := beforeInstances[i]
185 a := afterInstances[i]
186
187 exclude(&a)
188 exclude(&b)
189
190 if !b.Equal(a) {
191 return true
192 }
193 }
194
195 return false
196}

Callers 2

HasReplicationSetChangedFunction · 0.85

Calls 2

ByAddrTypeAlias · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected