Package io.debezium.connector.mysql
Class GtidSet
- java.lang.Object
-
- io.debezium.connector.mysql.GtidSet
-
@Immutable public final class GtidSet extends Object
A set of MySQL GTIDs. This is an improvement ofGtidSet
that is immutable, and more properly supports comparisons.- Author:
- Randall Hauch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GtidSet.Interval
static class
GtidSet.UUIDSet
A range of GTIDs for a single server with a specific Uuid.
-
Field Summary
Fields Modifier and Type Field Description static Pattern
GTID_DELIMITER
private Map<String,GtidSet.UUIDSet>
uuidSetsByServerId
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String gtid)
boolean
equals(Object obj)
GtidSet.UUIDSet
forServerWithId(String uuid)
Find theGtidSet.UUIDSet
for the server with the specified Uuid.GtidSet
getGtidSetBeginning()
Returns a copy with all intervals set to beginningCollection<GtidSet.UUIDSet>
getUUIDSets()
Get an immutable collection of therange of GTIDs for a single server
.int
hashCode()
boolean
isContainedWithin(GtidSet other)
Determine if the GTIDs represented by this object are contained completely within the supplied set of GTIDs.GtidSet
retainAll(Predicate<String> sourceFilter)
Obtain a copy of thisGtidSet
except with only the GTID ranges that have server UUIDs that match the given predicate.GtidSet
subtract(GtidSet other)
String
toString()
GtidSet
with(GtidSet other)
-
-
-
Field Detail
-
uuidSetsByServerId
private final Map<String,GtidSet.UUIDSet> uuidSetsByServerId
-
GTID_DELIMITER
public static Pattern GTID_DELIMITER
-
-
Constructor Detail
-
GtidSet
protected GtidSet(Map<String,GtidSet.UUIDSet> uuidSetsByServerId)
-
GtidSet
public GtidSet(String gtids)
- Parameters:
gtids
- the string representation of the GTIDs.
-
-
Method Detail
-
retainAll
public GtidSet retainAll(Predicate<String> sourceFilter)
Obtain a copy of thisGtidSet
except with only the GTID ranges that have server UUIDs that match the given predicate.- Parameters:
sourceFilter
- the predicate that returns whether a server UUID is to be included- Returns:
- the new GtidSet, or this object if
sourceFilter
is null; never null
-
getUUIDSets
public Collection<GtidSet.UUIDSet> getUUIDSets()
Get an immutable collection of therange of GTIDs for a single server
.- Returns:
- the
GTID ranges for each server
; never null
-
forServerWithId
public GtidSet.UUIDSet forServerWithId(String uuid)
Find theGtidSet.UUIDSet
for the server with the specified Uuid.- Parameters:
uuid
- the Uuid of the server- Returns:
- the
GtidSet.UUIDSet
for the identified server, ornull
if there are no GTIDs from that server.
-
isContainedWithin
public boolean isContainedWithin(GtidSet other)
Determine if the GTIDs represented by this object are contained completely within the supplied set of GTIDs.- Parameters:
other
- the other set of GTIDs; may be null- Returns:
true
if all of the GTIDs in this set are completely contained within the supplied set of GTIDs, orfalse
otherwise
-
with
public GtidSet with(GtidSet other)
Obtain a copy of thisGtidSet
except overwritten with all of the GTID ranges in the suppliedGtidSet
.- Parameters:
other
- the otherGtidSet
with ranges to add/overwrite on top of those in this set;- Returns:
- the new GtidSet, or this object if
other
is null or empty; never null
-
getGtidSetBeginning
public GtidSet getGtidSetBeginning()
Returns a copy with all intervals set to beginning- Returns:
-
contains
public boolean contains(String gtid)
-
-