public class LogEntryHeader extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CHECKSUM_BYTES |
static int |
ENTRYTYPE_OFFSET |
static int |
MAX_HEADER_SIZE |
static int |
MIN_HEADER_SIZE
Persistent fields.
|
static int |
VLSN_OFFSET |
| Constructor and Description |
|---|
LogEntryHeader(ByteBuffer entryBuffer,
int logVersion,
long lsn)
For reading a log entry.
|
LogEntryHeader(byte entryType,
int entryVersion,
int itemSize,
VLSN vlsn)
For reading a replication message.
|
LogEntryHeader(LogEntry entry,
Provisional provisional,
ReplicationContext repContext)
For writing a log header.
|
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
addPostMarshallingInfo(ByteBuffer entryBuffer,
long lastOffset,
VLSN vlsn)
Add those parts of the header that must be calculated later to the
entryBuffer, and also assign the fields in this class.
|
void |
dumpLog(StringBuilder sb,
boolean verbose) |
void |
dumpRep(StringBuilder sb) |
long |
getChecksum() |
int |
getEntrySize() |
int |
getItemSize() |
long |
getPrevOffset() |
Provisional |
getProvisional() |
boolean |
getReplicated() |
int |
getSize() |
byte |
getType() |
int |
getVariablePortionSize() |
int |
getVersion() |
VLSN |
getVLSN() |
boolean |
hasChecksum() |
boolean |
isErased()
Returns whether the type of this entry has been changed to LOG_ERASED.
|
boolean |
isInvisible() |
boolean |
isVariableLength()
May be called after reading MIN_HEADER_SIZE bytes to determine
whether more bytes (getVariablePortionSize) should be read.
|
boolean |
logicalEqualsIgnoreVersion(LogEntryHeader other) |
void |
readVariablePortion(ByteBuffer entryBuffer)
Assumes this is called directly after the constructor, and that the
entryBuffer is positioned right before the VLSN.
|
void |
setFileHeaderVersion(int logVersion)
Called to set the version for a file header entry after reading the
version from the item data.
|
String |
toString() |
static void |
turnOffInvisible(ByteBuffer buffer,
int logHeaderStartPosition)
Turn off the invisible bit in the byte buffer which backs this log entry
header.
|
void |
writeToLog(ByteBuffer entryBuffer)
Serialize this object into the buffer and leave the buffer positioned in
the right place to write the following item.
|
public static final int MIN_HEADER_SIZE
public static final int MAX_HEADER_SIZE
public static final int CHECKSUM_BYTES
public static final int ENTRYTYPE_OFFSET
public static final int VLSN_OFFSET
public LogEntryHeader(ByteBuffer entryBuffer, int logVersion, long lsn) throws ChecksumException
entryBuffer - the buffer containing at least the first
MIN_HEADER_SIZE bytes of the entry header.logVersion - is the log version of the file that contains the given
buffer, and is obtained from the file header. Note that for the file
header entry itself, UNKNOWN_FILE_HEADER_VERSION may be passed.lsn - is the LSN of the entry, for exception reporting.ChecksumExceptionpublic LogEntryHeader(LogEntry entry, Provisional provisional, ReplicationContext repContext)
public LogEntryHeader(byte entryType,
int entryVersion,
int itemSize,
VLSN vlsn)
public void setFileHeaderVersion(int logVersion)
public long getChecksum()
public byte getType()
public int getVersion()
public long getPrevOffset()
public int getItemSize()
public int getEntrySize()
public VLSN getVLSN()
public boolean getReplicated()
public Provisional getProvisional()
public boolean isInvisible()
public boolean isErased()
ErasedLogEntry,
DataEraserpublic boolean hasChecksum()
public int getVariablePortionSize()
public int getSize()
public void readVariablePortion(ByteBuffer entryBuffer)
public void writeToLog(ByteBuffer entryBuffer)
public ByteBuffer addPostMarshallingInfo(ByteBuffer entryBuffer, long lastOffset, VLSN vlsn)
public void dumpLog(StringBuilder sb, boolean verbose)
sb - destination string bufferverbose - if true, dump the full, verbose versionpublic void dumpRep(StringBuilder sb)
public boolean logicalEqualsIgnoreVersion(LogEntryHeader other)
public boolean isVariableLength()
public static void turnOffInvisible(ByteBuffer buffer, int logHeaderStartPosition)
logHeaderStartPosition - the byte position of the start of the log
entry header.Copyright © 2024. All rights reserved.