Class ValueRecord
- java.lang.Object
-
- com.linkedin.davinci.store.record.ValueRecord
-
public class ValueRecord extends java.lang.ObjectThis class provides the following functionalities: 1. Concatenate schema id and data array to produce a big binary array, which will be stored in DB; 2. Parse the binary array stored in DB into schema id and data array; Right now, the concatenation part will allocate a new byte array and copy over schema id and data, which might cause some GC issue since this operation will be triggered for every 'PUT'. If this issue happens, we need to consider other ways to improve it: 1. Maybe we can do the concatenation in VeniceWriter, which is being used by VenicePushJob; 2. Investigate whether DB can accept multiple binary arrays for 'PUT' operation; 3. ... For deserialization part, this class is using Netty SlicedByteBuf, which will be backed by the same byte array, and intelligently takes care of the offset.
-
-
Field Summary
Fields Modifier and Type Field Description static intSCHEMA_HEADER_LENGTH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValueRecordcreate(int schemaId, byte[] data)static ValueRecordcreate(int schemaId, io.netty.buffer.ByteBuf data)io.netty.buffer.ByteBufgetData()byte[]getDataInBytes()intgetDataSize()intgetSchemaId()static ValueRecordparseAndCreate(byte[] combinedData)static io.netty.buffer.ByteBufparseDataAsByteBuf(byte[] combinedData)static java.nio.ByteBufferparseDataAsNIOByteBuffer(byte[] combinedData)static intparseSchemaId(byte[] combinedData)byte[]serialize()
-
-
-
Field Detail
-
SCHEMA_HEADER_LENGTH
public static final int SCHEMA_HEADER_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static ValueRecord create(int schemaId, byte[] data)
-
create
public static ValueRecord create(int schemaId, io.netty.buffer.ByteBuf data)
-
parseAndCreate
public static ValueRecord parseAndCreate(byte[] combinedData)
-
parseSchemaId
public static int parseSchemaId(byte[] combinedData)
-
parseDataAsByteBuf
public static io.netty.buffer.ByteBuf parseDataAsByteBuf(byte[] combinedData)
-
parseDataAsNIOByteBuffer
public static java.nio.ByteBuffer parseDataAsNIOByteBuffer(byte[] combinedData)
-
getSchemaId
public int getSchemaId()
-
getData
public io.netty.buffer.ByteBuf getData()
-
getDataSize
public int getDataSize()
-
getDataInBytes
public byte[] getDataInBytes()
-
serialize
public byte[] serialize()
-
-