in priam/src/main/java/com/netflix/priam/backupv2/MetaFileReader.java [48:80]
public void readMeta(Path metaFilePath) throws IOException {
// Validate if meta file exists and is right file name.
if (metaFilePath == null
|| !metaFilePath.toFile().exists()
|| !metaFilePath.toFile().isFile()
|| !isValidMetaFile(metaFilePath)) {
throw new FileNotFoundException(
"MetaFilePath: " + metaFilePath + " do not exist or is not valid meta file.");
}
// Read the meta file.
logger.info("Trying to read the meta file: {}", metaFilePath);
JsonReader jsonReader = new JsonReader(new FileReader(metaFilePath.toFile()));
jsonReader.beginObject();
while (jsonReader.hasNext()) {
switch (jsonReader.nextName()) {
case MetaFileInfo.META_FILE_INFO:
metaFileInfo =
GsonJsonSerializer.getGson().fromJson(jsonReader, MetaFileInfo.class);
break;
case MetaFileInfo.META_FILE_DATA:
jsonReader.beginArray();
while (jsonReader.hasNext())
process(
GsonJsonSerializer.getGson()
.fromJson(jsonReader, ColumnFamilyResult.class));
jsonReader.endArray();
}
}
jsonReader.endObject();
jsonReader.close();
logger.info("Finished reading the meta file: {}", metaFilePath);
}