use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetRegionStateInMetaRequest in project hbase by apache.
the class RequestConverter method buildSetRegionStateInMetaRequest.
/**
* Creates a protocol buffer SetRegionStateInMetaRequest
* @param nameOrEncodedName2State list of regions states to update in Meta
* @return a SetRegionStateInMetaRequest
*/
public static SetRegionStateInMetaRequest buildSetRegionStateInMetaRequest(Map<String, RegionState.State> nameOrEncodedName2State) {
SetRegionStateInMetaRequest.Builder builder = SetRegionStateInMetaRequest.newBuilder();
nameOrEncodedName2State.forEach((name, state) -> {
byte[] bytes = Bytes.toBytes(name);
RegionSpecifier spec;
if (RegionInfo.isEncodedRegionName(bytes)) {
spec = buildRegionSpecifier(RegionSpecifierType.ENCODED_REGION_NAME, bytes);
} else {
spec = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, bytes);
}
builder.addStates(RegionSpecifierAndState.newBuilder().setRegionSpecifier(spec).setState(state.convert()).build());
});
return builder.build();
}
Aggregations