You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
705 B
Go
34 lines
705 B
Go
package gtid
|
|
|
|
import "sync"
|
|
|
|
type Gtid struct {
|
|
uuidNumbers []UUIDNumber
|
|
hashMap map[string]int
|
|
changed bool
|
|
mu sync.RWMutex
|
|
}
|
|
|
|
type UUIDNumber struct {
|
|
uuid string
|
|
intervals []uuidRange
|
|
}
|
|
|
|
type uuidRange struct {
|
|
min uint64
|
|
max uint64
|
|
}
|
|
|
|
type SortUUID []UUIDNumber
|
|
|
|
func (s SortUUID) Len() int { return len(s) }
|
|
func (s SortUUID) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
func (s SortUUID) Less(i, j int) bool { return s[i].uuid < s[j].uuid }
|
|
|
|
|
|
type SortRange []uuidRange
|
|
|
|
func (s SortRange) Len() int { return len(s) }
|
|
func (s SortRange) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
func (s SortRange) Less(i, j int) bool { return s[i].min < s[j].min }
|