dcapwell commented on code in PR #4362:
URL: https://github.com/apache/cassandra/pull/4362#discussion_r2326272823
##########
src/java/org/apache/cassandra/service/accord/txn/TxnUpdate.java:
##########
@@ -77,13 +92,325 @@
public class TxnUpdate extends AccordUpdate
{
- private static final long EMPTY_SIZE = ObjectSizes.measure(new
TxnUpdate(TableMetadatas.none(), null, new ByteBuffer[0], null, null,
PreserveTimestamp.no));
+ static class ConditionalBlock
+ {
+ public static final UnversionedSerializer<ConditionalBlock> serializer
= new UnversionedSerializer<>()
+ {
+ @Override
+ public void serialize(ConditionalBlock t, DataOutputPlus out)
throws IOException
+ {
+ out.writeUnsignedVInt32(t.id);
+ if (t.condition != null)
+ {
+ writeWithVIntLength(t.condition.bytes(), out);
+ }
+ else
+ {
+ out.writeUnsignedVInt32(0);
+ }
+ serializeArrayUnsignedVInt(t.fragments, out);
+ }
+
+ @Override
+ public ConditionalBlock deserialize(DataInputPlus in) throws
IOException
+ {
+ int id = in.readUnsignedVInt32();
+ ByteBuffer conditionBytes = readWithVIntLength(in);
+ SerializedTxnCondition condition = conditionBytes.remaining()
> 0
+ ? new
SerializedTxnCondition(conditionBytes)
+ : null;
+
+ // Deserialize mutations
+ int[] mutations = deserializeArrayUnsignedVInt(in);
+ return new ConditionalBlock(id, condition, mutations);
+ }
+
+ @Override
+ public void skip(DataInputPlus in) throws IOException
+ {
+ in.readUnsignedVInt32();
+ skipWithVIntLength(in);
+ skipArrayUnsignedVInt(in);
+ }
+
+ @Override
+ public long serializedSize(ConditionalBlock t)
+ {
+ long size = TypeSizes.sizeofUnsignedVInt(t.id);
+ if (t.condition != null)
+ {
+ size += serializedSizeWithVIntLength(t.condition.bytes());
+ }
+ else
+ {
+ size += TypeSizes.sizeofUnsignedVInt(0);
+ }
+ size += serializedArrayUnsignedVIntSize(t.fragments);
+ return size;
+ }
+ };
+ final int id;
Review Comment:
code has changed a lot since this comment, i assume you changed this in your
feedback branch? I assume you wanted a newline above this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]