gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

sequence.go (555B)


      1 package dbus
      2 
      3 // Sequence represents the value of a monotonically increasing counter.
      4 type Sequence uint64
      5 
      6 const (
      7 	// NoSequence indicates the absence of a sequence value.
      8 	NoSequence Sequence = 0
      9 )
     10 
     11 // sequenceGenerator represents a monotonically increasing counter.
     12 type sequenceGenerator struct {
     13 	nextSequence Sequence
     14 }
     15 
     16 func (generator *sequenceGenerator) next() Sequence {
     17 	result := generator.nextSequence
     18 	generator.nextSequence++
     19 	return result
     20 }
     21 
     22 func newSequenceGenerator() *sequenceGenerator {
     23 	return &sequenceGenerator{nextSequence: 1}
     24 }