Class Lsn

java.lang.Object
io.debezium.connector.sqlserver.Lsn
All Implemented Interfaces:
Nullable, Comparable<Lsn>

public class Lsn extends Object implements Comparable<Lsn>, Nullable
A logical representation of SQL Server LSN (log sequence number) position. When LSN is not available it is replaced with NULL constant.
Author:
Jiri Pechanec
  • Field Details

    • NULL_STRING

      private static final String NULL_STRING
      See Also:
    • NULL

      public static final Lsn NULL
    • binary

      private final byte[] binary
    • unsignedBinary

      private int[] unsignedBinary
    • string

      private String string
  • Constructor Details

    • Lsn

      private Lsn(byte[] binary)
  • Method Details

    • getBinary

      public byte[] getBinary()
      Returns:
      binary representation of the stored LSN
    • isAvailable

      public boolean isAvailable()
      Specified by:
      isAvailable in interface Nullable
      Returns:
      true if this is a real LSN or false it it is NULL
    • getUnsignedBinary

      private int[] getUnsignedBinary()
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      textual representation of the stored LSN
    • valueOf

      public static Lsn valueOf(String lsnString)
      Parameters:
      lsnString - - textual representation of Lsn
      Returns:
      LSN converted from its textual representation
    • valueOf

      public static Lsn valueOf(byte[] lsnBinary)
      Parameters:
      lsnBinary - - binary representation of Lsn
      Returns:
      LSN converted from its binary representation
    • hashCode

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

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

      public int compareTo(Lsn o)
      Enables ordering of LSNs. The NULL LSN is always the smallest one.
      Specified by:
      compareTo in interface Comparable<Lsn>
    • isBetween

      public boolean isBetween(Lsn from, Lsn to)
      Verifies whether the LSN falls into a LSN interval
      Parameters:
      from - start of the interval (included)
      to - end of the interval (excluded)
      Returns:
      true if the LSN falls into the interval