@PublicEvolving public abstract class SimpleTypeSerializerSnapshot<T> extends Object implements TypeSerializerSnapshot<T>
Serializers that produce these snapshots must be public, have public a zero-argument constructor and cannot be a non-static inner classes.
Constructor and Description |
---|
SimpleTypeSerializerSnapshot(Supplier<? extends TypeSerializer<T>> serializerSupplier)
Constructor to create snapshot from serializer (writing the snapshot).
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getCurrentVersion()
Returns the version of the current snapshot's written binary format.
|
int |
hashCode() |
void |
readSnapshot(int readVersion,
DataInputView in,
ClassLoader classLoader)
Reads the serializer snapshot from the provided
DataInputView . |
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.
|
String |
toString() |
void |
writeSnapshot(DataOutputView out)
Writes the serializer snapshot to the provided
DataOutputView . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
readVersionedSnapshot, resolveSchemaCompatibility, writeVersionedSnapshot
public SimpleTypeSerializerSnapshot(@Nonnull Supplier<? extends TypeSerializer<T>> serializerSupplier)
public int getCurrentVersion()
TypeSerializerSnapshot
getCurrentVersion
in interface TypeSerializerSnapshot<T>
public TypeSerializer<T> restoreSerializer()
TypeSerializerSnapshot
restoreSerializer
in interface TypeSerializerSnapshot<T>
public TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)
TypeSerializerSnapshot
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.
resolveSchemaCompatibility
in interface TypeSerializerSnapshot<T>
oldSerializerSnapshot
- the old serializer snapshot to check.public void writeSnapshot(DataOutputView out) throws IOException
TypeSerializerSnapshot
DataOutputView
. The current version of
the written serializer snapshot's binary format is specified by the TypeSerializerSnapshot.getCurrentVersion()
method.writeSnapshot
in interface TypeSerializerSnapshot<T>
out
- the DataOutputView
to write the snapshot to.IOException
- Thrown if the snapshot data could not be written.TypeSerializerSnapshot.writeVersionedSnapshot(DataOutputView, TypeSerializerSnapshot)
public void readSnapshot(int readVersion, DataInputView in, ClassLoader classLoader) throws IOException
TypeSerializerSnapshot
DataInputView
. 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.readSnapshot
in interface TypeSerializerSnapshot<T>
readVersion
- version of the serializer snapshot's written binary formatin
- the DataInputView
to read the snapshot from.classLoader
- the user code classloaderIOException
- Thrown if the snapshot data could be read or parsed.TypeSerializerSnapshot.readVersionedSnapshot(DataInputView, ClassLoader)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.