@Override public void write(DataOutputView out) throws IOException { out.write(VERSIONED_IDENTIFIER); super.write(out); }
/** * Binary format layout of a written serializer snapshot is as follows: * * <ul> * <li>1. Format version of this util.</li> * <li>2. Name of the TypeSerializerSnapshot class.</li> * <li>3. The version of the TypeSerializerSnapshot's binary format.</li> * <li>4. The actual serializer snapshot data.</li> * </ul> */ @SuppressWarnings("deprecation") @Override public void write(DataOutputView out) throws IOException { setSerializerForWriteIfOldPath(serializerSnapshot, serializer); // write the format version of this utils format super.write(out); TypeSerializerSnapshot.writeVersionedSnapshot(out, serializerSnapshot); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); out.writeUTF(data); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); if (typeSerializer instanceof UnloadableDummyTypeSerializer) { UnloadableDummyTypeSerializer<T> dummyTypeSerializer = (UnloadableDummyTypeSerializer<T>) this.typeSerializer; byte[] serializerBytes = dummyTypeSerializer.getActualBytes(); out.write(serializerBytes.length); out.write(serializerBytes); } else { // write in a way that allows the stream to recover from exceptions try (ByteArrayOutputStreamWithPos streamWithPos = new ByteArrayOutputStreamWithPos()) { InstantiationUtil.serializeObject(streamWithPos, typeSerializer); out.writeInt(streamWithPos.getPosition()); out.write(streamWithPos.getBuf(), 0, streamWithPos.getPosition()); } } }
@Override public void write(DataOutputView out) throws IOException { out.write(VERSIONED_IDENTIFIER); super.write(out); }
@Override public void write(DataOutputView out) throws IOException { out.write(VERSIONED_IDENTIFIER); super.write(out); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // config snapshot class, so that we can re-instantiate the // correct type of config snapshot instance when deserializing out.writeUTF(serializerConfigSnapshot.getClass().getName()); // the actual configuration parameters serializerConfigSnapshot.write(out); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); writeStateMetaInfoSnapshots(operatorStateMetaInfoSnapshots, out); writeStateMetaInfoSnapshots(broadcastStateMetaInfoSnapshots, out); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); writeStateMetaInfoSnapshots(operatorStateMetaInfoSnapshots, out); writeStateMetaInfoSnapshots(broadcastStateMetaInfoSnapshots, out); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); out.writeShort(stateMetaInfoSnapshots.size()); for (RegisteredOperatorBackendStateMetaInfo.Snapshot<?> kvState : stateMetaInfoSnapshots) { OperatorBackendStateMetaInfoSnapshotReaderWriters .getWriterForVersion(VERSION, kvState) .writeStateMetaInfo(out); } }
/** * Binary format layout of a written serializer snapshot is as follows: * * <ul> * <li>1. Format version of this util.</li> * <li>2. Name of the TypeSerializerSnapshot class.</li> * <li>3. The version of the TypeSerializerSnapshot's binary format.</li> * <li>4. The actual serializer snapshot data.</li> * </ul> */ @SuppressWarnings("deprecation") @Override public void write(DataOutputView out) throws IOException { setSerializerForWriteIfOldPath(serializerSnapshot, serializer); // write the format version of this utils format super.write(out); TypeSerializerSnapshot.writeVersionedSnapshot(out, serializerSnapshot); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // write the compression format used to write each key-group out.writeBoolean(usingKeyGroupCompression); writeStateMetaInfoSnapshot(out, keyedStateMetaInfoSnapshots, true); writeStateMetaInfoSnapshot(out, subKeyedStateMetaInfoSnapshots, false); }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // write in a way to be fault tolerant of read failures when deserializing the key serializer TypeSerializerSerializationUtil.writeSerializersAndConfigsWithResilience( out, Collections.singletonList( new Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>(keySerializer, keySerializerConfigSnapshot))); // write individual registered keyed state metainfos out.writeShort(stateMetaInfoSnapshots.size()); for (RegisteredKeyedBackendStateMetaInfo.Snapshot<?, ?> metaInfo : stateMetaInfoSnapshots) { KeyedBackendStateMetaInfoSnapshotReaderWriters .getWriterForVersion(VERSION, metaInfo) .writeStateMetaInfo(out); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // write the compression format used to write each key-group out.writeBoolean(usingKeyGroupCompression); TypeSerializerSnapshotSerializationUtil.writeSerializerSnapshot(out, keySerializerConfigSnapshot, keySerializer); // write individual registered keyed state metainfos out.writeShort(stateMetaInfoSnapshots.size()); for (StateMetaInfoSnapshot metaInfoSnapshot : stateMetaInfoSnapshots) { StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(metaInfoSnapshot, out); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // write the compression format used to write each key-group out.writeBoolean(usingKeyGroupCompression); TypeSerializerSnapshotSerializationUtil.writeSerializerSnapshot(out, keySerializerConfigSnapshot, keySerializer); // write individual registered keyed state metainfos out.writeShort(stateMetaInfoSnapshots.size()); for (StateMetaInfoSnapshot metaInfoSnapshot : stateMetaInfoSnapshots) { StateMetaInfoSnapshotReadersWriters.getWriter().writeStateMetaInfoSnapshot(metaInfoSnapshot, out); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); out.writeShort(operatorStateMetaInfoSnapshots.size()); for (RegisteredOperatorBackendStateMetaInfo.Snapshot<?> state : operatorStateMetaInfoSnapshots) { OperatorBackendStateMetaInfoSnapshotReaderWriters .getOperatorStateWriterForVersion(VERSION, state) .writeOperatorStateMetaInfo(out); } out.writeShort(broadcastStateMetaInfoSnapshots.size()); for (RegisteredBroadcastBackendStateMetaInfo.Snapshot<?, ?> state : broadcastStateMetaInfoSnapshots) { OperatorBackendStateMetaInfoSnapshotReaderWriters .getBroadcastStateWriterForVersion(VERSION, state) .writeBroadcastStateMetaInfo(out); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); // write the compression format used to write each key-group out.writeBoolean(usingKeyGroupCompression); // write in a way to be fault tolerant of read failures when deserializing the key serializer TypeSerializerSerializationUtil.writeSerializersAndConfigsWithResilience( out, Collections.singletonList( new Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>(keySerializer, keySerializerConfigSnapshot))); // write individual registered keyed state metainfos out.writeShort(stateMetaInfoSnapshots.size()); for (RegisteredKeyedBackendStateMetaInfo.Snapshot<?, ?> metaInfo : stateMetaInfoSnapshots) { KeyedBackendStateMetaInfoSnapshotReaderWriters .getWriterForVersion(VERSION, metaInfo) .writeStateMetaInfo(out); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); if (typeSerializer instanceof UnloadableDummyTypeSerializer) { UnloadableDummyTypeSerializer<T> dummyTypeSerializer = (UnloadableDummyTypeSerializer<T>) this.typeSerializer; byte[] serializerBytes = dummyTypeSerializer.getActualBytes(); out.write(serializerBytes.length); out.write(serializerBytes); } else { // write in a way that allows the stream to recover from exceptions try (ByteArrayOutputStreamWithPos streamWithPos = new ByteArrayOutputStreamWithPos()) { InstantiationUtil.serializeObject(streamWithPos, typeSerializer); out.writeInt(streamWithPos.getPosition()); out.write(streamWithPos.getBuf(), 0, streamWithPos.getPosition()); } } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); if (typeSerializer instanceof UnloadableDummyTypeSerializer) { UnloadableDummyTypeSerializer<T> dummyTypeSerializer = (UnloadableDummyTypeSerializer<T>) this.typeSerializer; byte[] serializerBytes = dummyTypeSerializer.getActualBytes(); out.write(serializerBytes.length); out.write(serializerBytes); } else { // write in a way that allows the stream to recover from exceptions try (ByteArrayOutputStreamWithPos streamWithPos = new ByteArrayOutputStreamWithPos()) { InstantiationUtil.serializeObject(streamWithPos, typeSerializer); out.writeInt(streamWithPos.getPosition()); out.write(streamWithPos.getBuf(), 0, streamWithPos.getPosition()); } } }