@Override public List<HRegionInfo> getAllRegionInfos(TableName tableName) throws IOException { ServerName serverName = ServerName.valueOf(options.getDataHost(), options.getPort(), 0); SampleRowKeysRequest.Builder request = SampleRowKeysRequest.newBuilder(); request.setTableName(options.getInstanceName().toTableNameStr(tableName.getNameAsString())); List<SampleRowKeysResponse> sampleRowKeyResponse = this.session.getDataClient().sampleRowKeys(request.build()); return getSampledRowKeysAdapter(tableName, serverName).adaptResponse(sampleRowKeyResponse) .stream() .map(location -> location.getRegionInfo()) .collect(Collectors.toCollection(CopyOnWriteArrayList::new)); }
@Override public List<HRegionInfo> getAllRegionInfos(TableName tableName) throws IOException { ServerName serverName = ServerName.valueOf(options.getDataHost(), options.getPort(), 0); SampleRowKeysRequest.Builder request = SampleRowKeysRequest.newBuilder(); request.setTableName(options.getInstanceName().toTableNameStr(tableName.getNameAsString())); List<SampleRowKeysResponse> sampleRowKeyResponse = this.session.getDataClient().sampleRowKeys(request.build()); return getSampledRowKeysAdapter(tableName, serverName).adaptResponse(sampleRowKeyResponse) .stream() .map(location -> location.getRegionInfo()) .collect(Collectors.toCollection(CopyOnWriteArrayList::new)); }
public AbstractBigtableRegionLocator (TableName tableName, BigtableOptions options, BigtableDataClient client) { this.tableName = tableName; this.client = client; this.bigtableTableName = options.getInstanceName().toTableName(tableName.getNameAsString()); ServerName serverName = ServerName.valueOf(options.getDataHost(), options.getPort(), 0); this.adapter = getSampledRowKeysAdapter(tableName, serverName); }
public AbstractBigtableRegionLocator (TableName tableName, BigtableOptions options, BigtableDataClient client) { this.tableName = tableName; this.client = client; this.bigtableTableName = options.getInstanceName().toTableName(tableName.getNameAsString()); ServerName serverName = ServerName.valueOf(options.getDataHost(), options.getPort(), 0); this.adapter = getSampledRowKeysAdapter(tableName, serverName); }
/** * <p>createNettyChannel.</p> * * @param host a {@link String} object. * @param options a {@link BigtableOptions} object. * @return a {@link ManagedChannel} object. * @throws SSLException if any. */ public static ManagedChannel createNettyChannel(String host, BigtableOptions options, ClientInterceptor ... interceptors) throws SSLException { // Ideally, this should be ManagedChannelBuilder.forAddress(...) rather than an explicit // call to NettyChannelBuilder. Unfortunately, that doesn't work for shaded artifacts. ManagedChannelBuilder<?> builder = ManagedChannelBuilder .forAddress(host, options.getPort()); if (options.usePlaintextNegotiation()) { // NOTE: usePlaintext(true) is deprecated in newer versions of grpc (1.11.0). // usePlantxext() is the preferred approach, but won't work with older versions. // This means that plaintext negotiation can't be used with Beam. builder.usePlaintext(); } return builder .idleTimeout(Long.MAX_VALUE, TimeUnit.SECONDS) .maxInboundMessageSize(MAX_MESSAGE_SIZE) .userAgent(BigtableVersionInfo.CORE_USER_AGENT + "," + options.getUserAgent()) .intercept(interceptors) .build(); }