tkalkirill commented on code in PR #2161:
URL: https://github.com/apache/ignite-3/pull/2161#discussion_r1222701658
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/AbstractPageMemoryIndexStorage.java:
##########
@@ -192,6 +196,123 @@ public void finishCleanup() {
state.compareAndSet(StorageState.CLEANUP, StorageState.RUNNABLE);
}
+ /** Constant that represents the absence of value in {@link ScanCursor}. */
+ private static final IndexRowKey NO_INDEX_ROW = () -> null;
+
+ /**
+ * Cursor that always returns up-to-date next element.
+ *
+ * @param <R> Type of the returned value.
+ */
+ protected abstract class ScanCursor<R> implements PeekCursor<R> {
+ private final BplusTree<K, V> indexTree;
+
+ @Nullable
+ private Boolean hasNext;
+
+ @Nullable
+ private final K lower;
+
+ @Nullable
+ private V treeRow;
+
+ @Nullable
+ private V peekedRow = (V) NO_INDEX_ROW;
+
+ protected ScanCursor(@Nullable K lower, BplusTree<K, V> indexTree) {
+ this.lower = lower;
+ this.indexTree = indexTree;
+ }
+
+ /**
+ * Maps value from the index tree into the required result.
+ */
+ protected abstract R map(V value);
+
+ /**
+ * Check whether the passed value exceeds the upper bound for the scan.
+ */
+ protected abstract boolean halt(V value);
Review Comment:
I tried to find in our project at least one use of such a name or similar to
it - there is none.
--
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]