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 of GtidSet that is immutable, and more properly supports comparisons.
Author:
Randall Hauch
  • Field Details

  • Constructor Details

    • GtidSet

      protected GtidSet(Map<String,GtidSet.UUIDSet> uuidSetsByServerId)
    • GtidSet

      public GtidSet(String gtids)
      Parameters:
      gtids - the string representation of the GTIDs.
  • Method Details

    • retainAll

      public GtidSet retainAll(Predicate<String> sourceFilter)
      Obtain a copy of this GtidSet 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 the range of GTIDs for a single server.
      Returns:
      the GTID ranges for each server; never null
    • forServerWithId

      public GtidSet.UUIDSet forServerWithId(String uuid)
      Find the GtidSet.UUIDSet for the server with the specified Uuid.
      Parameters:
      uuid - the Uuid of the server
      Returns:
      the GtidSet.UUIDSet for the identified server, or null 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, or false otherwise
    • with

      public GtidSet with(GtidSet other)
      Obtain a copy of this GtidSet except overwritten with all of the GTID ranges in the supplied GtidSet.
      Parameters:
      other - the other GtidSet 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)
    • subtract

      public GtidSet subtract(GtidSet other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object