Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ interface CloseableIterator<T> extends Iterator<T> {

/**
* @param streamMessageListener A class object which implements StreamMessageListener
* @return true if streaming is supported by the iterator, otherwise false
* @return true if streaming is supported by the iterator, otherwise false. Also returns false
* if the iterator has already been closed, in which case no stream is started.
*/
default boolean initiateStreaming(AsyncResultSet.StreamMessageListener streamMessageListener) {
return false;
Expand All @@ -170,6 +171,15 @@ default void requestPrefetchChunks() {}
/**
* Returns true if data (a chunk, row, EOF, or error) is available to read immediately without
* blocking the calling thread on network I/O.
*
* <p><strong>Single-Consumer Threading Contract:</strong> This method drains underlying stream
* state into internal buffers and MUST only be called by the designated consuming thread. It
* must NEVER be invoked concurrently with {@link #hasNext()} or {@link #next()}.
*
* <p><strong>Note on Pending Retryable Errors:</strong> If a retryable stream error is pending,
* this method returns {@code true} so the consumer is prompted to call {@link #next()} to
* handle backoff and reconnect. In that specific scenario, the subsequent call to {@link
* #next()} may block for backoff sleep and stream re-establishment.
*/
default boolean isDataAvailable() {
return true;
Expand All @@ -179,6 +189,10 @@ default boolean isDataAvailable() {
* Returns true if the iterator can be polled immediately (via {@link #hasNext()} or {@link
* #next()}) to yield a chunk or EOF without blocking on network I/O and without throwing a
* stream error.
*
* <p><strong>Single-Consumer Threading Contract:</strong> This method drains underlying stream
* state and MUST only be called by the designated consuming thread. It must NEVER be invoked
* concurrently with {@link #hasNext()} or {@link #next()}.
*/
default boolean canPollWithoutErrorOrBlocking() {
return false;
Expand Down
Loading
Loading