Class Lsn

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

public class Lsn extends Object implements Comparable<Lsn>, io.debezium.connector.Nullable
A logical representation of LSN (log sequence number) position. When LSN is not available it is replaced with NULL constant.
Author:
Laoflch Luo, Xiaolin Zhang, Lars M Johansson
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final long
     
    private static final long
     
    static final Lsn
     
    private final Long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Lsn(Long sequence)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Enables ordering of LSNs.
    boolean
     
    int
     
    boolean
     
    long
    32bit position within the current log page
    long
    32bit log page unique identifier
    static Lsn
    of(long loguniq, long logpos)
    Creates an LSN from a logical log file unique id and position within the log file.
    static Lsn
    of(Long sequence)
    Creates an LSN object from a logical log sequence number.
    static Lsn
    of(String sequence)
    Creates an LSN object from a logical log sequence number's string representation.
    long
     
    Return the LSN String for an official representation, like "LSN(7,8a209c)".
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NULL

      public static final Lsn NULL
    • LO_MASK

      private static final long LO_MASK
    • HI_MASK

      private static final long HI_MASK
    • sequence

      private final Long sequence
  • Constructor Details

    • Lsn

      Lsn(Long sequence)
  • Method Details

    • of

      public static Lsn of(String sequence)
      Creates an LSN object from a logical log sequence number's string representation.
      Parameters:
      sequence - - signed long integer string. We consider "NULL" and "-1L" as same as "new Lsn(-1)".
      Returns:
      LSN converted from its textual representation
    • of

      public static Lsn of(Long sequence)
      Creates an LSN object from a logical log sequence number.
      Parameters:
      sequence - logical sequence number
      Returns:
      LSN representing the given sequence number
    • of

      public static Lsn of(long loguniq, long logpos)
      Creates an LSN from a logical log file unique id and position within the log file. The unique id is an integer that goes in the upper 32 bits of the 64 bit sequence number. The log position is a 32 bit address within the log file and goes in the lower 32 bits of the sequence number.
      Parameters:
      loguniq - unique id of the logical log page
      logpos - position within the logical log page
      Returns:
      LSN representing the given log file unique id and position within the log file
    • isAvailable

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

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

      public String toLongString()
      Return the LSN String for an official representation, like "LSN(7,8a209c)". Reference Informix 11.70 CDC API Programmer's Guide page 62 for more details.
      Returns:
      official textual representation of LSN.
    • logpos

      public long logpos()
      32bit position within the current log page
    • loguniq

      public long loguniq()
      32bit log page unique identifier
    • sequence

      public long sequence()
    • 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>