MCPcopy Index your code
hub / github.com/coder/coder / LoadOrStore

Method LoadOrStore

coderd/util/syncmap/map.go:47–54  ·  view source on GitHub ↗

nolint:forcetypeassert

(key K, value V)

Source from the content-addressed store, hash-verified

45
46//nolint:forcetypeassert
47func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) {
48 act, loaded := m.m.LoadOrStore(key, value)
49 if !loaded {
50 var empty V
51 return empty, loaded
52 }
53 return act.(V), loaded
54}
55
56func (m *Map[K, V]) CompareAndSwap(key K, old V, newVal V) bool {
57 return m.m.CompareAndSwap(key, old, newVal)

Callers 7

TestRetriesFunction · 0.80
trackRunRefFunction · 0.80
nextStepNumberFunction · 0.80
syncStepCounterFunction · 0.80
GetMethod · 0.80
handleConnMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestRetriesFunction · 0.64