• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / go-tarantool / 23905838815

02 Apr 2026 02:32PM UTC coverage: 73.962%. Remained the same
23905838815

push

github

laines-it
new proposal

32 of 43 new or added lines in 2 files covered. (74.42%)

91 existing lines in 1 file now uncovered.

3011 of 4071 relevant lines covered (73.96%)

239907.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.73
/response_queue.go
1
package tarantool
2

3
import (
4
        "runtime"
5
        "sync/atomic"
6

7
        "golang.org/x/sys/cpu"
8
)
9

10
type resp struct {
11
        header Header
12
        buf    smallBuf
13
}
14

15
type ResponseQueue struct {
16
        _          cpu.CacheLinePad
17
        buf        []resp
18
        _          cpu.CacheLinePad
19
        rIdx       uint32
20
        wIdxCached uint32
21
        _          cpu.CacheLinePad
22
        wIdx       uint32
23
        rIdxCached uint32
24
        _          cpu.CacheLinePad
25
}
26

27
func NewResponseQueue(size uint) *ResponseQueue {
328✔
28
        return &ResponseQueue{buf: make([]resp, size)}
328✔
29
}
328✔
30

31
func (q *ResponseQueue) Push(el resp) {
1,146✔
32
        wIdxNext := q.wIdx + 1
1,146✔
33
        if wIdxNext == uint32(len(q.buf)) {
1,146✔
NEW
34
                wIdxNext = 0
×
NEW
35
        }
×
36

37
        if wIdxNext == q.rIdxCached {
1,146✔
NEW
38
                q.rIdxCached = atomic.LoadUint32(&q.rIdx)
×
NEW
39
                for wIdxNext == q.rIdxCached {
×
NEW
40
                        runtime.Gosched()
×
NEW
41
                        q.rIdxCached = atomic.LoadUint32(&q.rIdx)
×
NEW
42
                }
×
43
        }
44
        q.buf[q.wIdx] = el
1,146✔
45
        atomic.StoreUint32(&q.wIdx, wIdxNext)
1,146✔
46
}
47

48
func (q *ResponseQueue) Pop() resp {
1,470✔
49
        defer q.Advance()
1,470✔
50

1,470✔
51
        rIdx := q.rIdx
1,470✔
52
        if rIdx == q.wIdxCached {
2,930✔
53
                q.wIdxCached = atomic.LoadUint32(&q.wIdx)
1,460✔
54
                for rIdx == q.wIdxCached {
234,017,474✔
55
                        runtime.Gosched()
234,016,014✔
56
                        q.wIdxCached = atomic.LoadUint32(&q.wIdx)
234,016,014✔
57
                }
234,016,014✔
58
        }
59

60
        return q.buf[rIdx]
1,146✔
61
}
62

63
func (q *ResponseQueue) Advance() {
1,146✔
64
        rIdxNext := q.rIdx + 1
1,146✔
65
        if rIdxNext == uint32(len(q.buf)) {
1,146✔
NEW
66
                rIdxNext = 0
×
NEW
67
        }
×
68
        atomic.StoreUint32(&q.rIdx, rIdxNext)
1,146✔
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc