Пример #1
0
 private SnapshotDescription toSnapshotDescription(ProcedureDescription desc) throws IOException {
   SnapshotDescription.Builder builder = SnapshotDescription.newBuilder();
   if (!desc.hasInstance()) {
     throw new IOException("Snapshot name is not defined: " + desc.toString());
   }
   String snapshotName = desc.getInstance();
   List<NameStringPair> props = desc.getConfigurationList();
   String table = null;
   for (NameStringPair prop : props) {
     if ("table".equalsIgnoreCase(prop.getName())) {
       table = prop.getValue();
     }
   }
   if (table == null) {
     throw new IOException("Snapshot table is not defined: " + desc.toString());
   }
   TableName tableName = TableName.valueOf(table);
   builder.setTable(tableName.getNameAsString());
   builder.setName(snapshotName);
   builder.setType(SnapshotDescription.Type.FLUSH);
   return builder.build();
 }