summaryrefslogtreecommitdiff
path: root/vendor/github.com/godbus/dbus/v5/sequence.go
blob: 89435d3933bdbd245fd1e506f5d11f76b1b704ab (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
package dbus

// Sequence represents the value of a monotonically increasing counter.
type Sequence uint64

const (
	// NoSequence indicates the absence of a sequence value.
	NoSequence Sequence = 0
)

// sequenceGenerator represents a monotonically increasing counter.
type sequenceGenerator struct {
	nextSequence Sequence
}

func (generator *sequenceGenerator) next() Sequence {
	result := generator.nextSequence
	generator.nextSequence++
	return result
}

func newSequenceGenerator() *sequenceGenerator {
	return &sequenceGenerator{nextSequence: 1}
}