zstan commented on a change in pull request #330:
URL: https://github.com/apache/ignite-3/pull/330#discussion_r707954244
##########
File path:
modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessagePacker.java
##########
@@ -325,6 +326,33 @@ public ClientMessagePacker packUuid(UUID val) {
return this;
}
+ /**
+ * Writes an {@link IgniteUuid}.
+ *
+ * @param val {@link IgniteUuid} value.
+ * @return This instance.
+ */
+ public ClientMessagePacker packIgniteUuid(IgniteUuid val) {
+ assert !closed : "Packer is closed";
+
+ packExtensionTypeHeader(ClientMsgPackType.IGNITE_UUID, 24);
+
+ // TODO: Pack directly to ByteBuf without allocating IGNITE-15234.
+ var bytes = new byte[24];
+ ByteBuffer bb = ByteBuffer.wrap(bytes);
+
+ UUID globalId = val.globalId();
+
+ bb.putLong(globalId.getMostSignificantBits());
+ bb.putLong(globalId.getLeastSignificantBits());
+
+ bb.putLong(val.localId());
+
+ writePayload(bytes);
+
+ return this;
Review comment:
```suggestion
ByteBuffer bb = ByteBuffer.allocate(24);
UUID globalId = val.globalId();
bb.putLong(globalId.getMostSignificantBits());
bb.putLong(globalId.getLeastSignificantBits());
bb.putLong(val.localId());
bb.flip();
writePayload(bb.array());
```
why do we need byte[] wrapping ? more compact ^
--
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]