+ interface SerialForm extends Externalizable {
+
+ ShardSnapshotState snapshotState();
+
+ void resolveTo(@NonNull ShardSnapshotState newSnapshotState);
+
+ Object readResolve();
+
+ @Override
+ default void readExternal(final ObjectInput in) throws IOException {
+ resolveTo(ShardDataTreeSnapshot.deserialize(in));
+ }
+
+ @Override
+ default void writeExternal(final ObjectOutput out) throws IOException {
+ snapshotState().getSnapshot().serialize(out);
+ }
+ }
+
+ private static final class Proxy implements SerialForm {