K
- The type of the key.N
- The type of the namespace.V
- The type of the value.public class FsListState<K,N,V> extends AbstractFsState<K,N,ArrayList<V>,ListState<V>,ListStateDescriptor<V>> implements ListState<V>
ListState
that is snapshotted
into files.Modifier and Type | Class and Description |
---|---|
static class |
FsListState.Snapshot<K,N,V> |
currentKey, currentNamespace, currentNSState, keySerializer, namespaceSerializer, state, stateDesc, stateSerializer
Constructor and Description |
---|
FsListState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ListStateDescriptor<V> stateDesc)
Creates a new and empty partitioned state.
|
FsListState(FsStateBackend backend,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ListStateDescriptor<V> stateDesc,
HashMap<N,Map<K,ArrayList<V>>> state)
Creates a new key/value state with the given state contents.
|
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. |
KvStateSnapshot<K,N,ListState<V>,ListStateDescriptor<V>,FsStateBackend> |
createHeapSnapshot(Path filePath) |
Iterable<V> |
get()
Returns the current value for the state.
|
snapshot
clear, dispose, getKeySerializer, getNamespaceSerializer, setCurrentKey, setCurrentNamespace, size
public FsListState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ListStateDescriptor<V> stateDesc)
keySerializer
- The serializer for the key.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 FsListState(FsStateBackend backend, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ListStateDescriptor<V> stateDesc, HashMap<N,Map<K,ArrayList<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 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 KvStateSnapshot<K,N,ListState<V>,ListStateDescriptor<V>,FsStateBackend> createHeapSnapshot(Path filePath)
createHeapSnapshot
in class AbstractFsState<K,N,ArrayList<V>,ListState<V>,ListStateDescriptor<V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.