Class MergeByteBuffer
java.lang.Object
com.linkedin.davinci.replication.merge.MergeByteBuffer
- All Implemented Interfaces:
Merge<ByteBuffer>
This class handles byte-level merge. Each byte buffer has only one (value-level) timestamp. DCR happens only at the
whole byte buffer level. Specifically, given 2 byte buffers to merge, only one of them will win completely.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondelete(ValueAndRmd<ByteBuffer> oldValueAndRmd, long deleteOperationTimestamp, int deleteOperationColoID) protected ValueAndRmd<ByteBuffer>deleteWithValueLevelTimestamp(long oldTimestamp, long deleteOperationTimestamp, ValueAndRmd<ByteBuffer> oldValueAndRmd) put(ValueAndRmd<ByteBuffer> oldValueAndRmd, ByteBuffer newValue, long putOperationTimestamp, int writeOperationColoID) protected ValueAndRmd<ByteBuffer>putWithRecordLevelTimestamp(long oldTimestamp, ValueAndRmd<ByteBuffer> oldValueAndRmd, long putOperationTimestamp, ByteBuffer newValue) update(ValueAndRmd<ByteBuffer> oldValueAndRmd, Lazy<org.apache.avro.generic.GenericRecord> writeOperation, org.apache.avro.Schema currValueSchema, long updateOperationTimestamp, int updateOperationColoID) protected voidupdateReplicationCheckpointVector(org.apache.avro.generic.GenericRecord oldRmd)
-
Constructor Details
-
MergeByteBuffer
public MergeByteBuffer()
-
-
Method Details
-
put
public ValueAndRmd<ByteBuffer> put(ValueAndRmd<ByteBuffer> oldValueAndRmd, ByteBuffer newValue, long putOperationTimestamp, int writeOperationColoID) - Parameters:
oldValueAndRmd- the old value and replication metadata which are persisted in the server prior to the write operation. Note that some implementation(s) may require the old value to be non-null. Please refer to the Javadoc of specific implementation.newValue- a record with all fields populated and with one of the registered value schemasputOperationTimestamp- the timestamp of the incoming write operationwriteOperationColoID- ID of the colo/fabric where this PUT request was originally received.- Returns:
- the resulting
ValueAndRmdafter merging the old one with the incoming write operation. The returned object is guaranteed to be "==" to the input oldValueAndReplicationMetadata object and the internal members of the object are possibly mutated.
-
delete
public ValueAndRmd<ByteBuffer> delete(ValueAndRmd<ByteBuffer> oldValueAndRmd, long deleteOperationTimestamp, int deleteOperationColoID) - Parameters:
oldValueAndRmd- the old value and replication metadata which are persisted in the server prior to the write operationdeleteOperationTimestamp- the timestamp of the incoming delete operationdeleteOperationColoID- ID of the colo/fabric where this DELETE request was originally received.- Returns:
- the resulting
ValueAndRmdafter merging the old one with the incoming delete operation. The returned object is guaranteed to be "==" to the input oldValueAndReplicationMetadata object and the internal members of the object are possibly mutated.
-
update
public ValueAndRmd<ByteBuffer> update(ValueAndRmd<ByteBuffer> oldValueAndRmd, Lazy<org.apache.avro.generic.GenericRecord> writeOperation, org.apache.avro.Schema currValueSchema, long updateOperationTimestamp, int updateOperationColoID) - Parameters:
oldValueAndRmd- the old value and replication metadata which are persisted in the server prior to the write operationwriteOperation- a record with a write compute schemacurrValueSchema- Schema of the current value that is to-be-updated here.updateOperationTimestamp- the timestamp of the incoming write operationupdateOperationColoID- ID of the colo/fabric where this UPDATE request was originally received.- Returns:
- the resulting
ValueAndRmdafter merging the old one with the incoming write operation. The returned object is guaranteed to be "==" to the input oldValueAndReplicationMetadata object and the internal members of the object are possibly mutated.
-
putWithRecordLevelTimestamp
protected ValueAndRmd<ByteBuffer> putWithRecordLevelTimestamp(long oldTimestamp, ValueAndRmd<ByteBuffer> oldValueAndRmd, long putOperationTimestamp, ByteBuffer newValue) -
deleteWithValueLevelTimestamp
protected ValueAndRmd<ByteBuffer> deleteWithValueLevelTimestamp(long oldTimestamp, long deleteOperationTimestamp, ValueAndRmd<ByteBuffer> oldValueAndRmd) -
updateReplicationCheckpointVector
protected void updateReplicationCheckpointVector(org.apache.avro.generic.GenericRecord oldRmd)
-