use of com.google.recaptchaenterprise.v1.Key in project grpc-gcp-java by GoogleCloudPlatform.
the class DataStoreChecksumClient method commitTransaction.
private static void commitTransaction(DatastoreBlockingStub stub, String projectId) {
int transactionBytes = 2000;
String payload = new String(new char[transactionBytes]).replace('\0', 'x');
Key key = Key.newBuilder().addPath(PathElement.newBuilder().setKind("Data").setName("data1").build()).build();
Entity entity = Entity.newBuilder().setKey(key).putProperties("2kb", Value.newBuilder().setExcludeFromIndexes(true).setStringValue(payload).build()).build();
Mutation mutation = Mutation.newBuilder().setUpdate(entity).build();
CommitRequest commitRequest = CommitRequest.newBuilder().setProjectId(projectId).setMode(Mode.NON_TRANSACTIONAL).addMutations(mutation).build();
CommitResponse commitResponse = stub.commit(commitRequest);
System.out.println("index updates: " + commitResponse.getIndexUpdates());
}
Aggregations