public class StateRequestHandlers
extends java.lang.Object
StateRequestHandler
s.
TODO: Add a variant which works on ByteString
s to remove encoding/decoding overhead.
Modifier and Type | Class and Description |
---|---|
static interface |
StateRequestHandlers.BagUserStateHandler<K,V,W extends BoundedWindow>
A handler for bag user state.
|
static interface |
StateRequestHandlers.BagUserStateHandlerFactory<K,V,W extends BoundedWindow>
A factory which constructs
StateRequestHandlers.BagUserStateHandler s. |
static interface |
StateRequestHandlers.IterableSideInputHandler<V,W extends BoundedWindow>
A handler for iterable side inputs.
|
static interface |
StateRequestHandlers.MultimapSideInputHandler<K,V,W extends BoundedWindow>
A handler for multimap side inputs.
|
static interface |
StateRequestHandlers.SideInputHandler
Marker interface that denotes some type of side input handler.
|
static interface |
StateRequestHandlers.SideInputHandlerFactory
A factory which constructs
StateRequestHandlers.MultimapSideInputHandler s. |
Constructor and Description |
---|
StateRequestHandlers() |
Modifier and Type | Method and Description |
---|---|
static StateRequestHandler |
delegateBasedUponType(java.util.EnumMap<org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey.TypeCase,StateRequestHandler> handlers)
Returns a
StateRequestHandler which delegates to the supplied handler depending on the
BeamFnApi.StateRequest s type . |
static StateRequestHandler |
forBagUserStateHandlerFactory(ProcessBundleDescriptors.ExecutableProcessBundleDescriptor processBundleDescriptor,
StateRequestHandlers.BagUserStateHandlerFactory bagUserStateHandlerFactory)
Returns an adapter which converts a
StateRequestHandlers.BagUserStateHandlerFactory to a StateRequestHandler . |
static StateRequestHandler |
forSideInputHandlerFactory(java.util.Map<java.lang.String,java.util.Map<java.lang.String,ProcessBundleDescriptors.SideInputSpec>> sideInputSpecs,
StateRequestHandlers.SideInputHandlerFactory sideInputHandlerFactory)
Returns an adapter which converts a
StateRequestHandlers.SideInputHandlerFactory to a StateRequestHandler . |
public static StateRequestHandler delegateBasedUponType(java.util.EnumMap<org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey.TypeCase,StateRequestHandler> handlers)
StateRequestHandler
which delegates to the supplied handler depending on the
BeamFnApi.StateRequest
s type
.
An exception is thrown if a corresponding handler is not found.
public static StateRequestHandler forSideInputHandlerFactory(java.util.Map<java.lang.String,java.util.Map<java.lang.String,ProcessBundleDescriptors.SideInputSpec>> sideInputSpecs, StateRequestHandlers.SideInputHandlerFactory sideInputHandlerFactory)
StateRequestHandlers.SideInputHandlerFactory
to a StateRequestHandler
.
The StateRequestHandlers.SideInputHandlerFactory
is required to handle all side inputs contained within
the ProcessBundleDescriptors.ExecutableProcessBundleDescriptor
. See ProcessBundleDescriptors.ExecutableProcessBundleDescriptor.getSideInputSpecs()
for the set of side inputs that are
contained.
Instances of StateRequestHandlers.MultimapSideInputHandler
s returned by the StateRequestHandlers.SideInputHandlerFactory
are cached.
public static StateRequestHandler forBagUserStateHandlerFactory(ProcessBundleDescriptors.ExecutableProcessBundleDescriptor processBundleDescriptor, StateRequestHandlers.BagUserStateHandlerFactory bagUserStateHandlerFactory)
StateRequestHandlers.BagUserStateHandlerFactory
to a StateRequestHandler
.
The StateRequestHandlers.SideInputHandlerFactory
is required to handle all multimap side inputs contained
within the ProcessBundleDescriptors.ExecutableProcessBundleDescriptor
. See ProcessBundleDescriptors.ExecutableProcessBundleDescriptor.getSideInputSpecs()
for the set of multimap side inputs that
are contained.
Instances of StateRequestHandlers.MultimapSideInputHandler
s returned by the StateRequestHandlers.SideInputHandlerFactory
are cached.
In case of any failures, this handler must be discarded. Otherwise, the contained state cache token would be reused which would corrupt the state cache.