Welcome to mirror list, hosted at ThFree Co, Russian Federation.

counter.go « promtest « testhelper « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d29831e8a2149462aff7e2571d9daf748950a2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package promtest

import (
	"sync"
)

//nolint: stylecheck // This is unintentionally missing documentation.
type MockCounter struct {
	m     sync.RWMutex
	value float64
}

//nolint: stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Value() float64 {
	m.m.RLock()
	defer m.m.RUnlock()
	return m.value
}

//nolint: stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Inc() {
	m.Add(1)
}

//nolint: stylecheck // This is unintentionally missing documentation.
func (m *MockCounter) Add(v float64) {
	m.m.Lock()
	defer m.m.Unlock()
	m.value += v
}