Class GenericTypeSerializerSnapshot<T,S extends TypeSerializer>
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.GenericTypeSerializerSnapshot<T,S>
-
- Type Parameters:
T- The type to be instantiated.
- All Implemented Interfaces:
TypeSerializerSnapshot<T>
- Direct Known Subclasses:
CopyableValueSerializer.CopyableValueSerializerSnapshot,ValueSerializer.ValueSerializerSnapshot
@Internal public abstract class GenericTypeSerializerSnapshot<T,S extends TypeSerializer> extends Object implements TypeSerializerSnapshot<T>
BaseTypeSerializerSnapshotfor serializers for generic types.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGenericTypeSerializerSnapshot()protectedGenericTypeSerializerSnapshot(Class<T> typeClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TypeSerializer<T>createSerializer(Class<T> typeClass)Create a serializer that is able to serialize the generic typetypeClass.intgetCurrentVersion()Returns the version of the current snapshot's written binary format.protected abstract Class<T>getTypeClass(S serializer)Gets the type class from the corresponding serializer.voidreadSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader)Reads the serializer snapshot from the providedDataInputView.TypeSerializerSchemaCompatibility<T>resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)Checks current serializer's compatibility to read data written by the prior serializer.TypeSerializer<T>restoreSerializer()Recreates a serializer instance from this snapshot.protected abstract Class<?>serializerClass()Gets the serializer's class.voidwriteSnapshot(DataOutputView out)Writes the serializer snapshot to the providedDataOutputView.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.typeutils.TypeSerializerSnapshot
resolveSchemaCompatibility
-
-
-
-
Method Detail
-
createSerializer
protected abstract TypeSerializer<T> createSerializer(Class<T> typeClass)
Create a serializer that is able to serialize the generic typetypeClass.
-
getTypeClass
protected abstract Class<T> getTypeClass(S serializer)
Gets the type class from the corresponding serializer.
-
serializerClass
protected abstract Class<?> serializerClass()
Gets the serializer's class.
-
getCurrentVersion
public final int getCurrentVersion()
Description copied from interface:TypeSerializerSnapshotReturns the version of the current snapshot's written binary format.- Specified by:
getCurrentVersionin interfaceTypeSerializerSnapshot<T>- Returns:
- the version of the current snapshot's written binary format.
-
writeSnapshot
public final void writeSnapshot(DataOutputView out) throws IOException
Description copied from interface:TypeSerializerSnapshotWrites the serializer snapshot to the providedDataOutputView. The current version of the written serializer snapshot's binary format is specified by theTypeSerializerSnapshot.getCurrentVersion()method.- Specified by:
writeSnapshotin interfaceTypeSerializerSnapshot<T>- Parameters:
out- theDataOutputViewto write the snapshot to.- Throws:
IOException- Thrown if the snapshot data could not be written.- See Also:
TypeSerializerSnapshot.writeVersionedSnapshot(DataOutputView, TypeSerializerSnapshot)
-
readSnapshot
public final void readSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOExceptionDescription copied from interface:TypeSerializerSnapshotReads the serializer snapshot from the providedDataInputView. The version of the binary format that the serializer snapshot was written with is provided. This version can be used to determine how the serializer snapshot should be read.- Specified by:
readSnapshotin interfaceTypeSerializerSnapshot<T>- Parameters:
readVersion- version of the serializer snapshot's written binary formatin- theDataInputViewto read the snapshot from.userCodeClassLoader- the user code classloader- Throws:
IOException- Thrown if the snapshot data could be read or parsed.- See Also:
TypeSerializerSnapshot.readVersionedSnapshot(DataInputView, ClassLoader)
-
restoreSerializer
public final TypeSerializer<T> restoreSerializer()
Description copied from interface:TypeSerializerSnapshotRecreates a serializer instance from this snapshot. The returned serializer can be safely used to read data written by the prior serializer (i.e., the serializer that created this snapshot).- Specified by:
restoreSerializerin interfaceTypeSerializerSnapshot<T>- Returns:
- a serializer instance restored from this serializer snapshot.
-
resolveSchemaCompatibility
public final TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)
Description copied from interface:TypeSerializerSnapshotChecks current serializer's compatibility to read data written by the prior serializer.When a checkpoint/savepoint is restored, this method checks whether the serialization format of the data in the checkpoint/savepoint is compatible for the format of the serializer used by the program that restores the checkpoint/savepoint. The outcome can be that the serialization format is compatible, that the program's serializer needs to reconfigure itself (meaning to incorporate some information from the TypeSerializerSnapshot to be compatible), that the format is outright incompatible, or that a migration needed. In the latter case, the TypeSerializerSnapshot produces a serializer to deserialize the data, and the restoring program's serializer re-serializes the data, thus converting the format during the restore operation.
This method must be implemented to clarify the compatibility. See FLIP-263 for more details.
- Specified by:
resolveSchemaCompatibilityin interfaceTypeSerializerSnapshot<T>- Parameters:
oldSerializerSnapshot- the old serializer snapshot to check.- Returns:
- the serializer compatibility result.
-
-