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>,ValueStateDescriptor<V>> implements ValueState<V>
ValueState
that is snapshotted
into files.backend, currentNamespace, keySerializer, namespaceSerializer, stateDesc, stateTable
Constructor and Description |
---|
HeapValueState(KeyedStateBackend<K> backend,
ValueStateDescriptor<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 |
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, createNewMap, getSerializedValue, getSerializedValue, getStateTable, setCurrentNamespace
public HeapValueState(KeyedStateBackend<K> backend, ValueStateDescriptor<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 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–2017 The Apache Software Foundation. All rights reserved.