Skip to content

Commit 2067f21

Browse files
authored
---
yaml --- r: 21551 b: refs/heads/autosynth-container c: 1baa602 h: refs/heads/master i: 21549: 15ae3b7 21547: a013677 21543: 27d1d9e 21535: 2ae2bec
1 parent 1c7fba3 commit 2067f21

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

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

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ refs/tags/v0.65.0: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
112112
refs/tags/v0.66.0: ed6a3f57cbdaa20339a1995f7d7d53b172a5b8ef
113113
refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
114114
refs/heads/autosynth-compute: 026cea73fde22ec0b40866ac5a7dc144dc465b9b
115-
refs/heads/autosynth-container: 81bdd008363130086ab4a328e28bfbe13ede8ed3
115+
refs/heads/autosynth-container: 1baa6023966a694c1ccd8ed8d5b47ece662b4fce
116116
refs/heads/autosynth-monitoring: 832528c131ac32b115fd7a369701d9e6e4ec62e5
117117
refs/heads/autosynth-pubsub: 7a327eaed5fb2a5d6c1691feb73c3e0194dd805e
118118
refs/heads/autosynth-video-intelligence: 53ca56e5d077bf67065b730f3fe621f40689fb4c

branches/autosynth-container/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-container/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)