K
- The type of the key.N
- The type of the namespace.T
- The type of the values stored in this ListState
.Backend
- The type of AbstractStateBackend
that manages this KvState
.W
- Generic type that extends both the underlying ValueState
and KvState
.public class GenericListState<K,N,T,Backend extends AbstractStateBackend,W extends ValueState<ArrayList<T>> & KvState<K,N,ValueState<ArrayList<T>>,ValueStateDescriptor<ArrayList<T>>,Backend>> extends Object implements ListState<T>, KvState<K,N,ListState<T>,ListStateDescriptor<T>,Backend>
ListState
based on a wrapped ValueState
.Constructor and Description |
---|
GenericListState(ValueState<ArrayList<T>> wrappedState)
Creates a new
ListState that wraps the given ValueState . |
Modifier and Type | Method and Description |
---|---|
void |
add(T value)
Updates the operator state accessible by
MergingState.get() by adding the given value
to the list of values. |
void |
clear()
Removes the value mapped under the current key.
|
void |
dispose()
Disposes the key/value state, releasing all occupied resources.
|
Iterable<T> |
get()
Returns the current value for the state.
|
void |
setCurrentKey(K key)
Sets the current key, which will be used when using the state access methods.
|
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
KvStateSnapshot<K,N,ListState<T>,ListStateDescriptor<T>,Backend> |
snapshot(long checkpointId,
long timestamp)
Creates a snapshot of this state.
|
public GenericListState(ValueState<ArrayList<T>> wrappedState)
ListState
that wraps the given ValueState
. The
ValueState
must have a default value of null
.wrappedState
- The wrapped ValueState
public void setCurrentKey(K key)
KvState
setCurrentKey
in interface KvState<K,N,ListState<T>,ListStateDescriptor<T>,Backend extends AbstractStateBackend>
key
- The key.public void setCurrentNamespace(N namespace)
KvState
setCurrentNamespace
in interface KvState<K,N,ListState<T>,ListStateDescriptor<T>,Backend extends AbstractStateBackend>
namespace
- The namespace.public KvStateSnapshot<K,N,ListState<T>,ListStateDescriptor<T>,Backend> snapshot(long checkpointId, long timestamp) throws Exception
KvState
snapshot
in interface KvState<K,N,ListState<T>,ListStateDescriptor<T>,Backend extends AbstractStateBackend>
checkpointId
- The ID of the checkpoint for which the snapshot should be created.timestamp
- The timestamp of the checkpoint.Exception
- Exceptions during snapshotting the state should be forwarded, so the system
can react to failed snapshots.public void dispose()
KvState
dispose
in interface KvState<K,N,ListState<T>,ListStateDescriptor<T>,Backend extends AbstractStateBackend>
public Iterable<T> get() throws Exception
MergingState
public void add(T value) throws Exception
MergingState
MergingState.get()
by adding the given value
to the list of values. The next time MergingState.get()
is called (for the same state
partition) the returned state will represent the updated list.add
in interface MergingState<T,Iterable<T>>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.Exception
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.