Class BeamStateRequestHandler
- java.lang.Object
-
- org.apache.flink.streaming.api.runners.python.beam.state.BeamStateRequestHandler
-
- All Implemented Interfaces:
org.apache.beam.runners.fnexecution.state.StateRequestHandler
public class BeamStateRequestHandler extends Object implements org.apache.beam.runners.fnexecution.state.StateRequestHandler
The handler for Beam state requests sent from Python side, which does actual operations on Flink state.
-
-
Constructor Summary
Constructors Constructor Description BeamStateRequestHandler(BeamStateStore keyedStateStore, BeamStateStore operatorStateStore, BeamStateHandler<ListState<byte[]>> bagStateHandler, BeamStateHandler<MapState<ByteArrayWrapper,byte[]>> mapStateHandler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleRequest.CacheToken>
getCacheTokens()
CompletionStage<org.apache.beam.model.fnexecution.v1.BeamFnApi.StateResponse.Builder>
handle(org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest request)
static BeamStateRequestHandler
of(KeyedStateBackend<?> keyedStateBackend, OperatorStateBackend operatorStateBackend, TypeSerializer<?> keySerializer, TypeSerializer<?> namespaceSerializer, ReadableConfig config)
Create aBeamStateRequestHandler
.
-
-
-
Constructor Detail
-
BeamStateRequestHandler
public BeamStateRequestHandler(BeamStateStore keyedStateStore, BeamStateStore operatorStateStore, BeamStateHandler<ListState<byte[]>> bagStateHandler, BeamStateHandler<MapState<ByteArrayWrapper,byte[]>> mapStateHandler)
-
-
Method Detail
-
handle
public CompletionStage<org.apache.beam.model.fnexecution.v1.BeamFnApi.StateResponse.Builder> handle(org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest request) throws Exception
- Specified by:
handle
in interfaceorg.apache.beam.runners.fnexecution.state.StateRequestHandler
- Throws:
Exception
-
getCacheTokens
public Iterable<org.apache.beam.model.fnexecution.v1.BeamFnApi.ProcessBundleRequest.CacheToken> getCacheTokens()
- Specified by:
getCacheTokens
in interfaceorg.apache.beam.runners.fnexecution.state.StateRequestHandler
-
of
public static BeamStateRequestHandler of(@Nullable KeyedStateBackend<?> keyedStateBackend, @Nullable OperatorStateBackend operatorStateBackend, @Nullable TypeSerializer<?> keySerializer, @Nullable TypeSerializer<?> namespaceSerializer, ReadableConfig config)
Create aBeamStateRequestHandler
.- Parameters:
keyedStateBackend
- if null,BeamStateRequestHandler
would throw an error when receive keyed-state requests.operatorStateBackend
- if null,BeamStateRequestHandler
would throw an error when receive operator-state requests.keySerializer
- key serializer forKeyedStateBackend
, must not be null ifkeyedStatedBackend
is not null.namespaceSerializer
- namespace serializer forKeyedStateBackend
, could be null when there's no window logic involved.config
- state-related configurations- Returns:
- A new
BeamBagStateHandler
-
-