@Internal public class DefaultOperatorStateBackend extends Object implements OperatorStateBackend
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_OPERATOR_STATE_NAME
The default namespace for state in cases where no state name is provided
|
Constructor and Description |
---|
DefaultOperatorStateBackend(ClassLoader userClassLoader) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
dispose()
Disposes the backend and releases all resources.
|
<S> ListState<S> |
getBroadcastOperatorState(ListStateDescriptor<S> stateDescriptor) |
<T extends Serializable> |
getBroadcastSerializableListState(String stateName) |
<S> ListState<S> |
getOperatorState(ListStateDescriptor<S> stateDescriptor)
Creates (or restores) a list state.
|
Set<String> |
getRegisteredStateNames()
Returns a set with the names of all currently registered states.
|
<T extends Serializable> |
getSerializableListState(String stateName)
Creates a state of the given name that uses Java serialization to persist the state.
|
void |
restore(Collection<OperatorStateHandle> restoreSnapshots)
Restores state that was previously snapshotted from the provided parameters.
|
RunnableFuture<OperatorStateHandle> |
snapshot(long checkpointId,
long timestamp,
CheckpointStreamFactory streamFactory)
Operation that writes a snapshot into a stream that is provided by the given
CheckpointStreamFactory and
returns a @RunnableFuture that gives a state handle to the snapshot. |
public static final String DEFAULT_OPERATOR_STATE_NAME
public DefaultOperatorStateBackend(ClassLoader userClassLoader) throws IOException
IOException
public Set<String> getRegisteredStateNames()
OperatorStateStore
getRegisteredStateNames
in interface OperatorStateStore
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void dispose()
OperatorStateBackend
dispose
in interface OperatorStateBackend
public <T extends Serializable> ListState<T> getSerializableListState(String stateName) throws Exception
OperatorStateStore
This is a simple convenience method. For more flexibility on how state serialization
should happen, use the OperatorStateStore.getOperatorState(ListStateDescriptor)
method.
getSerializableListState
in interface OperatorStateStore
stateName
- The name of state to createException
public <S> ListState<S> getOperatorState(ListStateDescriptor<S> stateDescriptor) throws IOException
OperatorStateStore
getOperatorState
in interface OperatorStateStore
S
- The generic type of the statestateDescriptor
- The descriptor for this state, providing a name and serializer.IOException
public <T extends Serializable> ListState<T> getBroadcastSerializableListState(String stateName) throws Exception
Exception
public <S> ListState<S> getBroadcastOperatorState(ListStateDescriptor<S> stateDescriptor) throws Exception
Exception
public RunnableFuture<OperatorStateHandle> snapshot(long checkpointId, long timestamp, CheckpointStreamFactory streamFactory) throws Exception
Snapshotable
CheckpointStreamFactory
and
returns a @RunnableFuture
that gives a state handle to the snapshot. It is up to the implementation if
the operation is performed synchronous or asynchronous. In the later case, the returned Runnable must be executed
first before obtaining the handle.snapshot
in interface Snapshotable<OperatorStateHandle>
checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.streamFactory
- The factory that we can use for writing our state to streams.StateObject
.Exception
public void restore(Collection<OperatorStateHandle> restoreSnapshots) throws Exception
Snapshotable
restore
in interface Snapshotable<OperatorStateHandle>
restoreSnapshots
- the old state to restore.Exception
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.