K
- The key by which state is keyed.public interface KeyedStateBackend<K> extends InternalKeyContext<K>, Disposable
Modifier and Type | Method and Description |
---|---|
<N,S extends State,T> |
applyToAllKeys(N namespace,
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S,T> stateDescriptor,
KeyedStateFunction<K,S> function)
Applies the provided
KeyedStateFunction to the state with the provided
StateDescriptor of all the currently active keys. |
void |
dispose()
Disposes the object and releases all resources.
|
<N> java.util.stream.Stream<K> |
getKeys(String state,
N namespace) |
<N,S extends State,T> |
getOrCreateKeyedState(TypeSerializer<N> namespaceSerializer,
StateDescriptor<S,T> stateDescriptor)
Creates or retrieves a keyed state backed by this state backend.
|
<N,S extends State> |
getPartitionedState(N namespace,
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S,?> stateDescriptor)
Creates or retrieves a partitioned state backed by this state backend.
|
void |
setCurrentKey(K newKey)
Sets the current key that is used for partitioned state.
|
getCurrentKey, getCurrentKeyGroupIndex, getKeyGroupRange, getKeySerializer, getNumberOfKeyGroups
void setCurrentKey(K newKey)
newKey
- The new current key.<N,S extends State,T> void applyToAllKeys(N namespace, TypeSerializer<N> namespaceSerializer, StateDescriptor<S,T> stateDescriptor, KeyedStateFunction<K,S> function) throws Exception
KeyedStateFunction
to the state with the provided
StateDescriptor
of all the currently active keys.N
- The type of the namespace.S
- The type of the state.namespace
- the namespace of the state.namespaceSerializer
- the serializer for the namespace.stateDescriptor
- the descriptor of the state to which the function is going to be applied.function
- the function to be applied to the keyed state.Exception
<N> java.util.stream.Stream<K> getKeys(String state, N namespace)
state
- State variable for which existing keys will be returned.namespace
- Namespace for which existing keys will be returned.<N,S extends State,T> S getOrCreateKeyedState(TypeSerializer<N> namespaceSerializer, StateDescriptor<S,T> stateDescriptor) throws Exception
N
- The type of the namespace.S
- The type of the state.namespaceSerializer
- The serializer used for the namespace type of the statestateDescriptor
- The identifier for the state. This contains name and can create a default state value.Exception
- Exceptions may occur during initialization of the state and should be forwarded.<N,S extends State> S getPartitionedState(N namespace, TypeSerializer<N> namespaceSerializer, StateDescriptor<S,?> stateDescriptor) throws Exception
N
- The type of the namespace.S
- The type of the state.stateDescriptor
- The identifier for the state. This contains name and can create a default state value.Exception
- Exceptions may occur during initialization of the state and should be forwarded.void dispose()
Disposable
dispose
in interface Disposable
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.