Skip to content

Commit a01dd74

Browse files
authored
---
yaml --- r: 13621 b: refs/heads/autosynth-dlp c: 1baa602 h: refs/heads/master i: 13619: 17aac4a
1 parent 74c9d1d commit a01dd74

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

  • branches/autosynth-dlp/google-cloud-clients/google-cloud-bigtable/src

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ refs/tags/v0.60.0: 4cd518d0612329f8a8e53484eef4cd1651e32855
104104
refs/tags/v0.61.0: e4b526656bb1bf5eefd0ee578b7405147821225e
105105
refs/tags/v0.62.0: bbede7385d48ba08f487bdd29ec10668ace96396
106106
refs/heads/0.60.0-alpha: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
107-
refs/heads/autosynth-dlp: 81bdd008363130086ab4a328e28bfbe13ede8ed3
107+
refs/heads/autosynth-dlp: 1baa6023966a694c1ccd8ed8d5b47ece662b4fce
108108
refs/heads/autosynth-logging: f8794c50a64f62b167cddf42513d133547679e01
109109
refs/heads/dupes: 3478c5d81fd242d0e985656645a679420a2060c2
110110
refs/tags/v0.63.0: 94f19b71d40f46b36120e7b9d78a1a3d41bfcbd6

branches/autosynth-dlp/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Mutation.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ public static Mutation createUnsafe() {
7373
return new Mutation(true);
7474
}
7575

76+
/**
77+
* Wraps the List of protobuf {@link com.google.bigtable.v2.Mutation}. This methods, like {@link
78+
* #createUnsafe()}, allows setCell operation to use server side timestamp. This is dangerous
79+
* because mutations will no longer be idempotent, which might cause multiple duplicate values to
80+
* be stored in Bigtable. This option should only be used for advanced usecases with extreme care.
81+
*/
82+
@BetaApi
83+
public static Mutation fromProtoUnsafe(List<com.google.bigtable.v2.Mutation> protos) {
84+
Mutation mutation = new Mutation(true);
85+
mutation.mutations.addAll(protos);
86+
return mutation;
87+
}
88+
7689
private Mutation(boolean allowServersideTimestamp) {
7790
this.allowServersideTimestamp = allowServersideTimestamp;
7891
}

branches/autosynth-dlp/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/MutationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public void setCellTest() {
9595
assertThat(actual.get(3).getSetCell().getValue())
9696
.isEqualTo(ByteString.copyFromUtf8("fake-value2"));
9797
assertThat(actual.get(3).getSetCell().getTimestampMicros()).isIn(expectedTimestampRange);
98+
99+
assertThat(Mutation.fromProtoUnsafe(actual).getMutations()).isEqualTo(actual);
98100
}
99101

100102
@Test

0 commit comments

Comments
 (0)