K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class HeapValueState<K,N,V> extends AbstractHeapState<K,N,V,ValueState<V>> implements InternalValueState<K,N,V>
ValueState
that is snapshotted into files.currentNamespace, keySerializer, namespaceSerializer, stateTable, valueSerializer
Constructor and Description |
---|
HeapValueState(StateTable<K,N,V> stateTable,
TypeSerializer<K> keySerializer,
TypeSerializer<V> valueSerializer,
TypeSerializer<N> namespaceSerializer,
V defaultValue)
Creates a new key/value state for the given hash map of key/value pairs.
|
Modifier and Type | Method and Description |
---|---|
TypeSerializer<K> |
getKeySerializer()
Returns the
TypeSerializer for the type of key this state is associated to. |
TypeSerializer<N> |
getNamespaceSerializer()
Returns the
TypeSerializer for the type of namespace this state is associated to. |
TypeSerializer<V> |
getValueSerializer()
Returns the
TypeSerializer for the type of value this state holds. |
void |
update(V value)
Updates the operator state accessible by
ValueState.value() to the given
value. |
V |
value()
Returns the current value for the state.
|
clear, getDefaultValue, getSerializedValue, getStateTable, setCurrentNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSerializedValue, setCurrentNamespace
public HeapValueState(StateTable<K,N,V> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<V> valueSerializer, TypeSerializer<N> namespaceSerializer, V defaultValue)
stateTable
- The state table for which this state is associated to.keySerializer
- The serializer for the keys.valueSerializer
- The serializer for the state.namespaceSerializer
- The serializer for the namespace.defaultValue
- The default value for the state.public TypeSerializer<K> getKeySerializer()
InternalKvState
TypeSerializer
for the type of key this state is associated to.getKeySerializer
in interface InternalKvState<K,N,V>
public TypeSerializer<N> getNamespaceSerializer()
InternalKvState
TypeSerializer
for the type of namespace this state is associated to.getNamespaceSerializer
in interface InternalKvState<K,N,V>
public TypeSerializer<V> getValueSerializer()
InternalKvState
TypeSerializer
for the type of value this state holds.getValueSerializer
in interface InternalKvState<K,N,V>
public V value()
ValueState
If you didn't specify a default value when creating the ValueStateDescriptor
this will return null
when to value was previously set using ValueState.update(Object)
.
value
in interface ValueState<V>
public void update(V value)
ValueState
ValueState.value()
to the given
value. The next time ValueState.value()
is called (for the same state
partition) the returned state will represent the updated value. When a
partitioned state is updated with null, the state for the current key
will be removed and the default value is returned on the next access.update
in interface ValueState<V>
value
- The new value for the state.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.