public class RecordV1Serializer extends Object implements RecordSerializer
WALRecord.RecordType.index()
incremented by 1Modifier and Type | Field and Description |
---|---|
static int |
CRC_SIZE
Length of CRC value
|
static int |
FILE_WAL_POINTER_SIZE
Length of WAL Pointer: Index (8) + File offset (4).
|
static int |
HEADER_RECORD_SIZE
Total length of HEADER record.
|
static int |
REC_TYPE_SIZE
Length of Type
|
static boolean |
skipCrc
Skip CRC calculation/check flag
|
Constructor and Description |
---|
RecordV1Serializer(RecordDataV1Serializer dataSerializer,
boolean writePointer,
boolean marshalledMode,
boolean skipPositionCheck,
IgniteBiPredicate<WALRecord.RecordType,WALPointer> recordFilter)
Create an instance of V1 serializer.
|
Modifier and Type | Method and Description |
---|---|
static void |
putPosition(ByteBuffer buf,
WALPointer ptr)
Saves position, WAL pointer (requires
FILE_WAL_POINTER_SIZE bytes) |
static WALPointer |
readPosition(DataInput in) |
WALRecord |
readRecord(FileInput in0,
WALPointer expPtr)
Loads record from input
|
static SegmentHeader |
readSegmentHeader(SegmentIO io,
SegmentFileInputFactory segmentFileInputFactory)
Reads stored record from provided
io . |
int |
size(WALRecord record)
Calculates record size in byte including expected wal pointer, CRC and type field
|
int |
version() |
boolean |
writePointer()
Flag to write (or not) wal pointer to record
|
void |
writeRecord(WALRecord rec,
ByteBuffer buf) |
public static final int REC_TYPE_SIZE
public static final int FILE_WAL_POINTER_SIZE
public static final int CRC_SIZE
public static final int HEADER_RECORD_SIZE
public static boolean skipCrc
public RecordV1Serializer(RecordDataV1Serializer dataSerializer, boolean writePointer, boolean marshalledMode, boolean skipPositionCheck, IgniteBiPredicate<WALRecord.RecordType,WALPointer> recordFilter)
dataSerializer
- V1 data serializer.writePointer
- Write pointer.marshalledMode
- Marshalled mode.skipPositionCheck
- Skip position check mode.recordFilter
- Record type filter. FilteredRecord
is deserialized instead of original recordpublic int version()
version
in interface RecordSerializer
public boolean writePointer()
writePointer
in interface RecordSerializer
public void writeRecord(WALRecord rec, ByteBuffer buf) throws IgniteCheckedException
writeRecord
in interface RecordSerializer
rec
- Entry to write.buf
- Buffer.IgniteCheckedException
public WALRecord readRecord(FileInput in0, WALPointer expPtr) throws IOException, IgniteCheckedException
readRecord
in interface RecordSerializer
in0
- Data input to read data from.expPtr
- expected WAL pointer for record. Used to validate actual position against expected from the fileIOException
IgniteCheckedException
public int size(WALRecord record) throws IgniteCheckedException
size
in interface RecordSerializer
record
- Record.IgniteCheckedException
public static void putPosition(ByteBuffer buf, WALPointer ptr)
FILE_WAL_POINTER_SIZE
bytes)buf
- Byte buffer to serialize version to.ptr
- File WAL pointer to write.public static SegmentHeader readSegmentHeader(SegmentIO io, SegmentFileInputFactory segmentFileInputFactory) throws IgniteCheckedException, IOException
io
.
NOTE: Method mutates position of io
.io
- I/O interface for file.segmentFileInputFactory
- File input factory.SegmentHeader
extracted from the file.IgniteCheckedException
- If failed to read serializer version.IOException
public static WALPointer readPosition(DataInput in) throws IOException
in
- Data input to read pointer from.IOException
- If failed to write.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021