/** * Constructor for BatchExecutor. * * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} object. * @param requestAdapter a {@link com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter} * object. */ public BatchExecutor(BigtableSession session, HBaseRequestAdapter requestAdapter) { this.session = session; this.asyncExecutor = session.createAsyncExecutor(); this.options = session.getOptions(); this.requestAdapter = requestAdapter; }
/** * Constructor for BatchExecutor. * * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} object. * @param requestAdapter a {@link com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter} * object. */ public BatchExecutor(BigtableSession session, HBaseRequestAdapter requestAdapter) { this.session = session; this.asyncExecutor = session.createAsyncExecutor(); this.options = session.getOptions(); this.requestAdapter = requestAdapter; }
/** * <p>Constructor for BigtableBufferedMutator.</p> * * @param adapter Converts HBase objects to Bigtable protos * @param configuration For Additional configuration. TODO: move this to options * @param listener Handles exceptions. By default, it just throws the exception. * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} to get {@link com.google.cloud.bigtable.config.BigtableOptions}, {@link com.google.cloud.bigtable.grpc.async.AsyncExecutor} * and {@link com.google.cloud.bigtable.grpc.async.BulkMutation} objects from * starting the async operations on the BigtableDataClient. */ public BigtableBufferedMutator( HBaseRequestAdapter adapter, Configuration configuration, BigtableSession session, BufferedMutator.ExceptionListener listener) { helper = new BigtableBufferedMutatorHelper(adapter, configuration, session); this.listener = listener; this.host = session.getOptions().getDataHost().toString(); }
/** * <p>Constructor for BigtableBufferedMutator.</p> * * @param adapter Converts HBase objects to Bigtable protos * @param configuration For Additional configuration. TODO: move this to options * @param listener Handles exceptions. By default, it just throws the exception. * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} to get {@link com.google.cloud.bigtable.config.BigtableOptions}, {@link com.google.cloud.bigtable.grpc.async.AsyncExecutor} * and {@link com.google.cloud.bigtable.grpc.async.BulkMutation} objects from * starting the async operations on the BigtableDataClient. */ public BigtableBufferedMutator( HBaseRequestAdapter adapter, Configuration configuration, BigtableSession session, BufferedMutator.ExceptionListener listener) { helper = new BigtableBufferedMutatorHelper(adapter, configuration, session); this.listener = listener; this.host = session.getOptions().getDataHost().toString(); }
this.options = this.session.getOptions();
/** * <p> * Constructor for BigtableBufferedMutator. * </p> * @param adapter Converts HBase objects to Bigtable protos * @param configuration For Additional configuration. TODO: move this to options * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} to get * {@link com.google.cloud.bigtable.config.BigtableOptions}, * {@link com.google.cloud.bigtable.grpc.async.AsyncExecutor} and * {@link com.google.cloud.bigtable.grpc.async.BulkMutation} objects from starting the * async operations on the BigtableDataClient. */ public BigtableBufferedMutatorHelper( HBaseRequestAdapter adapter, Configuration configuration, BigtableSession session) { this.adapter = adapter; this.configuration = configuration; this.options = session.getOptions(); this.asyncExecutor = session.createAsyncExecutor(); BigtableTableName tableName = this.adapter.getBigtableTableName(); this.bulkMutation = session.createBulkMutation(tableName); }
this.options = this.session.getOptions();
public BigtableAsyncConnection(Configuration conf, AsyncRegistry ignoredRegistry, String ignoredClusterId, User ignoredUser) throws IOException { LOG.debug("Creating BigtableAsyncConnection"); this.conf = conf; BigtableOptions opts; try { opts = BigtableOptionsFactory.fromConfiguration(conf); } catch (IOException ioe) { LOG.error("Error loading BigtableOptions from Configuration.", ioe); throw ioe; } this.closed = false; this.session = new BigtableSession(opts); this.options = this.session.getOptions(); }
/** * <p> * Constructor for BigtableBufferedMutator. * </p> * @param adapter Converts HBase objects to Bigtable protos * @param configuration For Additional configuration. TODO: move this to options * @param session a {@link com.google.cloud.bigtable.grpc.BigtableSession} to get * {@link com.google.cloud.bigtable.config.BigtableOptions}, * {@link com.google.cloud.bigtable.grpc.async.AsyncExecutor} and * {@link com.google.cloud.bigtable.grpc.async.BulkMutation} objects from starting the * async operations on the BigtableDataClient. */ public BigtableBufferedMutatorHelper( HBaseRequestAdapter adapter, Configuration configuration, BigtableSession session) { this.adapter = adapter; this.configuration = configuration; this.options = session.getOptions(); this.asyncExecutor = session.createAsyncExecutor(); BigtableTableName tableName = this.adapter.getBigtableTableName(); this.bulkMutation = session.createBulkMutation(tableName); }
public BigtableAsyncConnection(Configuration conf, AsyncRegistry ignoredRegistry, String ignoredClusterId, User ignoredUser) throws IOException { LOG.debug("Creating BigtableAsyncConnection"); this.conf = conf; BigtableOptions opts; try { opts = BigtableOptionsFactory.fromConfiguration(conf); } catch (IOException ioe) { LOG.error("Error loading BigtableOptions from Configuration.", ioe); throw ioe; } this.closed = false; this.session = new BigtableSession(opts); this.options = this.session.getOptions(); }
@Before public void setup() { MockitoAnnotations.initMocks(this); BigtableOptions options = new BigtableOptions.Builder().setProjectId("project").setInstanceId("instance").build(); when(mockSession.getOptions()).thenReturn(options); when(mockSession.createBulkMutation(eq(TABLE_NAME))).thenReturn(mockBulkMutation); when(mockSession.getDataClient()).thenReturn(mockBigtableDataClient); }
/** * Constructed by BigtableConnection * * @param bigtableConnection a {@link org.apache.hadoop.hbase.client.AbstractBigtableConnection} object. * @param hbaseAdapter a {@link com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter} object. */ public AbstractBigtableTable(AbstractBigtableConnection bigtableConnection, HBaseRequestAdapter hbaseAdapter) { this.bigtableConnection = bigtableConnection; BigtableSession session = bigtableConnection.getSession(); this.options = session.getOptions(); this.client = session.getDataClient(); this.clientWrapper = session.getClientWrapper(); this.hbaseAdapter = hbaseAdapter; this.tableName = hbaseAdapter.getTableName(); this.requestContext = RequestContext.create( InstanceName.of(options.getProjectId(), options.getInstanceId()), options.getAppProfileId()); }
/** * Constructed by BigtableConnection * * @param bigtableConnection a {@link org.apache.hadoop.hbase.client.AbstractBigtableConnection} object. * @param hbaseAdapter a {@link com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter} object. */ public AbstractBigtableTable(AbstractBigtableConnection bigtableConnection, HBaseRequestAdapter hbaseAdapter) { this.bigtableConnection = bigtableConnection; BigtableSession session = bigtableConnection.getSession(); this.options = session.getOptions(); this.client = session.getDataClient(); this.clientWrapper = session.getClientWrapper(); this.hbaseAdapter = hbaseAdapter; this.tableName = hbaseAdapter.getTableName(); this.requestContext = RequestContext.create( InstanceName.of(options.getProjectId(), options.getInstanceId()), options.getAppProfileId()); }
@Override public boolean start() throws IOException { RowSet.Builder rowSetBuilder = RowSet.newBuilder(); for (ByteKeyRange sourceRange : source.getRanges()) { rowSetBuilder = rowSetBuilder.addRowRanges( RowRange.newBuilder() .setStartKeyClosed(ByteString.copyFrom(sourceRange.getStartKey().getValue())) .setEndKeyOpen(ByteString.copyFrom(sourceRange.getEndKey().getValue()))); } RowSet rowSet = rowSetBuilder.build(); String tableNameSr = session.getOptions().getInstanceName().toTableNameStr(source.getTableId().get()); ReadRowsRequest.Builder requestB = ReadRowsRequest.newBuilder().setRows(rowSet).setTableName(tableNameSr); if (source.getRowFilter() != null) { requestB.setFilter(source.getRowFilter()); } results = session.getDataClient().readRows(requestB.build()); return advance(); }