szetszwo commented on a change in pull request #205: HDDS-2386. Implement
incremental ChunkBuffer.
URL: https://github.com/apache/hadoop-ozone/pull/205#discussion_r350882590
##########
File path:
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/ChunkBuffer.java
##########
@@ -21,12 +21,27 @@
import java.nio.ByteBuffer;
import java.util.function.Function;
+import java.util.function.Supplier;
/** Buffer for a block chunk. */
public interface ChunkBuffer {
/** Similar to {@link ByteBuffer#allocate(int)}. */
static ChunkBuffer allocate(int capacity) {
+ return allocate(capacity, null);
+ }
+
+ /**
+ * Similar to {@link ByteBuffer#allocate(int)}
+ * except that it can specify the increment.
+ *
+ * @param increment the increment size so that
+ * the entire buffer is allocated incrementally.
+ */
+ static ChunkBuffer allocate(int capacity, Integer increment) {
Review comment:
Yes, when passing increment = null, it will fallback to the older
implementation. Passing -1 also work except that -1 becomes a special value.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]