K
- The type of the key.N
- The type of the namespace.V
- The type of the values in the list state.public class MemReducingState<K,N,V> extends AbstractMemState<K,N,V,ReducingState<V>,ReducingStateDescriptor<V>> implements ReducingState<V>
ReducingState
that is
snapshotted into a serialized memory copy.Modifier and Type | Class and Description |
---|---|
static class |
MemReducingState.Snapshot<K,N,V> |
currentKey, currentNamespace, currentNSState, keySerializer, namespaceSerializer, state, stateDesc, stateSerializer
Constructor and Description |
---|
MemReducingState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<V> stateDesc) |
MemReducingState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<V> stateDesc,
HashMap<N,Map<K,V>> state) |
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. |
KvStateSnapshot<K,N,ReducingState<V>,ReducingStateDescriptor<V>,MemoryStateBackend> |
createHeapSnapshot(byte[] bytes) |
V |
get()
Returns the current value for the state.
|
snapshot
clear, dispose, getKeySerializer, getNamespaceSerializer, setCurrentKey, setCurrentNamespace, size
public MemReducingState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc)
public MemReducingState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc, HashMap<N,Map<K,V>> 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.public KvStateSnapshot<K,N,ReducingState<V>,ReducingStateDescriptor<V>,MemoryStateBackend> createHeapSnapshot(byte[] bytes)
createHeapSnapshot
in class AbstractMemState<K,N,V,ReducingState<V>,ReducingStateDescriptor<V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.