Search in sources :

Example 1 with AbstractMigrationRestoreStrategy

use of org.apache.flink.migration.runtime.state.memory.AbstractMigrationRestoreStrategy in project flink by apache.

the class AbstractFsStateSnapshot method deserialize.

@Override
@SuppressWarnings("unchecked")
public StateTable<K, N, SV> deserialize(String stateName, HeapKeyedStateBackend<K> stateBackend) throws IOException {
    final FileSystem fs = getFilePath().getFileSystem();
    try (FSDataInputStream inStream = fs.open(getFilePath())) {
        final DataInputViewStreamWrapper inView = new DataInputViewStreamWrapper(inStream);
        AbstractMigrationRestoreStrategy<K, N, SV> restoreStrategy = new AbstractMigrationRestoreStrategy<K, N, SV>(keySerializer, namespaceSerializer, stateSerializer) {

            @Override
            protected DataInputView openDataInputView() throws IOException {
                return inView;
            }
        };
        return restoreStrategy.deserialize(stateName, stateBackend);
    }
}
Also used : AbstractMigrationRestoreStrategy(org.apache.flink.migration.runtime.state.memory.AbstractMigrationRestoreStrategy) FileSystem(org.apache.flink.core.fs.FileSystem) FSDataInputStream(org.apache.flink.core.fs.FSDataInputStream) DataInputViewStreamWrapper(org.apache.flink.core.memory.DataInputViewStreamWrapper)

Aggregations

FSDataInputStream (org.apache.flink.core.fs.FSDataInputStream)1 FileSystem (org.apache.flink.core.fs.FileSystem)1 DataInputViewStreamWrapper (org.apache.flink.core.memory.DataInputViewStreamWrapper)1 AbstractMigrationRestoreStrategy (org.apache.flink.migration.runtime.state.memory.AbstractMigrationRestoreStrategy)1