MCPcopy Index your code
hub / github.com/docker/docker-agent / Range

Method Range

pkg/concurrent/map.go:93–103  ·  view source on GitHub ↗

Range calls f for every key/value pair in the map. Iteration stops early if f returns false. Range iterates over a snapshot of the map taken under a read lock; f is invoked without holding any lock, which means callbacks may safely call other methods on the same Map (including Store and Delete) wit

(f func(key K, value V) bool)

Source from the content-addressed store, hash-verified

91// deadlocking. As a consequence, mutations performed during iteration are not
92// reflected in the values seen by f.
93func (m *Map[K, V]) Range(f func(key K, value V) bool) {
94 m.mu.RLock()
95 snapshot := maps.Clone(m.values)
96 m.mu.RUnlock()
97
98 for k, v := range snapshot {
99 if !f(k, v) {
100 break
101 }
102 }
103}

Callers 15

ListBackgroundJobsMethod · 0.45
StopMethod · 0.45
TestHandleRun_StartsTaskFunction · 0.45
runningTaskCountMethod · 0.45
pruneCompletedMethod · 0.45
HandleListMethod · 0.45
StopAllMethod · 0.45
InvalidateCachesFunction · 0.45
GetSessionsMethod · 0.45
GetSessionSummariesMethod · 0.45

Calls 1

CloneMethod · 0.45

Tested by 6

TestHandleRun_StartsTaskFunction · 0.36
TestMap_RangeFunction · 0.36
TestSlice_RangeFunction · 0.36