K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class FsReducingState<K,N,V> extends AbstractFsState<K,N,V,ReducingState<V>,ReducingStateDescriptor<V>> implements ReducingState<V>
ReducingState
that is
snapshotted into files.Modifier and Type | Class and Description |
---|---|
static class |
FsReducingState.Snapshot<K,N,V> |
currentKey, currentNamespace, currentNSState, keySerializer, namespaceSerializer, state, stateDesc, stateSerializer
Constructor and Description |
---|
FsReducingState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<V> stateDesc)
Creates a new and empty partitioned state.
|
FsReducingState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<V> stateDesc,
HashMap<N,Map<K,V>> state)
Creates a new key/value state with the given state contents.
|
Modifier and Type | Method and Description |
---|---|
void |
add(V value)
Updates the operator state accessible by
MergingState.get() by adding the given value
to the list of values. |
KvStateSnapshot<K,N,ReducingState<V>,ReducingStateDescriptor<V>,FsStateBackend> |
createHeapSnapshot(Path filePath) |
V |
get()
Returns the current value for the state.
|
snapshot
clear, dispose, getKeySerializer, getNamespaceSerializer, setCurrentKey, setCurrentNamespace, size
public FsReducingState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc)
backend
- The file system state backend backing snapshots of this statekeySerializer
- The serializer for the key.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.public FsReducingState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc, HashMap<N,Map<K,V>> state)
backend
- The file system state backend backing snapshots of this statekeySerializer
- The serializer for the key.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.state
- The map of key/value pairs to initialize the state with.public V get()
MergingState
get
in interface MergingState<V,V>
public void add(V value) throws IOException
MergingState
MergingState.get()
by adding the given value
to the list of values. The next time MergingState.get()
is called (for the same state
partition) the returned state will represent the updated list.add
in interface MergingState<V,V>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.public KvStateSnapshot<K,N,ReducingState<V>,ReducingStateDescriptor<V>,FsStateBackend> createHeapSnapshot(Path filePath)
createHeapSnapshot
in class AbstractFsState<K,N,V,ReducingState<V>,ReducingStateDescriptor<V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.