This is an automated email from the ASF dual-hosted git repository.

frankvicky pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c0b33ceffde KAFKA-20741: Add ReadOnlyRecordIterator IQv2 result type 
(KIP-1356) (#22729)
c0b33ceffde is described below

commit c0b33ceffde7c17e187c46690669137be2c01163
Author: Jess668 <[email protected]>
AuthorDate: Thu Jul 9 09:11:54 2026 -0400

    KAFKA-20741: Add ReadOnlyRecordIterator IQv2 result type (KIP-1356) (#22729)
    
    This PR adds `ReadOnlyRecordIterator`, the closeable iterator result
    type for the headers-aware range/window/session IQv2 queries that
    KIP-1356 introduces.
    
    Reviewers: Alieh Saeedi <[email protected]>, TengYao Chi
    <[email protected]>
---
 .../streams/state/ReadOnlyRecordIterator.java      | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git 
a/streams/src/main/java/org/apache/kafka/streams/state/ReadOnlyRecordIterator.java
 
b/streams/src/main/java/org/apache/kafka/streams/state/ReadOnlyRecordIterator.java
new file mode 100644
index 00000000000..e186095b1db
--- /dev/null
+++ 
b/streams/src/main/java/org/apache/kafka/streams/state/ReadOnlyRecordIterator.java
@@ -0,0 +1,46 @@
+/*
+ * 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.kafka.streams.state;
+
+import org.apache.kafka.common.annotation.InterfaceAudience;
+import org.apache.kafka.common.annotation.InterfaceStability.Evolving;
+import org.apache.kafka.streams.processor.api.ReadOnlyRecord;
+
+import java.io.Closeable;
+import java.util.Iterator;
+
+/**
+ * Iterator interface of {@link ReadOnlyRecord}.
+ * <p>
+ * This is the result type of the headers-aware range/window/session IQv2 
query types: it yields
+ * {@link ReadOnlyRecord} elements directly, so each element carries its own 
key, value, timestamp,
+ * and headers.
+ * <p>
+ * Users must call its {@code close} method explicitly upon completeness to 
release resources,
+ * or use try-with-resources statement (available since JDK7) for this {@link 
Closeable} class.
+ * Note that {@code remove()} is not supported.
+ *
+ * @param <K> Type of keys
+ * @param <V> Type of values
+ */
[email protected]
+@Evolving
+public interface ReadOnlyRecordIterator<K, V> extends 
Iterator<ReadOnlyRecord<K, V>>, Closeable {
+
+    @Override
+    void close();
+}

Reply via email to