use of org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType in project hbase by apache.
the class ProtobufUtil method getRegionEncodedName.
/**
* Find the HRegion encoded name based on a region specifier
*
* @param regionSpecifier the region specifier
* @return the corresponding region's encoded name
* @throws DoNotRetryIOException if the specifier type is unsupported
*/
public static String getRegionEncodedName(final RegionSpecifier regionSpecifier) throws DoNotRetryIOException {
ByteString value = regionSpecifier.getValue();
RegionSpecifierType type = regionSpecifier.getType();
switch(type) {
case REGION_NAME:
return HRegionInfo.encodeRegionName(value.toByteArray());
case ENCODED_REGION_NAME:
return value.toStringUtf8();
default:
throw new DoNotRetryIOException("Unsupported region specifier type: " + type);
}
}
Aggregations