Search in sources :

Example 1 with RecordType

use of org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType in project ignite by apache.

the class RecordV1Serializer method readRecordType.

/**
 * Reads record type from given {@code in}.
 *
 * @param in Buffer to read record type.
 * @return Record type.
 * @throws IgniteCheckedException If logical end of segment is reached.
 * @throws IOException In case of I/O problems.
 */
static RecordType readRecordType(DataInput in) throws IgniteCheckedException, IOException {
    int type = in.readUnsignedByte();
    if (type == WALRecord.RecordType.STOP_ITERATION_RECORD_TYPE)
        throw new SegmentEofException("Reached logical end of the segment", null);
    RecordType recType = RecordType.fromOrdinal(type - 1);
    if (recType == null)
        throw new IOException("Unknown record type: " + type);
    return recType;
}
Also used : RecordType(org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType) SegmentEofException(org.apache.ignite.internal.processors.cache.persistence.wal.SegmentEofException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 RecordType (org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType)1 SegmentEofException (org.apache.ignite.internal.processors.cache.persistence.wal.SegmentEofException)1