当前位置: 首页>>代码示例>>Java>>正文


Java SnapshotDataManifest类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest的典型用法代码示例。如果您正苦于以下问题:Java SnapshotDataManifest类的具体用法?Java SnapshotDataManifest怎么用?Java SnapshotDataManifest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SnapshotDataManifest类属于org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos包,在下文中一共展示了SnapshotDataManifest类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeDataManifest

import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest; //导入依赖的package包/类
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();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:SnapshotManifest.java

示例2: readDataManifest

import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest; //导入依赖的package包/类
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();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:SnapshotManifest.java

示例3: writeDataManifest

import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest; //导入依赖的package包/类
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();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:TestSnapshotManifest.java

示例4: readDataManifest

import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest; //导入依赖的package包/类
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();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:12,代码来源:SnapshotManifest.java

示例5: setup

import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest; //导入依赖的package包/类
@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);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:51,代码来源:TestSnapshotManifest.java


注:本文中的org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotDataManifest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。