org.apache.ignite.internal.processors.cache.persistence.wal.serializer

## Class RecordDataV1Serializer

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordDataV1Serializer

All Implemented Interfaces:
  RecordDataSerializer

Direct Known Subclasses:
  RecordDataV2Serializer

    public class RecordDataV1Serializer
    extends Object
    implements RecordDataSerializer

Record data V1 serializer.

### Nested Class Summary

Nested Classes
`static class` `RecordDataV1Serializer.EncryptedDataEntry` Represents encrypted Data Entry (`DataEntry.key`, `value`) pair.

### Field Summary

Fields
`protected GridCacheSharedContext` `cctx` Cache shared context.
`protected IgniteCacheObjectProcessor` `co` Cache object processor to reading `DataEntries`.
`protected int` `pageSize` Size of page used for PageMemory regions.
`protected int` `realPageSize` Size of page without encryption overhead.

### Constructor Summary

Constructors
Constructor and Description
`RecordDataV1Serializer(GridCacheSharedContext cctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`GridCacheSharedContext` `cctx()` Return shared cache context.
`protected int` `dataSize(DataRecord dataRec)`
`protected int` `entrySize(DataEntry entry)`
`WALRecord` `readRecord(WALRecord.RecordType type, ByteBufferBackedDataInput in, int size)` Reads record data of `type` from buffer `in`.
`int` `size(WALRecord record)` Calculates size of record data.
`void` `writeRecord(WALRecord rec, ByteBuffer buf)` Writes record data to buffer `buf`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### cctx

    protected final GridCacheSharedContext cctx

Cache shared context.

#### pageSize

    protected final int pageSize

Size of page used for PageMemory regions.

#### realPageSize

    protected final int realPageSize

Size of page without encryption overhead.

#### co

    protected final IgniteCacheObjectProcessor co

Cache object processor to reading `DataEntries`.

### Constructor Detail

#### RecordDataV1Serializer

    public RecordDataV1Serializer(GridCacheSharedContext cctx)

Parameters:
  `cctx` - Cache shared context.

### Method Detail

#### size

    public int size(WALRecord record)
             throws IgniteCheckedException

Calculates size of record data.

Specified by:
  `size` in interface `RecordDataSerializer`
Parameters:
  `record` - WAL record.
Returns:
  Size of record in bytes.
Throws:
  `IgniteCheckedException` - If it's unable to calculate record data size.

#### readRecord

    public WALRecord readRecord(WALRecord.RecordType type,
                                ByteBufferBackedDataInput in,
                                int size)
                         throws IOException,
                                IgniteCheckedException

Reads record data of `type` from buffer `in`.

Specified by:
  `readRecord` in interface `RecordDataSerializer`
Parameters:
  `type` - Record type.
  `in` - Buffer to read.
  `size` - Record size (0 if unknown).
Returns:
  WAL record.
Throws:
  `IOException` - In case of I/O problems.
  `IgniteCheckedException` - If it's unable to read record.

#### writeRecord

    public void writeRecord(WALRecord rec,
                            ByteBuffer buf)
                     throws IgniteCheckedException

Writes record data to buffer `buf`.

Specified by:
  `writeRecord` in interface `RecordDataSerializer`
Parameters:
  `rec` - WAL record.
  `buf` - Buffer to write.
Throws:
  `IgniteCheckedException` - If it's unable to write record.

#### cctx

    public GridCacheSharedContext cctx()

Return shared cache context.

Returns:
  Shared cache context.

#### dataSize

    protected int dataSize(DataRecord dataRec)
                    throws IgniteCheckedException

Parameters:
  `dataRec` - Data record to serialize.
Returns:
  Full data record size.
Throws:
  `IgniteCheckedException` - If failed to obtain the length of one of the entries.

#### entrySize

    protected int entrySize(DataEntry entry)
                     throws IgniteCheckedException

Parameters:
  `entry` - Entry to get size for.
Returns:
  Entry size.
Throws:
  `IgniteCheckedException` - If failed to get key or value bytes length.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022