use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-docs-samples by GoogleCloudPlatform.
the class CassandraMigrationCodelab method update.
public void update() {
try {
// Timestamp of June 1, 2019 12:30
long timestamp = (long) 1556713800 * 1000;
String rowKey = "phone#4c410523#20190501";
RowMutation rowMutation = RowMutation.create(tableId, rowKey).setCell(COLUMN_FAMILY_NAME, "os_name", timestamp, "android");
dataClient.mutateRow(rowMutation);
} catch (Exception e) {
System.out.println("Error during update: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-docs-samples by GoogleCloudPlatform.
the class CassandraMigrationCodelab method delete.
public void delete() {
try {
String rowKey = "phone#4c410523#20190501";
RowMutation mutation = RowMutation.create(tableId, rowKey).deleteRow();
dataClient.mutateRow(mutation);
} catch (Exception e) {
System.out.println("Error during Delete: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-docs-samples by GoogleCloudPlatform.
the class CassandraMigrationCodelab method write.
public void write() {
try {
System.currentTimeMillis();
// Timestamp of June 1, 2019 12:00
long timestamp = (long) 1556712000 * 1000;
String rowKey = "phone#4c410523#20190501";
ByteString one = ByteString.copyFrom(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 });
RowMutation rowMutation = RowMutation.create(tableId, rowKey).setCell(COLUMN_FAMILY_NAME, ByteString.copyFrom("connected_cell".getBytes()), timestamp, one).setCell(COLUMN_FAMILY_NAME, "os_build", timestamp, "PQ2A.190405.003");
dataClient.mutateRow(rowMutation);
} catch (Exception e) {
System.out.println("Error during Write: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-docs-samples by GoogleCloudPlatform.
the class MemcachedTest method beforeClass.
@BeforeClass
public static void beforeClass() {
projectId = requireEnv("GOOGLE_CLOUD_PROJECT");
instanceId = requireEnv(INSTANCE_ENV);
try (BigtableTableAdminClient adminClient = BigtableTableAdminClient.create(projectId, instanceId)) {
CreateTableRequest createTableRequest = CreateTableRequest.of(TABLE_ID).addFamily(COLUMN_FAMILY_NAME);
adminClient.createTable(createTableRequest);
try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) {
String rowkey = "phone#4c410523#20190501";
RowMutation rowMutation = RowMutation.create(TABLE_ID, rowkey).setCell(COLUMN_FAMILY_NAME, "os_build", "PQ2A.190405.003");
dataClient.mutateRow(rowMutation);
}
String[] dockerCommand = (String.format("docker run --name %s -itd --rm --publish 11211:11211 sameersbn/memcached:latest", MEMCACHED_CONTAINER_NAME)).split(" ");
Process process = new ProcessBuilder(dockerCommand).start();
process.waitFor();
} catch (Exception e) {
System.out.println("Error during beforeClass: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable-hbase by googleapis.
the class AbstractBigtableTable method put.
/**
* {@inheritDoc}
*/
@Override
public void put(Put put) throws IOException {
LOG.trace("put(Put)");
RowMutation rowMutation = hbaseAdapter.adapt(put);
mutateRow(put, rowMutation, "put");
}
Aggregations