iamaleksey commented on code in PR #2982:
URL: https://github.com/apache/cassandra/pull/2982#discussion_r1450585747
##########
src/java/org/apache/cassandra/service/accord/AccordJournal.java:
##########
@@ -711,43 +1255,57 @@ static abstract class AuxiliaryRecord
abstract Type type();
}
- /*
- * Placeholder for future record.
- */
- static final class ReplayRecord extends AuxiliaryRecord
+ static final class FrameRecord extends AuxiliaryRecord
{
- ReplayRecord(Timestamp timestamp)
+ final Pointer[] pointers;
+
+ FrameRecord(Timestamp timestamp, Pointer[] pointers)
{
super(timestamp);
+ this.pointers = pointers;
}
@Override
Type type()
{
- return Type.REPLAY;
+ return Type.FRAME;
}
- static final ValueSerializer<Key, ReplayRecord> SERIALIZER = new
ValueSerializer<Key, ReplayRecord>()
+ static final ValueSerializer<Key, FrameRecord> SERIALIZER = new
ValueSerializer<>()
{
@Override
- public int serializedSize(Key key, ReplayRecord record, int
userVersion)
+ public int serializedSize(Key key, FrameRecord frame, int
userVersion)
{
- return 0;
+ int size = computeUnsignedVIntSize(frame.pointers.length);
+ for (Pointer pointer : frame.pointers)
+ size += pointer.serializedSize();
+ return size;
}
@Override
- public void serialize(Key key, ReplayRecord record, DataOutputPlus
out, int userVersion)
+ public void serialize(Key key, FrameRecord frame, DataOutputPlus
out, int userVersion) throws IOException
{
+ out.writeUnsignedVInt32(frame.pointers.length);
+ for (Pointer pointer : frame.pointers)
+ pointer.serialize(out);
}
@Override
- public ReplayRecord deserialize(Key key, DataInputPlus in, int
userVersion)
+ public FrameRecord deserialize(Key key, DataInputPlus in, int
userVersion) throws IOException
{
- return new ReplayRecord(key.timestamp);
+ int count = in.readUnsignedVInt32();
+ Pointer[] pointers = new Pointer[count];
+ for (int i = 0; i < count; i++)
+ pointers[i] = Pointer.deserialize(in);
+ return new FrameRecord(key.timestamp, pointers);
}
};
}
+ /*
+ * Message provider implementation
+ */
+
Review Comment:
Intended, a comment for the next section of the file, not a particular
method or class.
--
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]