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


Java ScanRequest.Builder方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java ScanRequest.Builder方法的具体用法?Java ScanRequest.Builder怎么用?Java ScanRequest.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest的用法示例。


在下文中一共展示了ScanRequest.Builder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Override
public ScanResponse scan(RpcController controller, ScanRequest request) 
    throws ServiceException {
  ScanRequest.Builder builder = ScanRequest.newBuilder(request);
  builder.setClientHandlesHeartbeats(heartbeatsEnabled);
  return super.scan(controller, builder.build());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestScannerHeartbeatMessages.java

示例2: buildScanRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
/**
 * Create a protocol buffer ScanRequest for a client Scan
 *
 * @param regionName
 * @param scan
 * @param numberOfRows
 * @param closeScanner
 * @return a scan request
 * @throws IOException
 */
public static ScanRequest buildScanRequest(final byte[] regionName, final Scan scan,
    final int numberOfRows, final boolean closeScanner) throws IOException {
  ScanRequest.Builder builder = ScanRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setNumberOfRows(numberOfRows);
  builder.setCloseScanner(closeScanner);
  builder.setRegion(region);
  builder.setScan(ProtobufUtil.toScan(scan));
  builder.setClientHandlesPartials(true);
  builder.setClientHandlesHeartbeats(true);
  builder.setTrackScanMetrics(scan.isScanMetricsEnabled());
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:RequestConverter.java

示例3: buildScanRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
/**
 * Create a protocol buffer ScanRequest for a client Scan
 *
 * @param regionName
 * @param scan
 * @param numberOfRows
 * @param closeScanner
 * @return a scan request
 * @throws IOException
 */
public static ScanRequest buildScanRequest(final byte[] regionName,
    final Scan scan, final int numberOfRows,
      final boolean closeScanner) throws IOException {
  ScanRequest.Builder builder = ScanRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setNumberOfRows(numberOfRows);
  builder.setCloseScanner(closeScanner);
  builder.setRegion(region);
  builder.setScan(ProtobufUtil.toScan(scan));
  return builder.build();
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:23,代码来源:RequestConverter.java

示例4: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RpcRequestBody.Builder rpcRequestBuilder = RpcRequestBody.newBuilder();
  rpcRequestBuilder.setMethodName("scan");

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ByteString requestBody = scanBuilder.build().toByteString();
  rpcRequestBuilder.setRequest(requestBody);
  RpcRequestBody rpcRequest = rpcRequestBuilder.build();
  assertTrue (qosFunction.apply(rpcRequest) == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  requestBody = scanBuilder.build().toByteString();
  rpcRequestBuilder.setRequest(requestBody);
  rpcRequestBuilder.setRequestClassName(ScanRequest.class.getCanonicalName());
  rpcRequest = rpcRequestBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  HRegion mockRegion = Mockito.mock(HRegion.class);
  Mockito.when(mockRS.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRS.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(true);

  qosFunction.setRegionServer(mockRS);

  assertTrue (qosFunction.apply(rpcRequest) == HConstants.HIGH_QOS);

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  assertTrue (qosFunction.apply(rpcRequest) == HConstants.NORMAL_QOS);
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:39,代码来源:TestPriorityRpc.java

示例5: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("Scan");
  RequestHeader header = headerBuilder.build();

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ScanRequest scanRequest = scanBuilder.build();
  HRegion mockRegion = Mockito.mock(HRegion.class);
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  RSRpcServices mockRpc = Mockito.mock(RSRpcServices.class);
  Mockito.when(mockRS.getRSRpcServices()).thenReturn(mockRpc);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(false);
  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);
  int qos = priority.getPriority(header, scanRequest,
    User.createUserForTesting(regionServer.conf, "someuser", new String[]{"somegroup"}));
  assertTrue ("" + qos, qos == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  scanRequest = scanBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  Mockito.when(mockRpc.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(true);

  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);

  assertEquals(HConstants.SYSTEMTABLE_QOS, priority.getPriority(header, scanRequest,
    User.createUserForTesting(regionServer.conf, "someuser", new String[]{"somegroup"})));

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(false);
  assertEquals(HConstants.NORMAL_QOS, priority.getPriority(header, scanRequest,
    User.createUserForTesting(regionServer.conf, "someuser", new String[]{"somegroup"})));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:47,代码来源:TestPriorityRpc.java

示例6: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("Scan");
  RequestHeader header = headerBuilder.build();

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ScanRequest scanRequest = scanBuilder.build();
  HRegion mockRegion = Mockito.mock(HRegion.class);
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  RSRpcServices mockRpc = Mockito.mock(RSRpcServices.class);
  Mockito.when(mockRS.getRSRpcServices()).thenReturn(mockRpc);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(false);
  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);
  int qos = priority.getPriority(header, scanRequest);
  assertTrue ("" + qos, qos == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  scanRequest = scanBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  Mockito.when(mockRpc.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(true);

  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);

  assertEquals(HConstants.SYSTEMTABLE_QOS, priority.getPriority(header, scanRequest));

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isSystemTable()).thenReturn(false);
  assertEquals(HConstants.NORMAL_QOS, priority.getPriority(header, scanRequest));
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:44,代码来源:TestPriorityRpc.java

示例7: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("Scan");
  RequestHeader header = headerBuilder.build();

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ScanRequest scanRequest = scanBuilder.build();
  HRegion mockRegion = Mockito.mock(HRegion.class);
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  Mockito.when(mockRS.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);
  int qos = priority.getPriority(header, scanRequest);
  assertTrue ("" + qos, qos == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  scanRequest = scanBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  Mockito.when(mockRS.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRS.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(true);

  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);

  assertEquals(HConstants.HIGH_QOS, priority.getPriority(header, scanRequest));

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  assertEquals(HConstants.NORMAL_QOS, priority.getPriority(header, scanRequest));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:42,代码来源:TestPriorityRpc.java

示例8: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("Scan");
  RequestHeader header = headerBuilder.build();

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ScanRequest scanRequest = scanBuilder.build();
  HRegion mockRegion = Mockito.mock(HRegion.class);
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  RSRpcServices mockRpc = Mockito.mock(RSRpcServices.class);
  Mockito.when(mockRS.getRSRpcServices()).thenReturn(mockRpc);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);
  int qos = priority.getPriority(header, scanRequest);
  assertTrue ("" + qos, qos == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  scanRequest = scanBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  Mockito.when(mockRpc.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRpc.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(true);

  // Presume type.
  ((AnnotationReadingPriorityFunction)priority).setRegionServer(mockRS);

  assertEquals(HConstants.HIGH_QOS, priority.getPriority(header, scanRequest));

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  assertEquals(HConstants.NORMAL_QOS, priority.getPriority(header, scanRequest));
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:44,代码来源:TestPriorityRpc.java

示例9: testQosFunctionForScanMethod

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Test
public void testQosFunctionForScanMethod() throws IOException {
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("scan");
  RequestHeader header = headerBuilder.build();

  //build an empty scan request
  ScanRequest.Builder scanBuilder = ScanRequest.newBuilder();
  ScanRequest scanRequest = scanBuilder.build();
  HRegion mockRegion = Mockito.mock(HRegion.class);
  HRegionServer mockRS = Mockito.mock(HRegionServer.class);
  HRegionInfo mockRegionInfo = Mockito.mock(HRegionInfo.class);
  Mockito.when(mockRS.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  qosFunction.setRegionServer(mockRS);
  int qos = qosFunction.apply(new Pair<RequestHeader, Message>(header, scanRequest));
  assertTrue ("" + qos, qos == HConstants.NORMAL_QOS);

  //build a scan request with scannerID
  scanBuilder = ScanRequest.newBuilder();
  scanBuilder.setScannerId(12345);
  scanRequest = scanBuilder.build();
  //mock out a high priority type handling and see the QoS returned
  RegionScanner mockRegionScanner = Mockito.mock(RegionScanner.class);
  Mockito.when(mockRS.getScanner(12345)).thenReturn(mockRegionScanner);
  Mockito.when(mockRegionScanner.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRS.getRegion((RegionSpecifier)Mockito.any())).thenReturn(mockRegion);
  Mockito.when(mockRegion.getRegionInfo()).thenReturn(mockRegionInfo);
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(true);

  qosFunction.setRegionServer(mockRS);

  assertTrue (qosFunction.apply(new Pair<RequestHeader, Message>(header, scanRequest)) ==
    HConstants.HIGH_QOS);

  //the same as above but with non-meta region
  Mockito.when(mockRegionInfo.isMetaRegion()).thenReturn(false);
  assertTrue (qosFunction.apply(new Pair<RequestHeader, Message>(header, scanRequest)) ==
    HConstants.NORMAL_QOS);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:42,代码来源:TestPriorityRpc.java


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