本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}