public class StatefulFunctionsSavepointCreator
extends java.lang.Object
Users register multiple StateBootstrapFunction
s that each define how to bootstrap a
given stateful function, as well as provide Flink DataSet
s that contain data that serve
as input for the bootstrap functions. The StatefulFunctionsSavepointCreator
can then be
used to construct a Flink batch job which writes out a savepoint that contains the bootstrapped
state and may be used to restore a Stateful Functions application.
Constructor and Description |
---|
StatefulFunctionsSavepointCreator(int maxParallelism)
Creates a
StatefulFunctionsSavepointCreator . |
Modifier and Type | Method and Description |
---|---|
<IN> StatefulFunctionsSavepointCreator |
withBootstrapData(org.apache.flink.api.java.DataSet<IN> bootstrapDataset,
BootstrapDataRouterProvider<IN> routerProvider)
Registers a Flink
DataSet to be used as inputs to StateBootstrapFunction s for
bootstrapping state. |
StatefulFunctionsSavepointCreator |
withFsStateBackend()
Use Flink's
FsStateBackend to generate the savepoint. |
StatefulFunctionsSavepointCreator |
withStateBootstrapFunctionProvider(FunctionType functionType,
StateBootstrapFunctionProvider bootstrapFunctionProvider)
Registers a
StateBootstrapFunctionProvider to the savepoint creator. |
void |
write(java.lang.String path)
Writes the constructed savepoint to a given path.
|
public StatefulFunctionsSavepointCreator(int maxParallelism)
StatefulFunctionsSavepointCreator
.maxParallelism
- max parallelism of the Stateful Functions application to be restored
using the generated savepoint.public StatefulFunctionsSavepointCreator withFsStateBackend()
FsStateBackend
to generate the savepoint. By default, RocksDBStateBackend
is used.
This affects the format of the generated savepoint, and should therefore be the same as what is configured by the Stateful Functions application to be restored using the generated savepoint.
FsStateBackend
.public <IN> StatefulFunctionsSavepointCreator withBootstrapData(org.apache.flink.api.java.DataSet<IN> bootstrapDataset, BootstrapDataRouterProvider<IN> routerProvider)
DataSet
to be used as inputs to StateBootstrapFunction
s for
bootstrapping state. A provider for a Router
that addresses each element in the
bootstrap dataset to StateBootstrapFunction
instances must also be defined.
For all bootstrap functions that may receive a state bootstrap input, a StateBootstrapFunctionProvider
must also be registered for it using withStateBootstrapFunctionProvider(FunctionType, StateBootstrapFunctionProvider)
.
IN
- data type of the input bootstrap datasetbootstrapDataset
- a Flink DataSet
containing inputs for bootstrapping state.routerProvider
- provider of a Router
that addresses each element in the bootstrap
dataset to StateBootstrapFunction
instances.public StatefulFunctionsSavepointCreator withStateBootstrapFunctionProvider(FunctionType functionType, StateBootstrapFunctionProvider bootstrapFunctionProvider)
StateBootstrapFunctionProvider
to the savepoint creator.functionType
- the type of function that is being bootstrapped.bootstrapFunctionProvider
- the bootstrap function provider to register.StateBootstrapFunctionProvider
.public void write(java.lang.String path)
path
- path to write the generated savepoint to.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.