Atlas › Test

TestMap_Get

Exact test identity: go.temporal.io/server/common/collection/TestMap_Get

Package
go.temporal.io/server/common/collection
Suite / test hierarchy
TestMap_Get
Test
TestMap_Get
Introduced at
sync_map.go ×1 Frontier kind: Joint frontier
Covered ranges
3
Covered lines
17
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/collection/sync_map.go 17 covered LOC · 3 ranges

Open complete file

15 }
16
17 > func NewSyncMap[K comparable, V any]() SyncMap[K, V] { sync_map.go
18 > return SyncMap[K, V]{
19 > RWMutex: &sync.RWMutex{},
20 > contents: make(map[K]V),
21 > }
22 > }
23
24 > func (m *SyncMap[K, V]) Get(key K) (value V, ok bool) { sync_map.go
25 > m.RLock()
26 > defer m.RUnlock()
27 > value, ok = m.contents[key]
28 > return
29 > }
30
31 func (m *SyncMap[K, V]) GetOrSet(key K, value V) (v V, exist bool) {
47 }
48
49 > func (m *SyncMap[K, V]) Set(key K, value V) { sync_map.go
50 > m.Lock()
51 > defer m.Unlock()
52 > m.contents[key] = value
53 > }
54
55 func (m *SyncMap[K, V]) Delete(key K) {