K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class HeapReducingState<K,N,V> extends AbstractHeapState<K,N,V,ReducingState<V>,ReducingStateDescriptor<V>> implements ReducingState<V>
ReducingState
that is
snapshotted into files.backend, currentNamespace, keySerializer, namespaceSerializer, stateDesc, stateTable
Constructor and Description |
---|
HeapReducingState(KeyedStateBackend<K> backend,
ReducingStateDescriptor<V> stateDesc,
StateTable<K,N,V> stateTable,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer)
Creates a new key/value state for the given hash map of key/value pairs.
|
Modifier and Type | Method and Description |
---|---|
void |
add(V value)
Updates the operator state accessible by
AppendingState.get() by adding the given value
to the list of values. |
V |
get()
Returns the current value for the state.
|
clear, createNewMap, getSerializedValue, getSerializedValue, getStateTable, setCurrentNamespace
public HeapReducingState(KeyedStateBackend<K> backend, ReducingStateDescriptor<V> stateDesc, StateTable<K,N,V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer)
backend
- The state backend backing that created this state.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.stateTable
- The state tab;e to use in this kev/value state. May contain initial state.public V get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<V,V>
null
if the state is empty.public void add(V value) throws IOException
AppendingState
AppendingState.get()
by adding the given value
to the list of values. The next time AppendingState.get()
is called (for the same state
partition) the returned state will represent the updated list.add
in interface AppendingState<V,V>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.