Class AdminOperationSerializer
java.lang.Object
com.linkedin.venice.controller.kafka.protocol.serializer.AdminOperationSerializer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(ByteBuffer byteBuffer, int writerSchemaId) static org.apache.avro.Schema
getSchema
(int schemaId) byte[]
serialize
(AdminOperation object, int targetSchemaId) Serialize AdminOperation object to bytes[] with the writer schema
-
Field Details
-
LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION
public static final int LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION
-
-
Constructor Details
-
AdminOperationSerializer
public AdminOperationSerializer()
-
-
Method Details
-
serialize
Serialize AdminOperation object to bytes[] with the writer schema- Parameters:
object
- AdminOperation objecttargetSchemaId
- writer schema id that we will refer to for serialization and deserializationIf targetSchemaId equals LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION, return the bytes[] from the first serialization. Otherwise, serialize the object to the writer schema (lower version).
This involves:
- Serializing the object to a GenericRecord with the latest schema.
- Deserializing it to a GenericRecord with the writer schema.
- Serializing it to bytes.
This process ensures the object is serialized to the lower schema version. The normal serialization process may fail (ClassCastException) due to:
- Differences in field types
- New fields added in the middle of the schema instead of at the end
-
deserialize
-
initProtocolMap
-
getSchema
public static org.apache.avro.Schema getSchema(int schemaId)
-