File tree 2 files changed +21
-0
lines changed
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,19 @@ public static Mutation fromProtoUnsafe(List<com.google.bigtable.v2.Mutation> pro
87
87
return mutation ;
88
88
}
89
89
90
+ /**
91
+ * Wraps the List of protobuf {@link com.google.bigtable.v2.Mutation}. This methods, like {@link
92
+ * #createUnsafe()}, allows setCell operation to use server side timestamp. This is dangerous
93
+ * because mutations will no longer be idempotent, which might cause multiple duplicate values to
94
+ * be stored in Bigtable. This option should only be used for advanced usecases with extreme care.
95
+ */
96
+ @ BetaApi
97
+ public static Mutation fromProtoUnsafe (Iterable <com .google .bigtable .v2 .Mutation > protos ) {
98
+ Mutation mutation = new Mutation (true );
99
+ mutation .mutations .addAll (protos );
100
+ return mutation ;
101
+ }
102
+
90
103
/**
91
104
* Constructs a row mutation from an existing protobuf object.
92
105
*
Original file line number Diff line number Diff line change 15
15
*/
16
16
package com .google .cloud .bigtable .data .v2 .models ;
17
17
18
+ import com .google .api .core .BetaApi ;
18
19
import com .google .api .core .InternalApi ;
19
20
import com .google .bigtable .v2 .MutateRowsRequest ;
20
21
import com .google .common .base .Preconditions ;
@@ -54,6 +55,13 @@ public static RowMutationEntry create(@Nonnull ByteString key) {
54
55
return new RowMutationEntry (key , Mutation .create ());
55
56
}
56
57
58
+ /** Creates a new instance from existing mutation. */
59
+ @ BetaApi
60
+ public static RowMutationEntry createFromMutationUnsafe (
61
+ @ Nonnull ByteString key , @ Nonnull Mutation mutation ) {
62
+ return new RowMutationEntry (key , mutation );
63
+ }
64
+
57
65
/**
58
66
* Creates new instance of mutation builder which allows server timestamp for setCell operations.
59
67
*
You can’t perform that action at this time.
0 commit comments