Java 类org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest 实例源码

项目:ditb    文件:SnapshotManifest.java   
private void writeDataManifest(final SnapshotDataManifest manifest)
    throws IOException {
  FSDataOutputStream stream = fs.create(new Path(workingDir, DATA_MANIFEST_NAME));
  try {
    manifest.writeTo(stream);
  } finally {
    stream.close();
  }
}
项目:ditb    文件:SnapshotManifest.java   
private SnapshotDataManifest readDataManifest() throws IOException {
  FSDataInputStream in = null;
  try {
    in = fs.open(new Path(workingDir, DATA_MANIFEST_NAME));
    CodedInputStream cin = CodedInputStream.newInstance(in);
    cin.setSizeLimit(manifestSizeLimit);
    return SnapshotDataManifest.parseFrom(cin);
  } catch (FileNotFoundException e) {
    return null;
  } finally {
    if (in != null) in.close();
  }
}
项目:ditb    文件:TestSnapshotManifest.java   
private void writeDataManifest(final SnapshotDataManifest manifest)
    throws IOException {
  FSDataOutputStream stream = fs.create(new Path(snapshotDir, SnapshotManifest.DATA_MANIFEST_NAME));
  try {
    manifest.writeTo(stream);
  } finally {
    stream.close();
  }
}
项目:pbase    文件:SnapshotManifest.java   
private void writeDataManifest(final SnapshotDataManifest manifest)
    throws IOException {
  FSDataOutputStream stream = fs.create(new Path(workingDir, DATA_MANIFEST_NAME));
  try {
    manifest.writeTo(stream);
  } finally {
    stream.close();
  }
}
项目:pbase    文件:SnapshotManifest.java   
private SnapshotDataManifest readDataManifest() throws IOException {
  FSDataInputStream in = null;
  try {
    in = fs.open(new Path(workingDir, DATA_MANIFEST_NAME));
    return SnapshotDataManifest.parseFrom(in);
  } catch (FileNotFoundException e) {
    return null;
  } finally {
    if (in != null) in.close();
  }
}
项目:PyroDB    文件:SnapshotManifest.java   
private void writeDataManifest(final SnapshotDataManifest manifest)
    throws IOException {
  FSDataOutputStream stream = fs.create(new Path(workingDir, DATA_MANIFEST_NAME));
  try {
    manifest.writeTo(stream);
  } finally {
    stream.close();
  }
}
项目:PyroDB    文件:SnapshotManifest.java   
private SnapshotDataManifest readDataManifest() throws IOException {
  FSDataInputStream in = null;
  try {
    in = fs.open(new Path(workingDir, DATA_MANIFEST_NAME));
    return SnapshotDataManifest.parseFrom(in);
  } catch (FileNotFoundException e) {
    return null;
  } finally {
    if (in != null) in.close();
  }
}
项目:ditb    文件:TestSnapshotManifest.java   
@Before
public void setup() throws Exception {
  TEST_UTIL = HBaseTestingUtility.createLocalHTU();

  rootDir = TEST_UTIL.getDataTestDir(TABLE_NAME_STR);
  fs = TEST_UTIL.getTestFileSystem();
  conf = TEST_UTIL.getConfiguration();

  SnapshotTestingUtils.SnapshotMock snapshotMock =
    new SnapshotTestingUtils.SnapshotMock(conf, fs, rootDir);
  SnapshotTestingUtils.SnapshotMock.SnapshotBuilder builder =
    snapshotMock.createSnapshotV2("snapshot", TABLE_NAME_STR, 0);
  snapshotDir = builder.commit();
  snapshotDesc = builder.getSnapshotDescription();

  SnapshotDataManifest.Builder dataManifestBuilder =
    SnapshotDataManifest.newBuilder();
  byte[] startKey = null;
  byte[] stopKey = null;
  for (int i = 1; i <= TEST_NUM_REGIONS; i++) {
    stopKey = Bytes.toBytes(String.format("%016d", i));
    HRegionInfo regionInfo = new HRegionInfo(TABLE_NAME, startKey, stopKey, false);
    SnapshotRegionManifest.Builder dataRegionManifestBuilder =
      SnapshotRegionManifest.newBuilder();

    for (HColumnDescriptor hcd: builder.getTableDescriptor().getFamilies()) {
      SnapshotRegionManifest.FamilyFiles.Builder family =
          SnapshotRegionManifest.FamilyFiles.newBuilder();
      family.setFamilyName(ByteStringer.wrap(hcd.getName()));
      for (int j = 0; j < 100; ++j) {
        SnapshotRegionManifest.StoreFile.Builder sfManifest =
          SnapshotRegionManifest.StoreFile.newBuilder();
        sfManifest.setName(String.format("%032d", i));
        sfManifest.setFileSize((1 + i) * (1 + i) * 1024);
        family.addStoreFiles(sfManifest.build());
      }
      dataRegionManifestBuilder.addFamilyFiles(family.build());
    }

    dataRegionManifestBuilder.setRegionInfo(HRegionInfo.convert(regionInfo));
    dataManifestBuilder.addRegionManifests(dataRegionManifestBuilder.build());

    startKey = stopKey;
  }

  dataManifestBuilder.setTableSchema(builder.getTableDescriptor().convert());

  SnapshotDataManifest dataManifest = dataManifestBuilder.build();
  writeDataManifest(dataManifest);
}