本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo类的典型用法代码示例。如果您正苦于以下问题:Java RegionInfo类的具体用法?Java RegionInfo怎么用?Java RegionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionInfo类属于org.apache.hadoop.hbase.protobuf.generated.HBaseProtos包,在下文中一共展示了RegionInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Convert a HRegionInfo to a RegionInfo
*
* @param info the HRegionInfo to convert
* @return the converted RegionInfo
*/
public static RegionInfo convert(final HRegionInfo info) {
if (info == null) return null;
RegionInfo.Builder builder = RegionInfo.newBuilder();
builder.setTableName(ProtobufUtil.toProtoTableName(info.getTable()));
builder.setRegionId(info.getRegionId());
if (info.getStartKey() != null) {
builder.setStartKey(ByteStringer.wrap(info.getStartKey()));
}
if (info.getEndKey() != null) {
builder.setEndKey(ByteStringer.wrap(info.getEndKey()));
}
builder.setOffline(info.isOffline());
builder.setSplit(info.isSplit());
builder.setReplicaId(info.getReplicaId());
return builder.build();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:HRegionInfo.java
示例2: convert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Convert a HRegionInfo to a RegionInfo
*
* @param info the HRegionInfo to convert
* @return the converted RegionInfo
*/
public static RegionInfo convert(final HRegionInfo info) {
if (info == null) return null;
RegionInfo.Builder builder = RegionInfo.newBuilder();
builder.setTableName(ProtobufUtil.toProtoTableName(info.getTable()));
builder.setRegionId(info.getRegionId());
if (info.getStartKey() != null) {
builder.setStartKey(HBaseZeroCopyByteString.wrap(info.getStartKey()));
}
if (info.getEndKey() != null) {
builder.setEndKey(HBaseZeroCopyByteString.wrap(info.getEndKey()));
}
builder.setOffline(info.isOffline());
builder.setSplit(info.isSplit());
return builder.build();
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:22,代码来源:HRegionInfo.java
示例3: convert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Convert a HRegionInfo to a RegionInfo
*
* @param info the HRegionInfo to convert
* @return the converted RegionInfo
*/
public static RegionInfo convert(final HRegionInfo info) {
if (info == null) return null;
RegionInfo.Builder builder = RegionInfo.newBuilder();
builder.setTableName(ProtobufUtil.toProtoTableName(info.getTable()));
builder.setRegionId(info.getRegionId());
if (info.getStartKey() != null) {
builder.setStartKey(ZeroCopyLiteralByteString.wrap(info.getStartKey()));
}
if (info.getEndKey() != null) {
builder.setEndKey(ZeroCopyLiteralByteString.wrap(info.getEndKey()));
}
builder.setOffline(info.isOffline());
builder.setSplit(info.isSplit());
return builder.build();
}
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:22,代码来源:HRegionInfo.java
示例4: convert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Convert a HRegionInfo to a RegionInfo
*
* @param info the HRegionInfo to convert
* @return the converted RegionInfo
*/
public static RegionInfo convert(final HRegionInfo info) {
if (info == null) return null;
RegionInfo.Builder builder = RegionInfo.newBuilder();
builder.setTableName(ByteString.copyFrom(info.getTableName()));
builder.setRegionId(info.getRegionId());
if (info.getStartKey() != null) {
builder.setStartKey(ByteString.copyFrom(info.getStartKey()));
}
if (info.getEndKey() != null) {
builder.setEndKey(ByteString.copyFrom(info.getEndKey()));
}
builder.setOffline(info.isOffline());
builder.setSplit(info.isSplit());
return builder.build();
}
开发者ID:daidong,项目名称:DominoHBase,代码行数:22,代码来源:HRegionInfo.java
示例5: testConvert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
@Test
public void testConvert() {
TableName tableName = TableName.valueOf("ns1:table1");
byte[] startKey = Bytes.toBytes("startKey");
byte[] endKey = Bytes.toBytes("endKey");
boolean split = false;
long regionId = System.currentTimeMillis();
int replicaId = 42;
HRegionInfo hri = new HRegionInfo(tableName, startKey, endKey, split,
regionId, replicaId);
// convert two times, compare
HRegionInfo convertedHri = HRegionInfo.convert(HRegionInfo.convert(hri));
assertEquals(hri, convertedHri);
// test convert RegionInfo without replicaId
RegionInfo info = RegionInfo.newBuilder()
.setTableName(HBaseProtos.TableName.newBuilder()
.setQualifier(ByteString.copyFrom(tableName.getQualifier()))
.setNamespace(ByteString.copyFrom(tableName.getNamespace()))
.build())
.setStartKey(ByteString.copyFrom(startKey))
.setEndKey(ByteString.copyFrom(endKey))
.setSplit(split)
.setRegionId(regionId)
.build();
convertedHri = HRegionInfo.convert(info);
HRegionInfo expectedHri = new HRegionInfo(tableName, startKey, endKey, split,
regionId, 0); // expecting default replicaId
assertEquals(expectedHri, convertedHri);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:TestHRegionInfo.java
示例6: getRegionInfos
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Get the list of region info from a GetOnlineRegionResponse
*
* @param proto the GetOnlineRegionResponse
* @return the list of region info or null if <code>proto</code> is null
*/
static List<HRegionInfo> getRegionInfos(final GetOnlineRegionResponse proto) {
if (proto == null) return null;
List<HRegionInfo> regionInfos = new ArrayList<HRegionInfo>();
for (RegionInfo regionInfo: proto.getRegionInfoList()) {
regionInfos.add(HRegionInfo.convert(regionInfo));
}
return regionInfos;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:ProtobufUtil.java
示例7: convert
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Convert a HRegionInfo to a RegionInfo
*
* @param info the HRegionInfo to convert
* @return the converted RegionInfo
*/
public static RegionInfo convert(final HRegionInfo info) {
if (info == null) return null;
RegionInfo.Builder builder = RegionInfo.newBuilder();
builder.setTableName(ProtobufUtil.toProtoTableName(info.getTable()));
builder.setRegionId(info.getRegionId());
if (info.getStartKey() != null) {
builder.setStartKey(HBaseZeroCopyByteString.wrap(info.getStartKey()));
}
if (info.getEndKey() != null) {
builder.setEndKey(HBaseZeroCopyByteString.wrap(info.getEndKey()));
}
builder.setOffline(info.isOffline());
builder.setSplit(info.isSplit());
// Shen Li: splitKeys
if (null != info.splitKeys) {
for (byte [] splitKey : info.splitKeys) {
builder.addSplitKey(HBaseZeroCopyByteString.wrap(splitKey));
}
}
if (null != info.replicaGroupIds) {
for (int rgId : info.replicaGroupIds) {
builder.addRgId(rgId);
}
}
if (null != info.replicaNamespace)
builder.setReplicaNamespace(info.replicaNamespace);
// Shen Li: split-move
if (null != info.destHostname)
builder.setDestHostname(info.destHostname);
return builder.build();
}
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:38,代码来源:HRegionInfo.java
示例8: warmupRegion
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo; //导入依赖的package包/类
/**
* Wamrmup a region on this server.
*
* This method should only be called by Master. It synchrnously opens the region and
* closes the region bringing the most important pages in cache.
* <p>
*
* @param controller the RPC controller
* @param request the request
* @throws ServiceException
*/
@Override
public WarmupRegionResponse warmupRegion(final RpcController controller,
final WarmupRegionRequest request) throws ServiceException {
RegionInfo regionInfo = request.getRegionInfo();
final HRegionInfo region = HRegionInfo.convert(regionInfo);
HTableDescriptor htd;
WarmupRegionResponse response = WarmupRegionResponse.getDefaultInstance();
try {
checkOpen();
String encodedName = region.getEncodedName();
byte[] encodedNameBytes = region.getEncodedNameAsBytes();
final Region onlineRegion = regionServer.getFromOnlineRegions(encodedName);
if (onlineRegion != null) {
LOG.info("Region already online. Skipping warming up " + region);
return response;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Warming up Region " + region.getRegionNameAsString());
}
htd = regionServer.tableDescriptors.get(region.getTable());
if (regionServer.getRegionsInTransitionInRS().containsKey(encodedNameBytes)) {
LOG.info("Region is in transition. Skipping warmup " + region);
return response;
}
HRegion.warmupHRegion(region, htd, regionServer.getWAL(region),
regionServer.getConfiguration(), regionServer, null);
} catch (IOException ie) {
LOG.error("Failed warming up region " + region.getRegionNameAsString(), ie);
throw new ServiceException(ie);
}
return response;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:53,代码来源:RSRpcServices.java
注:本文中的org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论