Package org.postgresql.replication
Class LogSequenceNumber
- java.lang.Object
-
- org.postgresql.replication.LogSequenceNumber
-
- All Implemented Interfaces:
java.lang.Comparable<LogSequenceNumber>
public final class LogSequenceNumber extends java.lang.Object implements java.lang.Comparable<LogSequenceNumber>
LSN (Log Sequence Number) data which is a pointer to a location in the XLOG.
-
-
Field Summary
Fields Modifier and Type Field Description static LogSequenceNumberINVALID_LSNZero is used indicate an invalid pointer.private longvalue
-
Constructor Summary
Constructors Modifier Constructor Description privateLogSequenceNumber(long value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longasLong()java.lang.StringasString()intcompareTo(LogSequenceNumber o)booleanequals(java.lang.Object o)inthashCode()java.lang.StringtoString()static LogSequenceNumbervalueOf(long value)static LogSequenceNumbervalueOf(java.lang.String strValue)Create LSN instance by string represent LSN.
-
-
-
Field Detail
-
INVALID_LSN
public static final LogSequenceNumber INVALID_LSN
Zero is used indicate an invalid pointer. Bootstrap skips the first possible WAL segment, initializing the first WAL page at XLOG_SEG_SIZE, so no XLOG record can begin at zero.
-
value
private final long value
-
-
Method Detail
-
valueOf
public static LogSequenceNumber valueOf(long value)
- Parameters:
value- numeric represent position in the write-ahead log stream- Returns:
- not null LSN instance
-
valueOf
public static LogSequenceNumber valueOf(java.lang.String strValue)
Create LSN instance by string represent LSN.- Parameters:
strValue- not null string as two hexadecimal numbers of up to 8 digits each, separated by a slash. For example16/3002D50,0/15D68C50- Returns:
- not null LSN instance where if specified string represent have not valid form
INVALID_LSN
-
asLong
public long asLong()
- Returns:
- Long represent position in the write-ahead log stream
-
asString
public java.lang.String asString()
- Returns:
- String represent position in the write-ahead log stream as two hexadecimal numbers of
up to 8 digits each, separated by a slash. For example
16/3002D50,0/15D68C50
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(LogSequenceNumber o)
- Specified by:
compareToin interfacejava.lang.Comparable<LogSequenceNumber>
-
-