use of edu.snu.mist.formats.avro.AvroPhysicalSourceOutgoingEdgesInfo in project mist by snuspl.
the class AvroExecutionVertexStore method saveAvroPhysicalSourceOutgoingEdgesInfo.
/**
* Saves the AvroPhysicalSourceOutgoingEdgesInfo of the source to be reactivated.
*/
public void saveAvroPhysicalSourceOutgoingEdgesInfo(final Tuple<String, AvroPhysicalSourceOutgoingEdgesInfo> tuple) {
try {
final AvroPhysicalSourceOutgoingEdgesInfo avroPhysicalSourceOutgoingEdgesInfo = tuple.getValue();
// Create file with the name of the PhysicalOperatorChain Id.
final File avroPhysicalSourceOutgoingEdgesInfoFile = getAvroPhysicalSourceOutgoingEdgesInfoFile(tuple.getKey());
final DataFileWriter<AvroPhysicalSourceOutgoingEdgesInfo> dataFileWriter = new DataFileWriter<>(sourceDatumWriter);
dataFileWriter.create(avroPhysicalSourceOutgoingEdgesInfo.getSchema(), avroPhysicalSourceOutgoingEdgesInfoFile);
dataFileWriter.append(avroPhysicalSourceOutgoingEdgesInfo);
dataFileWriter.close();
} catch (IOException e) {
throw new RuntimeException("Writing AvroPhysicalSourceOutgoingEdgesInfo has failed.");
}
}
use of edu.snu.mist.formats.avro.AvroPhysicalSourceOutgoingEdgesInfo in project mist by snuspl.
the class AvroExecutionVertexStore method loadAvroPhysicalSourceOutgoingEdgesInfoFromFile.
// TODO: [MIST-*] Implement policy for deleting from disk. Currently does not delete from disk.
private AvroPhysicalSourceOutgoingEdgesInfo loadAvroPhysicalSourceOutgoingEdgesInfoFromFile(final File storedSource) {
try {
final DataFileReader<AvroPhysicalSourceOutgoingEdgesInfo> dataFileReader = new DataFileReader<>(storedSource, sourceDatumReader);
AvroPhysicalSourceOutgoingEdgesInfo avroPhysicalSourceOutgoingEdgesInfo = null;
avroPhysicalSourceOutgoingEdgesInfo = dataFileReader.next(avroPhysicalSourceOutgoingEdgesInfo);
return avroPhysicalSourceOutgoingEdgesInfo;
} catch (IOException e) {
throw new RuntimeException("Loading AvroPhysicalSourceOutgoingEdgesInfo has failed.");
}
}
Aggregations