K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class HeapListState<K,N,V> extends AbstractHeapMergingState<K,N,V,Iterable<V>,ArrayList<V>,ListState<V>,ListStateDescriptor<V>> implements InternalListState<N,V>
ListState
that is snapshotted
into files.currentNamespace, keySerializer, namespaceSerializer, stateDesc, stateTable
Constructor and Description |
---|
HeapListState(ListStateDescriptor<V> stateDesc,
StateTable<K,N,ArrayList<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. |
Iterable<V> |
get()
Returns the current value for the state.
|
byte[] |
getSerializedValue(K key,
N namespace) |
protected ArrayList<V> |
mergeState(ArrayList<V> a,
ArrayList<V> b) |
mergeNamespaces
clear, getSerializedValue, getStateTable, setCurrentNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mergeNamespaces
getSerializedValue, setCurrentNamespace
public HeapListState(ListStateDescriptor<V> stateDesc, StateTable<K,N,ArrayList<V>> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer)
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 Iterable<V> get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<V,Iterable<V>>
null
if the state is empty.public void add(V value)
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,Iterable<V>>
value
- The new value for the state.public byte[] getSerializedValue(K key, N namespace) throws Exception
getSerializedValue
in class AbstractHeapState<K,N,ArrayList<V>,ListState<V>,ListStateDescriptor<V>>
Exception
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.