ptupitsyn commented on code in PR #2882:
URL: https://github.com/apache/ignite-3/pull/2882#discussion_r1441442375


##########
modules/api/src/main/java/org/apache/ignite/lang/AsyncCursor.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.lang;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Provides methods for iterate over operation results and release underlying 
resources in an asynchronous way.

Review Comment:
   ```suggestion
    * Provides methods to iterate over operation results and release underlying 
resources in an asynchronous way.
   ```



##########
modules/api/src/main/java/org/apache/ignite/lang/Cursor.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.lang;
+
+import java.util.Iterator;
+
+/**
+ * Provides methods for iterate over operation results and release underlying 
resources.

Review Comment:
   ```suggestion
    * Provides methods to iterate over operation results and release underlying 
resources.
   ```



##########
modules/api/src/main/java/org/apache/ignite/table/criteria/CriteriaQuerySource.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.table.criteria;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.lang.AsyncCursor;
+import org.apache.ignite.lang.Cursor;
+import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.tx.Transaction;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a criteria query facade that can be used to executes a query to 
a record view using a predicate.
+ *
+ * @param <T> The type of elements returned by iterator.
+ */
+public interface CriteriaQuerySource<T> {
+    /**
+     * Executes a query to a record view using a predicate.

Review Comment:
   ```suggestion
        * Executes a criteria query.
   ```
   
   I don't think "record view" should be mentioned - we might add this to 
KeyValueViews as well.



##########
modules/api/src/main/java/org/apache/ignite/table/criteria/CriteriaQuerySource.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.table.criteria;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.lang.AsyncCursor;
+import org.apache.ignite.lang.Cursor;
+import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.tx.Transaction;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a criteria query facade that can be used to executes a query to 
a record view using a predicate.
+ *
+ * @param <T> The type of elements returned by iterator.
+ */
+public interface CriteriaQuerySource<T> {
+    /**
+     * Executes a query to a record view using a predicate.
+     *
+     * @param tx Transaction to execute the query within or {@code null} to 
run within implicit transaction.
+     * @param criteria The predicate to filter entries or {@code null} to 
return all entries in record view.

Review Comment:
   Same as above, here and below - let's not mention "record view".



##########
modules/api/src/main/java/org/apache/ignite/table/criteria/Criteria.java:
##########
@@ -0,0 +1,25 @@
+/*
+ * 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.table.criteria;
+
+/**
+ * Represents a predicate for performing criteria queries.

Review Comment:
   ```suggestion
    * Represents a criteria query predicate.
   ```



##########
modules/api/src/main/java/org/apache/ignite/lang/Cursor.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.lang;
+
+import java.util.Iterator;
+
+/**
+ * Provides methods for iterate over operation results and release underlying 
resources.
+ *
+ * @param <T> The type of elements returned by this iterator.
+ */
+public interface Cursor<T> extends Iterator<T>, AutoCloseable {
+    /**
+     * Closes this resource and releasing any underlying resources.

Review Comment:
   ```suggestion
        * Closes this cursor and releases any underlying resources.
   ```



##########
modules/api/src/main/java/org/apache/ignite/table/criteria/CriteriaQuerySource.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.table.criteria;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.lang.AsyncCursor;
+import org.apache.ignite.lang.Cursor;
+import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.tx.Transaction;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a criteria query facade that can be used to executes a query to 
a record view using a predicate.

Review Comment:
   ```suggestion
    * Represents an object that can be used to execute predicate-based criteria 
queries.
   ```



##########
modules/api/src/main/java/org/apache/ignite/sql/ResultSet.java:
##########
@@ -70,12 +70,12 @@ public interface ResultSet<T> extends Iterator<T>, 
AutoCloseable {
     long affectedRows();
 
     /**
-     * Indicated whether the query that had produced the result was a 
conditional query. 
-     * E.g., for query "Create table if not exists", the method returns {@code 
true} if 
+     * Indicated whether the query that had produced the result was a 
conditional query.

Review Comment:
   ```suggestion
        * Indicates whether the query that had produced the result was a 
conditional query.
   ```



##########
modules/api/src/main/java/org/apache/ignite/lang/AsyncCursor.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.lang;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Provides methods for iterate over operation results and release underlying 
resources in an asynchronous way.
+ *
+ * @param <T> The type of elements returned by this iterator.
+ */
+public interface AsyncCursor<T> {
+    /**
+     * Returns the current page content if the operation returns results.
+     *
+     * @return Iterable set of elements.
+     * @throws IgniteException If no results is returned.
+     */
+    Iterable<T> currentPage();
+
+    /**
+     * Returns the current page size if the operation return results.
+     *
+     * @return The size of {@link #currentPage()}.
+     * @throws IgniteException If no results is returned.
+     */
+    int currentPageSize();
+
+    /**
+     * Fetches the next page of results asynchronously.
+     * The current page is changed after the future completion.
+     * The methods {@link #currentPage()}, {@link #currentPageSize()}, {@link 
#hasMorePages()}
+     * use the current page and return consistent results between complete 
last page future and call {@code fetchNextPage}.
+     *
+     * @return A future which will be completed when next page will be fetched 
and set as the current page.
+     *     The future will return {@code this} for chaining.
+     * @throws IgniteException If resource is closed or if there are no more 
results.
+     */
+    CompletableFuture<? extends AsyncCursor<T>> fetchNextPage();
+
+    /**
+     * Indicates whether there are more pages of results.
+     *
+     * @return {@code True} if there are more pages with results, {@code 
false} otherwise.
+     */
+    boolean hasMorePages();
+
+    /**
+     * Closes this resource and releasing any underlying resources.

Review Comment:
   ```suggestion
        * Closes this cursor and releases any underlying resources.
   ```



-- 
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]

Reply via email to