Google Cloud Bigtable C++ Client  1.33.0
A C++ Client Library for Google Cloud Bigtable
idempotent_mutation_policy.cc
Go to the documentation of this file.
1 // Copyright 2017 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "google/cloud/bigtable/idempotent_mutation_policy.h"
16 
17 namespace google {
18 namespace cloud {
19 namespace bigtable {
22  return std::unique_ptr<IdempotentMutationPolicy>(
24 }
25 
27  const {
28  return std::unique_ptr<IdempotentMutationPolicy>(
29  new SafeIdempotentMutationPolicy(*this));
30 }
31 
33  google::bigtable::v2::Mutation const& m) {
34  if (!m.has_set_cell()) {
35  return true;
36  }
37  return m.set_cell().timestamp_micros() != ServerSetTimestamp();
38 }
39 
41  google::bigtable::v2::CheckAndMutateRowRequest const&) {
42  // TODO(#1715): this is overly conservative
43  return false;
44 }
45 
47  const {
48  return std::unique_ptr<IdempotentMutationPolicy>(
49  new AlwaysRetryMutationPolicy(*this));
50 }
51 
53  google::bigtable::v2::Mutation const&) {
54  return true;
55 }
56 
58  google::bigtable::v2::CheckAndMutateRowRequest const&) {
59  return true;
60 }
61 
63 } // namespace bigtable
64 } // namespace cloud
65 } // namespace google