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.public class MemFoldingState<K,N,T,ACC> extends AbstractMemState<K,N,ACC,FoldingState<T,ACC>,FoldingStateDescriptor<T,ACC>> implements FoldingState<T,ACC>
FoldingState
that is
snapshotted into a serialized memory copy.Modifier and Type | Class and Description |
---|---|
static class |
MemFoldingState.Snapshot<K,N,T,ACC> |
currentKey, currentNamespace, currentNSState, keySerializer, namespaceSerializer, state, stateDesc, stateSerializer
Constructor and Description |
---|
MemFoldingState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
FoldingStateDescriptor<T,ACC> stateDesc) |
MemFoldingState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
FoldingStateDescriptor<T,ACC> stateDesc,
HashMap<N,Map<K,ACC>> state) |
Modifier and Type | Method and Description |
---|---|
void |
add(T value)
Updates the operator state accessible by
AppendingState.get() by adding the given value
to the list of values. |
KvStateSnapshot<K,N,FoldingState<T,ACC>,FoldingStateDescriptor<T,ACC>,MemoryStateBackend> |
createHeapSnapshot(byte[] bytes) |
ACC |
get()
Returns the current value for the state.
|
snapshot
clear, dispose, getKeySerializer, getNamespaceSerializer, setCurrentKey, setCurrentNamespace, size
public MemFoldingState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, FoldingStateDescriptor<T,ACC> stateDesc)
public MemFoldingState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, FoldingStateDescriptor<T,ACC> stateDesc, HashMap<N,Map<K,ACC>> state)
public ACC get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<T,ACC>
null
if the state is empty.public void add(T 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<T,ACC>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.public KvStateSnapshot<K,N,FoldingState<T,ACC>,FoldingStateDescriptor<T,ACC>,MemoryStateBackend> createHeapSnapshot(byte[] bytes)
createHeapSnapshot
in class AbstractMemState<K,N,ACC,FoldingState<T,ACC>,FoldingStateDescriptor<T,ACC>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.