builtin
CRT-A0001321 for _, id := range s.conf.EvictedStores {
322 old[id] = struct{}{}
323 }
324 new := make(map[uint64]struct{})325 for _, id := range newCfg.EvictedStores {
326 new[id] = struct{}{}
327 }
222 for _, id := range s.conf.EvictedStores {
223 old[id] = struct{}{}
224 }
225 new := make(map[uint64]struct{})226 for _, id := range newCfg.EvictedStores {
227 new[id] = struct{}{}
228 }
252}
253
254// SwitchAPIServerLeader switches the API server leader.
255func (c *Cluster) SwitchAPIServerLeader(new pdpb.PDClient) bool {256 old := c.apiServerLeader.Load()
257 return c.apiServerLeader.CompareAndSwap(old, new)
258}
166}
167
168// CASClusterVersion sets the cluster version.
169func (o *PersistOptions) CASClusterVersion(old, new *semver.Version) bool { 170 return atomic.CompareAndSwapPointer(&o.clusterVersion, unsafe.Pointer(old), unsafe.Pointer(new))
171}
172
392}
393
394// pauseAndResumeLeaderTransfer checks the old and new store IDs, and pause or resume the leader transfer.
395func pauseAndResumeLeaderTransfer[T any](cluster *core.BasicCluster, old, new map[uint64]T) {396 for id := range old {
397 if _, ok := new[id]; ok {
398 continue
It is not recommended to shadow builtins because identifiers shadowing a built-in makes it inaccessible to use. A shadowed variable or function is declared in the scope with the same name as a built-in function.
len := 10 // shadowing bultin `len`
length := 10