Class MySqlGtidSet

java.lang.Object
io.debezium.connector.mysql.strategy.mysql.MySqlGtidSet
All Implemented Interfaces:
GtidSet

@Immutable public class MySqlGtidSet extends Object implements GtidSet
Represents a set of MySQL GTIDs. This is an improvement ove GtidSet that is immutable, and more properly supports comparisons.
Author:
Chris Cranford, Randall Hauch
  • Field Details

  • Constructor Details

  • Method Details

    • isEmpty

      public boolean isEmpty()
      Description copied from interface: GtidSet
      Returns whether this GtidSet is empty.
      Specified by:
      isEmpty in interface GtidSet
    • retainAll

      public MySqlGtidSet retainAll(Predicate<String> sourceFilter)
      Description copied from interface: GtidSet
      Obtain a copy of this GtidSet except with only the GTID ranges match the specified predicate.
      Specified by:
      retainAll in interface GtidSet
      Parameters:
      sourceFilter - the predicate that returns whether a server identifier is to be included
      Returns:
      the new GtidSet, or this object if sourceFilter is null; never null
    • isContainedWithin

      public boolean isContainedWithin(GtidSet other)
      Description copied from interface: GtidSet
      Determine whether the GTIDs represented by this object are contained completely within the supplied set.
      Specified by:
      isContainedWithin in interface GtidSet
      Parameters:
      other - the other set of GTIDs; may be null
      Returns:
      true if all GTIDs are present in the provided set, false otherwise
    • with

      public GtidSet with(GtidSet other)
      Description copied from interface: GtidSet
      Obtain a copy of this GtidSet except overwritten with all the GTID ranges in the supplied GtidSet.
      Specified by:
      with in interface 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 MySqlGtidSet getGtidSetBeginning()
      Description copied from interface: GtidSet
      Returns a copy of this with all intervals set to the beginning.
      Specified by:
      getGtidSetBeginning in interface GtidSet
    • contains

      public boolean contains(String gtid)
      Description copied from interface: GtidSet
      Return whether the specified GTID is present in this set.
      Specified by:
      contains in interface GtidSet
      Parameters:
      gtid - the gtid to check; may not be null
      Returns:
      true if contained by this set, false otherwise
    • subtract

      public MySqlGtidSet subtract(GtidSet other)
      Description copied from interface: GtidSet
      Subtracts the two GTID sets.
      Specified by:
      subtract in interface GtidSet
      Parameters:
      other - ther other set; may be null
      Returns:
      a new GtidSet that contains the difference in GTIDs
    • getUUIDSets

      public Collection<MySqlGtidSet.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 MySqlGtidSet.UUIDSet forServerWithId(String uuid)
      Find the MySqlGtidSet.UUIDSet for the server with the specified Uuid.
      Parameters:
      uuid - the Uuid of the server
      Returns:
      the MySqlGtidSet.UUIDSet for the identified server, or null if there are no GTIDs from that server.
    • 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