public abstract class AbstractStateIterator<T> extends Object implements org.apache.flink.api.common.state.v2.StateIterator<T>
StateIterator implementation to facilitate async data load of iterator. Each state
backend could override this class to maintain more variables in need. Any subclass should
implement two methods, hasNext() and nextPayloadForContinuousLoading(). The
philosophy behind this class is to carry some already loaded elements and provide iterating right
on the task thread, and load following ones if needed (determined by hasNext()) by
creating **ANOTHER** iterating request. Thus, later it returns another iterator instance, and we
continue to apply the user iteration on that instance. The whole elements will be iterated by
recursive call of #onNext().| Constructor and Description |
|---|
AbstractStateIterator(org.apache.flink.api.common.state.v2.State originalState,
StateRequestType requestType,
StateRequestHandler stateHandler,
Collection<T> partialResult) |
| Modifier and Type | Method and Description |
|---|---|
protected StateRequestType |
getRequestType() |
protected abstract boolean |
hasNext()
Return whether this iterator has more elements to load besides current cache.
|
boolean |
isEmpty() |
protected abstract Object |
nextPayloadForContinuousLoading()
To perform following loading, build and get next payload for the next request.
|
org.apache.flink.api.common.state.v2.StateFuture<Void> |
onNext(Consumer<T> iterating) |
<U> org.apache.flink.api.common.state.v2.StateFuture<Collection<U>> |
onNext(Function<T,org.apache.flink.api.common.state.v2.StateFuture<? extends U>> iterating) |
public AbstractStateIterator(org.apache.flink.api.common.state.v2.State originalState,
StateRequestType requestType,
StateRequestHandler stateHandler,
Collection<T> partialResult)
protected abstract boolean hasNext()
protected abstract Object nextPayloadForContinuousLoading()
StateRequest.getPayload().protected StateRequestType getRequestType()
public <U> org.apache.flink.api.common.state.v2.StateFuture<Collection<U>> onNext(Function<T,org.apache.flink.api.common.state.v2.StateFuture<? extends U>> iterating)
onNext in interface org.apache.flink.api.common.state.v2.StateIterator<T>public org.apache.flink.api.common.state.v2.StateFuture<Void> onNext(Consumer<T> iterating)
onNext in interface org.apache.flink.api.common.state.v2.StateIterator<T>public boolean isEmpty()
isEmpty in interface org.apache.flink.api.common.state.v2.StateIterator<T>Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.