You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by "leerho (via GitHub)" <gi...@apache.org> on 2024/06/11 21:59:07 UTC
[PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
leerho opened a new pull request, #190:
URL: https://github.com/apache/datasketches-memory/pull/190
Prepares the java 8,11 code-base for a 3.0.0 release.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho merged PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662903024
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java:
##########
@@ -35,67 +33,76 @@
/**
* Defines the read-only API for offset access to a resource.
*
- * <p>The classes in this package are not thread-safe.</p>
- *
* @author Lee Rhodes
*/
public interface Memory extends Resource {
//BYTE BUFFER
/**
- * Accesses the given <i>ByteBuffer</i> for read-only operations. The returned <i>Memory</i> object has
- * the same byte order, as the given <i>ByteBuffer</i>.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and with capacity ≥ 0.
+ * Provides a view of the given <i>ByteBuffer</i> for read-only operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>Memory</i> will use the <i>ByteOrder</i> of the <i>ByteBuffer</i>.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null.
* @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>.
*/
static Memory wrap(ByteBuffer byteBuffer) {
return wrap(byteBuffer, byteBuffer.order());
}
/**
- * Accesses the given <i>ByteBuffer</i> for read-only operations. The returned <i>Memory</i> object has
- * the given byte order, ignoring the byte order of the given <i>ByteBuffer</i> for future reads and writes.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and with capacity ≥ 0.
+ * Provides a view of the given <i>ByteBuffer</i> for read-only operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>Memory</i> will use the given <i>ByteOrder</i>,
+ * independent of the ByteOrder of the given ByteBuffer.
+ * This does not affect the ByteOrder of data already in the ByteBuffer.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null.
* @param byteOrder the byte order to be used. It must be non-null.
* @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>.
*/
static Memory wrap(ByteBuffer byteBuffer, ByteOrder byteOrder) {
- Objects.requireNonNull(byteBuffer, "byteBuffer must not be null");
- Objects.requireNonNull(byteOrder, "byteOrder must not be null");
- negativeCheck(byteBuffer.capacity(), "byteBuffer");
return BaseWritableMemoryImpl.wrapByteBuffer(byteBuffer, true, byteOrder, null);
}
+ //Duplicates make no sense here
+
//MAP
/**
- * Maps the entire given file into native-ordered <i>Memory</i> for read operations
+ * Maps the given file into <i>Memory</i> for read operations
* Calling this method is equivalent to calling
- * {@link #map(File, long, long, ByteOrder) map(file, 0, file.length(), ByteOrder.nativeOrder())}.
- * @param file the given file to map. It must be non-null, length ≥ 0, and readable.
+ * {@link #map(File, long, long, ByteOrder)
+ * map(file, 0, file.length(), scope, ByteOrder.nativeOrder())}.
+ * @param file the given file to map. It must be non-null with a non-negative length and readable.
* @return <i>Memory</i> for managing the mapped memory.
+ * @throws IllegalArgumentException if path is not associated with the default file system.
+ * @throws IllegalStateException if scope has been already closed, or if access occurs from a thread other than the thread owning scope.
+ * @throws IOException if the specified path does not point to an existing file, or if some other I/O error occurs.
+ * @throws SecurityException If a security manager is installed and it denies an unspecified permission
+ * required by the implementation.
*/
- static Memory map(File file) {
+ static Memory map(File file) throws IOException {
return map(file, 0, file.length(), ByteOrder.nativeOrder());
}
/**
* Maps the specified portion of the given file into <i>Memory</i> for read operations.
- * @param file the given file to map. It must be non-null and readable.
- * @param fileOffsetBytes the position in the given file in bytes. It must not be negative.
- * @param capacityBytes the size of the mapped memory. It must not be negative.
- * @param byteOrder the byte order to be used for the mapped memory. It must be non-null.
+ * @param file the given file to map. It must be non-null, readable and length ≥ 0.
+ * @param fileOffsetBytes the position in the given file in bytes. It must ≥ 0.
Review Comment:
will Fix.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662920700
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java:
##########
@@ -423,45 +430,58 @@ static final String toHex(final ResourceImpl state, final String preamble, final
sb.append("UnsafeObj, hashCode : ").append(uObjStr).append(LS);
sb.append("UnsafeObjHeader : ").append(uObjHeader).append(LS);
sb.append("ByteBuf, hashCode : ").append(bbStr).append(LS);
- sb.append("RegionOffset : ").append(state.getTotalOffset()).append(LS);
+ sb.append("RegionOffset : ").append(state.getRelativeOffset()).append(LS);
+ if (ResourceImpl.isBuffer(state.typeId)) {
+ sb.append("Start : ").append(((PositionalImpl)state).getStart()).append(LS);
+ sb.append("Position : ").append(((PositionalImpl)state).getPosition()).append(LS);
+ sb.append("End : ").append(((PositionalImpl)state).getEnd()).append(LS);
+ }
sb.append("Capacity : ").append(capacity).append(LS);
sb.append("CumBaseOffset : ").append(cumBaseOffset).append(LS);
- sb.append("MemReq, hashCode : ").append(memReqStr).append(LS);
- sb.append("Valid : ").append(state.isValid()).append(LS);
+ sb.append("MemReqSvr, hashCode : ").append(memReqStr).append(LS);
+ sb.append("Valid : ").append(state.isAlive()).append(LS);
Review Comment:
Yes, and I will check the whole repo for this substitution.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662937023
##########
datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java:
##########
@@ -96,15 +96,15 @@ public void checkArrayWrap() {
assertEquals(v, i);
}
// check 0 length array wraps
- Memory memZeroLengthArrayBoolean = WritableMemory.writableWrap(new boolean[0]);
+ //Memory memZeroLengthArrayBoolean = WritableMemory.writableWrap(new boolean[0]);
Review Comment:
Will remove.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662899387
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java:
##########
@@ -35,67 +33,76 @@
/**
* Defines the read-only API for offset access to a resource.
*
- * <p>The classes in this package are not thread-safe.</p>
- *
* @author Lee Rhodes
*/
public interface Memory extends Resource {
//BYTE BUFFER
/**
- * Accesses the given <i>ByteBuffer</i> for read-only operations. The returned <i>Memory</i> object has
- * the same byte order, as the given <i>ByteBuffer</i>.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and with capacity ≥ 0.
+ * Provides a view of the given <i>ByteBuffer</i> for read-only operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>Memory</i> will use the <i>ByteOrder</i> of the <i>ByteBuffer</i>.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null.
* @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>.
*/
static Memory wrap(ByteBuffer byteBuffer) {
return wrap(byteBuffer, byteBuffer.order());
}
/**
- * Accesses the given <i>ByteBuffer</i> for read-only operations. The returned <i>Memory</i> object has
- * the given byte order, ignoring the byte order of the given <i>ByteBuffer</i> for future reads and writes.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and with capacity ≥ 0.
+ * Provides a view of the given <i>ByteBuffer</i> for read-only operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>Memory</i> will use the given <i>ByteOrder</i>,
+ * independent of the ByteOrder of the given ByteBuffer.
+ * This does not affect the ByteOrder of data already in the ByteBuffer.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null.
* @param byteOrder the byte order to be used. It must be non-null.
* @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>.
*/
static Memory wrap(ByteBuffer byteBuffer, ByteOrder byteOrder) {
- Objects.requireNonNull(byteBuffer, "byteBuffer must not be null");
- Objects.requireNonNull(byteOrder, "byteOrder must not be null");
- negativeCheck(byteBuffer.capacity(), "byteBuffer");
return BaseWritableMemoryImpl.wrapByteBuffer(byteBuffer, true, byteOrder, null);
}
+ //Duplicates make no sense here
+
//MAP
/**
- * Maps the entire given file into native-ordered <i>Memory</i> for read operations
+ * Maps the given file into <i>Memory</i> for read operations
* Calling this method is equivalent to calling
- * {@link #map(File, long, long, ByteOrder) map(file, 0, file.length(), ByteOrder.nativeOrder())}.
- * @param file the given file to map. It must be non-null, length ≥ 0, and readable.
+ * {@link #map(File, long, long, ByteOrder)
+ * map(file, 0, file.length(), scope, ByteOrder.nativeOrder())}.
Review Comment:
Yep. this is a javadoc comment bug and it occurred in 3 places. Will fix. I also searched the entire ds-memory repo for this bug and it is clean.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662924866
##########
datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.datasketches.memory.internal;
+
+import java.nio.ByteOrder;
+
+import org.apache.datasketches.memory.DefaultMemoryRequestServer;
+import org.apache.datasketches.memory.MemoryRequestServer;
+import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
+
+/**
+ * Example of how to use the MemoryRequestServer with a memory hungry client.
+ *
+ * <p>Note: this example only works with Java 17.</p>
Review Comment:
Not accurate. Removed. It works fine in Java8
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662915815
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java:
##########
@@ -33,120 +34,118 @@
/**
* Defines the writable API for offset access to a resource.
*
- * <p>The classes in this package are not thread-safe.</p>
- *
* @author Lee Rhodes
*/
public interface WritableMemory extends Memory {
//BYTE BUFFER
/**
- * Accesses the given <i>ByteBuffer</i> for write operations. The returned <i>WritableMemory</i> object has
- * the same byte order, as the given <i>ByteBuffer</i>.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null, with capacity ≥ 0, and writable.
+ * Provides a view of the given <i>ByteBuffer</i> for write operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>WritableMemory</i> will assume the <i>ByteOrder</i> of the given <i>ByteBuffer</i>.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and writable.
* @return a new <i>WritableMemory</i> for write operations on the given <i>ByteBuffer</i>.
*/
static WritableMemory writableWrap(ByteBuffer byteBuffer) {
- return writableWrap(byteBuffer, byteBuffer.order(), defaultMemReqSvr);
- }
-
- /**
- * Accesses the given <i>ByteBuffer</i> for write operations. The returned <i>WritableMemory</i> object has
- * the given byte order, ignoring the byte order of the given <i>ByteBuffer</i> for future writes and following reads.
- * However, this does not change the byte order of data already in the <i>ByteBuffer</i>.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null, with capacity ≥ 0, and writable.
- * @param byteOrder the byte order to be used. It must be non-null.
- * @return a new <i>WritableMemory</i> for write operations on the given <i>ByteBuffer</i>.
- */
- static WritableMemory writableWrap(ByteBuffer byteBuffer, ByteOrder byteOrder) {
- return writableWrap(byteBuffer, byteOrder, defaultMemReqSvr);
+ return writableWrap(byteBuffer, byteBuffer.order(), null);
}
/**
- * Accesses the given <i>ByteBuffer</i> for write operations. The returned <i>WritableMemory</i> object has
- * the given byte order, ignoring the byte order of the given <i>ByteBuffer</i> for future reads and writes.
- * However, this does not change the byte order of data already in the <i>ByteBuffer</i>.
- * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null, with capacity ≥ 0, and writable.
+ * Provides a view of the given <i>ByteBuffer</i> for write operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * The returned <i>WritableMemory</i> will use the given <i>ByteOrder</i>,
+ * independent of the ByteOrder of the given ByteBuffer.
+ * This does not affect the ByteOrder of data already in the ByteBuffer.
+ * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and writable.
* @param byteOrder the byte order to be used. It must be non-null.
* @param memReqSvr A user-specified <i>MemoryRequestServer</i>, which may be null.
* This is a callback mechanism for a user client to request a larger <i>WritableMemory</i>.
* @return a new <i>WritableMemory</i> for write operations on the given <i>ByteBuffer</i>.
+ * @throws IllegalArgumentException if ByteBuffer is not writable.
*/
- static WritableMemory writableWrap(ByteBuffer byteBuffer, ByteOrder byteOrder, MemoryRequestServer memReqSvr) {
- Objects.requireNonNull(byteBuffer, "byteBuffer must be non-null");
- Objects.requireNonNull(byteOrder, "byteOrder must be non-null");
- negativeCheck(byteBuffer.capacity(), "byteBuffer");
+ static WritableMemory writableWrap(
+ ByteBuffer byteBuffer,
+ ByteOrder byteOrder,
+ MemoryRequestServer memReqSvr) {
if (byteBuffer.isReadOnly()) { throw new ReadOnlyException("byteBuffer must be writable."); }
return BaseWritableMemoryImpl.wrapByteBuffer(byteBuffer, false, byteOrder, memReqSvr);
}
+ //Duplicates make no sense here
+
//MAP
/**
* Maps the entire given file into native-ordered WritableMemory for write operations
* Calling this method is equivalent to calling
* {@link #writableMap(File, long, long, ByteOrder) writableMap(file, 0, file.length(), ByteOrder.nativeOrder())}.
- * @param file the given file to map. It must be non-null, with length ≥ 0, and writable.
- * @return WritableMemory for managing the mapped Memory.
- */
- static WritableMemory writableMap(File file) {
+ * @param file the given file to map. It must be non-null and writable.
+ * @return a file-mapped WritableMemory
+ * @throws IllegalArgumentException if file is not readable or not writable.
+ * @throws IOException if the specified path does not point to an existing file, or if some other I/O error occurs.
+ * @throws SecurityException If a security manager is installed and it denies an unspecified permission
+ * required by the implementation.
+ */
+ static WritableMemory writableMap(File file) throws IOException {
return writableMap(file, 0, file.length(), ByteOrder.nativeOrder());
}
/**
* Maps the specified portion of the given file into Memory for write operations.
- *
- * <p><b>Note:</b> Always qualify this method with the class name, e.g.,
- * <i>WritableMemory.map(...)</i>.
- * @param file the given file to map. It must be non-null, writable and length ≥ 0.
- * @param fileOffsetBytes the position in the given file in bytes. It must not be negative.
- * @param capacityBytes the size of the mapped Memory. It must not be negative.
- * @param byteOrder the byte order to be used for the given file. It must be non-null.
- * @return WritableMemory for managing the mapped Memory.
- */
- static WritableMemory writableMap(File file, long fileOffsetBytes, long capacityBytes, ByteOrder byteOrder) {
- Objects.requireNonNull(file, "file must be non-null.");
- Objects.requireNonNull(byteOrder, "byteOrder must be non-null.");
+ * @param file the given file to map. It must be non-null and writable.
+ * @param fileOffsetBytes the position in the given file in bytes. It must be ≥ 0.
+ * @param capacityBytes the size of the mapped Memory. It must be ≥ 0.
+ * @param byteOrder the given <i>ByteOrder</i>. It must be non-null.
+ * @return a file-mapped WritableMemory.
+ * @throws IllegalArgumentException if file is not readable or not writable.
+ * @throws IOException if the specified path does not point to an existing file, or if some other I/O error occurs.
+ * @throws SecurityException If a security manager is installed and it denies an unspecified permission
+ * required by the implementation.
+ */
+ static WritableMemory writableMap(
+ File file,
+ long fileOffsetBytes,
+ long capacityBytes,
+ ByteOrder byteOrder) throws IOException {
if (!file.canWrite()) { throw new ReadOnlyException("file must be writable."); }
- negativeCheck(file.length(), "file.length()");
- negativeCheck(fileOffsetBytes, "fileOffsetBytes");
- negativeCheck(capacityBytes, "capacityBytes");
return BaseWritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, false, byteOrder);
}
//ALLOCATE DIRECT
+
/**
* Allocates and provides access to capacityBytes directly in native (off-heap) memory.
* Native byte order is assumed.
- * The allocated memory will be 8-byte aligned, but may not be page aligned.
+ * The allocated memory will be 8-byte aligned.
*
* <p><b>NOTE:</b> Native/Direct memory acquired may have garbage in it.
* It is the responsibility of the using application to clear this memory, if required,
* and to call <i>close()</i> when done.</p>
*
- * @param capacityBytes the size of the desired memory in bytes. It must be ≥ 0.
- * @return WritableMemory for this off-heap resource.
+ * @param capacityBytes the size of the desired memory in bytes.
+ * @return WritableMemory for this off-heap, native resource.
Review Comment:
In this specific context I meant native=off-heap, but it is equally valid to mean native byte-order! This double use of "native" bugs me. But the double use also exists in Panama. I'm not sure what to do about this. I could go through the entire repo and check for all uses of "native" and make sure the context is clear.
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "leerho (via GitHub)" <gi...@apache.org>.
leerho commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1663031529
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java:
##########
@@ -28,22 +28,31 @@
public interface MemoryRequestServer {
/**
- * Request new WritableMemory with the given capacity. The current Writable Memory will be used to
- * determine the byte order of the returned WritableMemory and other checks.
+ * Request new WritableMemory with the given newCapacityBytes. The current Writable Memory will be used to
+ * determine the byte order of the returned WritableMemory and other properties.
* @param currentWritableMemory the current writableMemory of the client. It must be non-null.
- * @param capacityBytes The capacity being requested. It must be ≥ 0.
+ * @param newCapacityBytes The capacity being requested. It must be > the capacity of the currentWritableMemory.
Review Comment:
Not with this interface, and never have. If you want a separate smaller memory, use the regular allocate methods for that. This is explicitly for the case where a sketch runs out of its allocated memory
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "jmalkin (via GitHub)" <gi...@apache.org>.
jmalkin commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1663011446
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java:
##########
@@ -28,22 +28,31 @@
public interface MemoryRequestServer {
/**
- * Request new WritableMemory with the given capacity. The current Writable Memory will be used to
- * determine the byte order of the returned WritableMemory and other checks.
+ * Request new WritableMemory with the given newCapacityBytes. The current Writable Memory will be used to
+ * determine the byte order of the returned WritableMemory and other properties.
* @param currentWritableMemory the current writableMemory of the client. It must be non-null.
- * @param capacityBytes The capacity being requested. It must be ≥ 0.
+ * @param newCapacityBytes The capacity being requested. It must be > the capacity of the currentWritableMemory.
Review Comment:
So we don't support the pattern of getting a smaller amount of additional memory while keeping the current memory?
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
Re: [PR] Prepare for java 8,11 3.0.0 [datasketches-memory]
Posted by "jmalkin (via GitHub)" <gi...@apache.org>.
jmalkin commented on code in PR #190:
URL: https://github.com/apache/datasketches-memory/pull/190#discussion_r1662915327
##########
datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java:
##########
@@ -19,52 +19,52 @@
package org.apache.datasketches.memory;
-import static org.apache.datasketches.memory.internal.Util.negativeCheck;
-
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.Objects;
import org.apache.datasketches.memory.internal.BaseWritableBufferImpl;
/**
* Defines the read-only API for relative positional access to a resource.
*
- * <p>The classes in this package are not thread-safe.</p>
- *
* @author Lee Rhodes
*/
-public interface Buffer extends BaseBuffer {
+public interface Buffer extends Positional {
//BYTE BUFFER
/**
- * Accesses the given ByteBuffer for read-only operations. The returned Buffer object has the
- * same byte order, as the given ByteBuffer.
+ * Provides a view of the given <i>ByteBuffer</i> for read-only operations.
+ * The view is of the entire ByteBuffer independent of <i>position</i> and <i>limit</i>.
+ * However, the returned <i>Buffer</i> will have <i>position</i> and <i>end</i> set to the
+ * ByteBuffer's <i>position</i> and <i>limit</i>, respectively.
+ * The returned Buffer will use the <i>ByteOrder</i> of the <i>ByteBuffer</i>.
* @param byteBuffer the given ByteBuffer, must not be null.
- * @return a new Buffer for read-only operations on the given ByteBuffer.
+ * @return a new <i>Buffer</i> for read-only operations on the given ByteBuffer.
Review Comment:
Yeah, my overall review comment was that we should not do that for this PR
--
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: commits-unsubscribe@datasketches.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org