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 ofGtidSetthat is immutable, and more properly supports comparisons.- Author:
- Randall Hauch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGtidSet.Intervalstatic classGtidSet.UUIDSetA range of GTIDs for a single server with a specific Uuid.
-
Field Summary
Fields Modifier and Type Field Description private Map<String,GtidSet.UUIDSet>uuidSetsByServerId
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)GtidSet.UUIDSetforServerWithId(String uuid)Find theGtidSet.UUIDSetfor the server with the specified Uuid.GtidSetgetGtidSetBeginning()Returns a copy with all intervals set to beginningCollection<GtidSet.UUIDSet>getUUIDSets()Get an immutable collection of therange of GTIDs for a single server.inthashCode()booleanisContainedWithin(GtidSet other)Determine if the GTIDs represented by this object are contained completely within the supplied set of GTIDs.GtidSetretainAll(Predicate<String> sourceFilter)Obtain a copy of thisGtidSetexcept with only the GTID ranges that have server UUIDs that match the given predicate.StringtoString()GtidSetwith(GtidSet other)
-
-
-
Field Detail
-
uuidSetsByServerId
private final Map<String,GtidSet.UUIDSet> uuidSetsByServerId
-
-
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 thisGtidSetexcept 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
sourceFilteris 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.UUIDSetfor the server with the specified Uuid.- Parameters:
uuid- the Uuid of the server- Returns:
- the
GtidSet.UUIDSetfor the identified server, ornullif 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:
trueif all of the GTIDs in this set are completely contained within the supplied set of GTIDs, orfalseotherwise
-
with
public GtidSet with(GtidSet other)
Obtain a copy of thisGtidSetexcept overwritten with all of the GTID ranges in the suppliedGtidSet.- Parameters:
other- the otherGtidSetwith ranges to add/overwrite on top of those in this set;- Returns:
- the new GtidSet, or this object if
otheris null or empty; never null
-
getGtidSetBeginning
public GtidSet getGtidSetBeginning()
Returns a copy with all intervals set to beginning- Returns:
-
-