K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class FsValueState<K,N,V> extends AbstractFsState<K,N,V,ValueState<V>,ValueStateDescriptor<V>> implements ValueState<V>
ValueState
that is snapshotted
into files.Modifier and Type | Class and Description |
---|---|
static class |
FsValueState.Snapshot<K,N,V> |
currentKey, currentNamespace, currentNSState, keySerializer, namespaceSerializer, state, stateDesc, stateSerializer
Constructor and Description |
---|
FsValueState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ValueStateDescriptor<V> stateDesc)
Creates a new and empty key/value state.
|
FsValueState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ValueStateDescriptor<V> stateDesc,
HashMap<N,Map<K,V>> state)
Creates a new key/value state with the given state contents.
|
Modifier and Type | Method and Description |
---|---|
KvStateSnapshot<K,N,ValueState<V>,ValueStateDescriptor<V>,FsStateBackend> |
createHeapSnapshot(Path filePath) |
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.
|
snapshot
clear, dispose, getKeySerializer, getNamespaceSerializer, setCurrentKey, setCurrentNamespace, size
public FsValueState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc)
keySerializer
- The serializer for the key.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.backend
- The file system state backend backing snapshots of this statepublic FsValueState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc, HashMap<N,Map<K,V>> state)
keySerializer
- The serializer for the key.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.state
- The map of key/value pairs to initialize the state with.backend
- The file system state backend backing snapshots of this statepublic V value()
ValueState
value
in interface OperatorState<V>
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 OperatorState<V>
update
in interface ValueState<V>
value
- The new value for the state.public KvStateSnapshot<K,N,ValueState<V>,ValueStateDescriptor<V>,FsStateBackend> createHeapSnapshot(Path filePath)
createHeapSnapshot
in class AbstractFsState<K,N,V,ValueState<V>,ValueStateDescriptor<V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.