You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/08/06 18:51:35 UTC

[GitHub] [ignite-3] ptupitsyn commented on a change in pull request #263: IGNITE-15224 Thin 3.0: Implement Table API operations

ptupitsyn commented on a change in pull request #263:
URL: https://github.com/apache/ignite-3/pull/263#discussion_r684440953



##########
File path: modules/client-common/src/main/java/org/apache/ignite/client/proto/ClientMessagePacker.java
##########
@@ -60,29 +63,250 @@ public ClientMessagePacker(ByteBuf buf) {
      * Gets the underlying buffer.
      *
      * @return Underlying buffer.
-     * @throws IgniteException When flush fails.
+     * @throws UncheckedIOException When flush fails.
      */
     public ByteBuf getBuffer() {
         try {
             flush();
         }
         catch (IOException e) {
-            throw new IgniteException(e);
+            throw new UncheckedIOException(e);
         }
 
         buf.setInt(0, buf.writerIndex() - HEADER_SIZE);
 
         return buf;
     }
 
+    /** {@inheritDoc} */
+    @Override public MessagePacker packNil() {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packNil();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packBoolean(boolean b) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packBoolean(b);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packByte(byte b) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packByte(b);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packShort(short v) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packShort(v);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packInt(int r) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packInt(r);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packLong(long v) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packLong(v);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packBigInteger(BigInteger bi) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packBigInteger(bi);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packFloat(float v) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packFloat(v);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packDouble(double v) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packDouble(v);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packString(String s) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packString(s);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packArrayHeader(int arraySize) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packArrayHeader(arraySize);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packMapHeader(int mapSize) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packMapHeader(mapSize);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packValue(Value v) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packValue(v);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packExtensionTypeHeader(byte extType, int payloadLen) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packExtensionTypeHeader(extType, payloadLen);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packBinaryHeader(int len) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packBinaryHeader(len);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker packRawStringHeader(int len) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.packRawStringHeader(len);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker writePayload(byte[] src) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.writePayload(src);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker writePayload(byte[] src, int off, int len) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.writePayload(src, off, len);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker addPayload(byte[] src) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.addPayload(src);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public MessagePacker addPayload(byte[] src, int off, int len) {
+        assert !closed : "Packer is closed";
+
+        try {
+            return super.addPayload(src, off, len);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
     /**
      * Writes an UUID.
      *
      * @param val UUID value.
      * @return This instance.
-     * @throws IOException when underlying output throws IOException.
      */
-    public ClientMessagePacker packUuid(UUID val) throws IOException {
+    public ClientMessagePacker packUuid(UUID val) {

Review comment:
       Good point. Added TODO with a link to https://issues.apache.org/jira/browse/IGNITE-15234.
   We'll be able to write two longs directly to the underlying `ByteBuf` with those changes.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org