K - The type of the key.N - The type of the namespace.T - The type of the values that can be folded into the state.ACC - The type of the value in the folding state.Backend - The type of AbstractStateBackend that manages this KvState.W - Generic type that extends both the underlying ValueState and KvState.public class GenericFoldingState<K,N,T,ACC,Backend extends AbstractStateBackend,W extends org.apache.flink.api.common.state.ValueState<ACC> & KvState<K,N,org.apache.flink.api.common.state.ValueState<ACC>,org.apache.flink.api.common.state.ValueStateDescriptor<ACC>,Backend>> extends Object implements org.apache.flink.api.common.state.FoldingState<T,ACC>, KvState<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend>
FoldingState based on a wrapped ValueState.| Constructor and Description |
|---|
GenericFoldingState(org.apache.flink.api.common.state.ValueState<ACC> wrappedState,
org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction)
Creates a new
FoldingState that wraps the given ValueState. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T value) |
void |
clear() |
void |
dispose()
Disposes the key/value state, releasing all occupied resources.
|
ACC |
get() |
void |
setCurrentKey(K key)
Sets the current key, which will be used when using the state access methods.
|
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
KvStateSnapshot<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend> |
snapshot(long checkpointId,
long timestamp)
Creates a snapshot of this state.
|
public GenericFoldingState(org.apache.flink.api.common.state.ValueState<ACC> wrappedState, org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction)
FoldingState that wraps the given ValueState. The
ValueState must have the initial value of the fold as default value.wrappedState - The wrapped ValueStatefoldFunction - The FoldFunction to use for folding values into the statepublic void setCurrentKey(K key)
KvStatesetCurrentKey in interface KvState<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend extends AbstractStateBackend>key - The key.public void setCurrentNamespace(N namespace)
KvStatesetCurrentNamespace in interface KvState<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend extends AbstractStateBackend>namespace - The namespace.public KvStateSnapshot<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend> snapshot(long checkpointId, long timestamp) throws Exception
KvStatesnapshot in interface KvState<K,N,org.apache.flink.api.common.state.FoldingState<T,ACC>,org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC>,Backend extends AbstractStateBackend>checkpointId - The ID of the checkpoint for which the snapshot should be created.timestamp - The timestamp of the checkpoint.Exception - Exceptions during snapshotting the state should be forwarded, so the system
can react to failed snapshots.public void dispose()
KvStatepublic void clear()
clear in interface org.apache.flink.api.common.state.StateCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.