AMashenkov commented on a change in pull request #191: URL: https://github.com/apache/ignite-3/pull/191#discussion_r674721820
########## File path: modules/client-common/src/main/java/org/apache/ignite/client/ClientMessagePacker.java ########## @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.client; + +import org.msgpack.core.MessageBufferPacker; +import org.msgpack.core.MessagePack; +import org.msgpack.core.buffer.ArrayBufferOutput; + +import java.io.IOException; +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.BitSet; +import java.util.UUID; + +/** + * Ignite-specific MsgPack extension. + */ +public class ClientMessagePacker extends MessageBufferPacker { + /** + * Constructor. + */ + public ClientMessagePacker() { + // TODO: Pooled buffers IGNITE-15162. + super(new ArrayBufferOutput(), MessagePack.DEFAULT_PACKER_CONFIG); + } + + /** + * Writes an UUID. + * + * @param val UUID value. + * @return This instance. + * @throws IOException when underlying output throws IOException. + */ + public ClientMessagePacker packUuid(UUID val) throws IOException { + packExtensionTypeHeader(ClientMsgPackType.UUID, 16); + + var bytes = new byte[16]; + ByteBuffer bb = ByteBuffer.wrap(bytes); + bb.order(ByteOrder.BIG_ENDIAN); Review comment: We use LittleEndianess for direct memory IO and storage. Does it nake sense to have same endianess for transport as well? -- 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]
