File: sequence.go

package info (click to toggle)
golang-dbus 5.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, bookworm-proposed-updates, forky, sid, trixie
  • size: 592 kB
  • sloc: makefile: 2
file content (24 lines) | stat: -rw-r--r-- 555 bytes parent folder | download
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}
}