Class ValueRecord
- java.lang.Object
-
- com.linkedin.davinci.store.record.ValueRecord
-
public class ValueRecord extends java.lang.Object
This 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 int
SCHEMA_HEADER_LENGTH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValueRecord
create(int schemaId, byte[] data)
static ValueRecord
create(int schemaId, io.netty.buffer.ByteBuf data)
io.netty.buffer.ByteBuf
getData()
byte[]
getDataInBytes()
int
getDataSize()
int
getSchemaId()
static ValueRecord
parseAndCreate(byte[] combinedData)
static io.netty.buffer.ByteBuf
parseDataAsByteBuf(byte[] combinedData)
static java.nio.ByteBuffer
parseDataAsNIOByteBuffer(byte[] combinedData)
static int
parseSchemaId(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()
-
-