forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtid_set.go
36 lines (29 loc) · 1.31 KB
/
gtid_set.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package replication
// GTIDSet represents the set of transactions received or applied by a server.
// In some flavors, a single GTID is enough to specify the set of all
// transactions that came before it, but in others a more complex structure is
// required.
//
// GTIDSet is wrapped by replication.Position, which is a concrete struct.
// When sending a GTIDSet over RPCs, encode/decode it as a string.
// Most code outside of this package should use replication.Position rather
// than GTIDSet.
type GTIDSet interface {
// String returns the canonical printed form of the set as expected by a
// particular flavor of MySQL.
String() string
// Flavor returns the key under which the corresponding parser function is
// registered in the transactionSetParsers map.
Flavor() string
// ContainsGTID returns true if the set contains the specified transaction.
ContainsGTID(GTID) bool
// Contains returns true if the set is a superset of another set.
Contains(GTIDSet) bool
// Equal returns true if the set is equal to another set.
Equal(GTIDSet) bool
// AddGTID returns a new GTIDSet that is expanded to contain the given GTID.
AddGTID(GTID) GTIDSet
}
// gtidSetParsers maps flavor names to parser functions. It is used by
// ParseReplicationPosition().
var gtidSetParsers = make(map[string]func(string) (GTIDSet, error))