/** * Little helper to set the table byte array. If it's different than the last * table we reset the byte array. Otherwise we just use the existing array. * @param table The table we're operating against */ private void setTable(final String table) { if (!lastTable.equals(table)) { lastTable = table; BigtableTableName tableName = options .getInstanceName() .toTableName(table); lastTableBytes = tableName .toString() .getBytes(); synchronized(this) { if (bulkMutation != null) { try { bulkMutation.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } } bulkMutation = session.createBulkMutation(tableName); } } }
@Override public BigtableWriterImpl openForWriting(String tableId) throws IOException { BigtableSession session = new BigtableSession(options); BigtableTableName tableName = options.getInstanceName().toTableName(tableId); return new BigtableWriterImpl(session, tableName); }
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>Constructor for HBaseRequestAdapter.</p> * * @param options a {@link BigtableOptions} object. * @param tableName a {@link TableName} object. * @param mutationAdapters a {@link MutationAdapters} object. */ public HBaseRequestAdapter(BigtableOptions options, TableName tableName, MutationAdapters mutationAdapters) { this(tableName, options.getInstanceName().toTableName(tableName.getQualifierAsString()), mutationAdapters, RequestContext.create( InstanceName.of(options.getProjectId(), options.getInstanceId()), options.getAppProfileId() )); }
/** * <p>Constructor for HBaseRequestAdapter.</p> * * @param options a {@link BigtableOptions} object. * @param tableName a {@link TableName} object. * @param mutationAdapters a {@link MutationAdapters} object. */ public HBaseRequestAdapter(BigtableOptions options, TableName tableName, MutationAdapters mutationAdapters) { this(tableName, options.getInstanceName().toTableName(tableName.getQualifierAsString()), mutationAdapters, RequestContext.create( InstanceName.of(options.getProjectId(), options.getInstanceId()), options.getAppProfileId() )); }