Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
Loading...
Searching...
No Matches
mutations.h
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// https://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#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_MUTATIONS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_MUTATIONS_H
17
18#include "google/cloud/bigtable/cell.h"
19#include "google/cloud/bigtable/row_key.h"
20#include "google/cloud/bigtable/version.h"
21#include "google/cloud/grpc_error_delegate.h"
22#include "google/cloud/internal/big_endian.h"
23#include "google/cloud/status.h"
24#include "google/cloud/status_or.h"
25#include "absl/meta/type_traits.h"
26#include <google/bigtable/v2/bigtable.pb.h>
27#include <google/bigtable/v2/data.pb.h>
28#include <google/protobuf/util/message_differencer.h>
29#include <grpcpp/grpcpp.h>
30#include <chrono>
31#include <string>
32#include <type_traits>
33#include <vector>
34
35namespace google {
36namespace cloud {
37namespace bigtable {
38GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
39/**
40 * Represent a single change to a specific row in a Table.
41 *
42 * Mutations come in different forms, they can set a specific cell,
43 * delete a specific cell or delete multiple cells in a row.
44 */
45struct Mutation {
46 google::bigtable::v2::Mutation op;
47};
48
49/**
50 * A magic value where the server sets the timestamp.
51 *
52 * Notice that using this value in a SetCell() mutation makes it non-idempotent,
53 * and by default the client will not retry such mutations.
54 */
55constexpr std::int64_t ServerSetTimestamp() { return -1; }
56
57/// Create a mutation to set a cell value.
58template <typename ColumnType, typename ValueType>
59Mutation SetCell(std::string family, ColumnType&& column,
60 std::chrono::milliseconds timestamp, ValueType&& value) {
61 Mutation m;
62 auto& set_cell = *m.op.mutable_set_cell();
63 set_cell.set_family_name(std::move(family));
64 set_cell.set_column_qualifier(std::forward<ColumnType>(column));
65 set_cell.set_timestamp_micros(
66 std::chrono::duration_cast<std::chrono::microseconds>(timestamp).count());
67 set_cell.set_value(std::forward<ValueType>(value));
68 return m;
69}
70
71/// Create a mutation to store a 64-bit big endian integer value.
72template <typename ColumnType>
73Mutation SetCell(std::string family, ColumnType&& column,
74 std::chrono::milliseconds timestamp, std::int64_t value) {
75 Mutation m;
76 auto& set_cell = *m.op.mutable_set_cell();
77 set_cell.set_family_name(std::move(family));
78 set_cell.set_column_qualifier(std::forward<ColumnType>(column));
79 set_cell.set_timestamp_micros(
80 std::chrono::duration_cast<std::chrono::microseconds>(timestamp).count());
81 set_cell.set_value(google::cloud::internal::EncodeBigEndian(value));
82 return m;
83}
84
85/**
86 * Create a mutation to set a cell value where the server sets the time.
87 *
88 * These mutations are not idempotent and not retried by default.
89 */
90template <typename ColumnType, typename ValueType>
91Mutation SetCell(std::string family, ColumnType&& column, ValueType&& value) {
92 Mutation m;
93 auto& set_cell = *m.op.mutable_set_cell();
94 set_cell.set_family_name(std::move(family));
95 set_cell.set_column_qualifier(std::forward<ColumnType>(column));
96 set_cell.set_timestamp_micros(ServerSetTimestamp());
97 set_cell.set_value(std::forward<ValueType>(value));
98 return m;
99}
100
101/**
102 * Create a mutation to store a 64-bit big endian integer value.
103 *
104 * @note This mutation is not idempotent, the default policies do not retry
105 * transient failures for this mutation.
106 */
107template <typename ColumnType>
108Mutation SetCell(std::string family, ColumnType&& column, std::int64_t value) {
109 Mutation m;
110 auto& set_cell = *m.op.mutable_set_cell();
111 set_cell.set_family_name(std::move(family));
112 set_cell.set_column_qualifier(std::forward<ColumnType>(column));
113 set_cell.set_timestamp_micros(ServerSetTimestamp());
114 set_cell.set_value(google::cloud::internal::EncodeBigEndian(value));
115 return m;
116}
117
118/**
119 * Create a mutation to set a cell value based on a `bigtable::Cell`.
120 *
121 * These mutations are not idempotent and not retried by default.
122 */
123Mutation SetCell(Cell cell);
124
125///@{
126/**
127 * @name Create mutations to delete a range of cells from a column.
128 *
129 * The following functions create a mutation that deletes all the
130 * cells in the given column family and, column within the given
131 * timestamp in the range.
132 *
133 * The function accepts any instantiation of `std::chrono::duration<>` for the
134 * @p timestamp_begin and @p timestamp_end parameters. For example:
135 *
136 * @code
137 * using namespace std::chrono_literals; // C++14
138 * bigtable::DeleteFromColumn("fam", "col", 0us, 10us)
139 * @endcode
140 *
141 * The ending timestamp is exclusive, while the beginning timestamp is
142 * inclusive. That is, the interval is [@p timestamp_begin, @p timestamp_end).
143 * The value 0 is special and treated as "unbounded" for both the begin and
144 * end endpoints of the time range. The Cloud Bigtable server rejects
145 * invalid and empty ranges, i.e., any range where the endpoint is smaller or
146 * equal than to the initial endpoint unless either endpoint is 0.
147 *
148 * @tparam Rep1 a placeholder to match the Rep tparam for @p timestamp_begin
149 * type. The semantics of this template parameter are documented in
150 * std::chrono::duration<>` (in brief, the underlying arithmetic type
151 * used to store the number of ticks), for our purposes it is simply a
152 * formal parameter.
153 *
154 * @tparam Rep2 similar formal parameter for the type of @p timestamp_end.
155 *
156 * @tparam Period1 a placeholder to match the Period tparam for
157 * @p timestamp_begin type. The semantics of this template parameter are
158 * documented in `std::chrono::duration<>` (in brief, the length of the tick
159 * in seconds,vexpressed as a `std::ratio<>`), for our purposes it is simply
160 * a formal parameter.
161 *
162 * @tparam Period2 similar formal parameter for the type of @p timestamp_end.
163 *
164 * @tparam ColumnType the type of the column qualifier. It should satisfy
165 * std::is_constructible<ColumnQualifierType, ColumnType>.
166 */
167template <typename Rep1, typename Period1, typename Rep2, typename Period2,
168 typename ColumnType>
169Mutation DeleteFromColumn(std::string family, ColumnType&& column,
170 std::chrono::duration<Rep1, Period1> timestamp_begin,
171 std::chrono::duration<Rep2, Period2> timestamp_end) {
172 Mutation m;
173 auto& d = *m.op.mutable_delete_from_column();
174 d.set_family_name(std::move(family));
175 d.set_column_qualifier(std::forward<ColumnType>(column));
176 d.mutable_time_range()->set_start_timestamp_micros(
177 std::chrono::duration_cast<std::chrono::microseconds>(timestamp_begin)
178 .count());
179 d.mutable_time_range()->set_end_timestamp_micros(
180 std::chrono::duration_cast<std::chrono::microseconds>(timestamp_end)
181 .count());
182 return m;
183}
184
185///@{
186/**
187 * @name The following functions create a mutation that deletes all the
188 * cells in the given column family and column, starting from and
189 * including, @a timestamp_begin.
190 *
191 * The function accepts any instantiation of `std::chrono::duration<>` for the
192 * @p timestamp_begin For example:
193 *
194 * @code
195 * using namespace std::chrono_literals; // C++14
196 * bigtable::DeleteFromColumn("fam", "col", 10us)
197 * @endcode
198 *
199 * @tparam Rep1 a placeholder to match the Rep tparam for @p timestamp_begin
200 * type. The semantics of this template parameter are documented in
201 * `std::chrono::duration<>` (in brief, the underlying arithmetic type
202 * used to store the number of ticks), for our purposes it is simply a
203 * formal parameter.
204 *
205 * @tparam Period1 a placeholder to match the Period tparam for @p
206 * timestamp_begin type. The semantics of this template parameter
207 * are documented in `std::chrono::duration<>` (in brief, the length
208 * of the tick in seconds, expressed as a `std::ratio<>`), for our
209 * purposes it is simply a formal parameter.
210 *
211 * @tparam ColumnType the type of the column qualifier. It should satisfy
212 * std::is_constructible<ColumnQualifierType, ColumnType>.
213 */
214template <typename Rep1, typename Period1, typename ColumnType>
216 std::string family, ColumnType&& column,
217 std::chrono::duration<Rep1, Period1> timestamp_begin) {
218 Mutation m;
219 auto& d = *m.op.mutable_delete_from_column();
220 d.set_family_name(std::move(family));
221 d.set_column_qualifier(std::forward<ColumnType>(column));
222 d.mutable_time_range()->set_start_timestamp_micros(
223 std::chrono::duration_cast<std::chrono::microseconds>(timestamp_begin)
224 .count());
225 return m;
226}
227
228///@{
229/**
230 * @name The following functions create a mutation that deletes all the
231 * cells in the given column family and column, Delete up to @a timestamp_end,
232 * but excluding, @a timestamp_end.
233 *
234 * The function accepts any instantiation of `std::chrono::duration<>` for the
235 * @p timestamp_end For example:
236 *
237 * @code
238 * using namespace std::chrono_literals; // C++14
239 * bigtable::DeleteFromColumn("fam", "col", 10us)
240 * @endcode
241 *
242 * @tparam Rep2 a placeholder to match the Rep tparam for @p timestamp_end type.
243 * The semantics of this template parameter are documented in
244 * `std::chrono::duration<>` (in brief, the underlying arithmetic type
245 * used to store the number of ticks), for our purposes it is simply a
246 * formal parameter.
247 *
248 * @tparam Period2 a placeholder to match the Period tparam for @p timestamp_end
249 * type. The semantics of this template parameter are documented in
250 * `std::chrono::duration<>` (in brief, the length of the tick in seconds,
251 * expressed as a `std::ratio<>`), for our purposes it is simply a formal
252 * parameter.
253 *
254 * @tparam ColumnType the type of the column qualifier. It should satisfy
255 * std::is_constructible<ColumnQualifierType, ColumnType>.
256 */
257template <typename Rep2, typename Period2, typename ColumnType>
259 std::string family, ColumnType&& column,
260 std::chrono::duration<Rep2, Period2> timestamp_end) {
261 Mutation m;
262 auto& d = *m.op.mutable_delete_from_column();
263 d.set_family_name(std::move(family));
264 d.set_column_qualifier(std::forward<ColumnType>(column));
265 d.mutable_time_range()->set_end_timestamp_micros(
266 std::chrono::duration_cast<std::chrono::microseconds>(timestamp_end)
267 .count());
268 return m;
269}
270
271/// Delete all the values for the column.
272template <typename ColumnType>
273Mutation DeleteFromColumn(std::string family, ColumnType&& column) {
274 Mutation m;
275 auto& d = *m.op.mutable_delete_from_column();
276 d.set_family_name(std::move(family));
277 d.set_column_qualifier(std::forward<ColumnType>(column));
278 return m;
279}
280///@}
281
282/// Create a mutation to delete all the cells in a column family.
283Mutation DeleteFromFamily(std::string family);
284
285/// Create a mutation to delete all the cells in a row.
287
288/**
289 * Represent a single row mutation.
290 *
291 * Bigtable can perform multiple changes to a single row atomically.
292 * This class represents 0 or more changes to apply to a single row.
293 * The changes may include setting cells (which implicitly insert the
294 * values), deleting values, etc.
295 */
296class SingleRowMutation {
297 public:
298 /// Create an empty mutation.
299 template <typename RowKey,
300 /// @cond implementation_details
301 typename std::enable_if<
302 std::is_constructible<RowKeyType, RowKey>::value, int>::type = 0
303 /// @endcond
304 >
305 // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
306 explicit SingleRowMutation(RowKey&& row_key) {
307 request_.set_row_key(RowKeyType(std::forward<RowKey>(row_key)));
308 }
309
310 /// Create a row mutation from a initializer list.
311 template <typename RowKey>
312 SingleRowMutation(RowKey&& row_key, std::initializer_list<Mutation> list) {
313 request_.set_row_key(std::forward<RowKey>(row_key));
314 for (auto&& i : list) {
315 *request_.add_mutations() = i.op;
316 }
317 }
318
319 /// Create a single-row multiple-cell mutation from a variadic list.
320 template <typename RowKey, typename... M,
321 /// @cond implementation_details
322 typename std::enable_if<
323 std::is_constructible<RowKeyType, RowKey>::value, int>::type = 0
324 /// @endcond
325 >
326 explicit SingleRowMutation(RowKey&& row_key, M&&... m) {
327 static_assert(
328 absl::conjunction<std::is_convertible<M, Mutation>...>::value,
329 "The arguments passed to SingleRowMutation(std::string, ...) must be "
330 "convertible to Mutation");
331 request_.set_row_key(std::forward<RowKey>(row_key));
332 emplace_many(std::forward<M>(m)...);
333 }
334
335 /// Create a row mutation from gRPC proto
336 explicit SingleRowMutation(
337 ::google::bigtable::v2::MutateRowsRequest::Entry entry) {
338 using std::swap;
339 swap(*request_.mutable_row_key(), *entry.mutable_row_key());
340 swap(*request_.mutable_mutations(), *entry.mutable_mutations());
341 }
342
343 /// Create a row mutation from gRPC proto
344 explicit SingleRowMutation(::google::bigtable::v2::MutateRowRequest request)
345 : request_(std::move(request)) {}
346
347 // Add a mutation at the end.
349 *request_.add_mutations() = std::move(mut.op);
350 return *this;
351 }
352
353 // Get the row key.
354 RowKeyType const& row_key() const { return request_.row_key(); }
355
356 friend class Table;
357
360 SingleRowMutation(SingleRowMutation const&) = default;
361 SingleRowMutation& operator=(SingleRowMutation const&) = default;
362
363 friend bool operator==(SingleRowMutation const& a,
364 SingleRowMutation const& b) noexcept {
365 return google::protobuf::util::MessageDifferencer::Equivalent(a.request_,
366 b.request_);
367 }
368 friend bool operator!=(SingleRowMutation const& a,
369 SingleRowMutation const& b) noexcept {
370 return !(a == b);
371 }
372
373 /// Move the contents into a bigtable::v2::MutateRowsRequest::Entry.
374 void MoveTo(google::bigtable::v2::MutateRowsRequest::Entry* entry) {
375 entry->set_row_key(std::move(*request_.mutable_row_key()));
376 *entry->mutable_mutations() = std::move(*request_.mutable_mutations());
377 }
378
379 /// Transfer the contents to @p request.
380 void MoveTo(google::bigtable::v2::MutateRowRequest& request) {
381 request.set_row_key(std::move(*request_.mutable_row_key()));
382 *request.mutable_mutations() = std::move(*request_.mutable_mutations());
383 }
384
385 /// Remove the contents of the mutation.
386 void Clear() { request_.Clear(); }
387
388 private:
389 /// Add multiple mutations to single row
390 template <typename... M>
391 void emplace_many(Mutation first, M&&... tail) {
392 emplace_back(std::move(first));
393 emplace_many(std::forward<M>(tail)...);
394 }
395
396 void emplace_many(Mutation m) { emplace_back(std::move(m)); }
397
398 ::google::bigtable::v2::MutateRowRequest request_;
399};
400
401/**
402 * A SingleRowMutation that failed.
403 *
404 * A multi-row mutation returns the list of operations that failed,
405 * this class encapsulates both the failure and the original
406 * mutation. The application can then choose to resend the mutation,
407 * or log it, or save it for processing via some other means.
408 */
409class FailedMutation {
410 public:
411 FailedMutation(google::cloud::Status status, int index)
412 : status_(std::move(status)), original_index_(index) {}
413
414 FailedMutation(google::rpc::Status const& status, int index)
415 : status_(MakeStatusFromRpcError(status)), original_index_(index) {}
416
417 FailedMutation(FailedMutation&&) = default;
419 FailedMutation(FailedMutation const&) = default;
420 FailedMutation& operator=(FailedMutation const&) = default;
421
422 friend bool operator==(FailedMutation const& a,
423 FailedMutation const& b) noexcept {
424 return a.status_ == b.status_ && a.original_index_ == b.original_index_;
425 }
426 friend bool operator!=(FailedMutation const& a,
427 FailedMutation const& b) noexcept {
428 return !(a == b);
429 }
430
431 ///@{
432 /// @name accessors
433 google::cloud::Status const& status() const { return status_; }
434 int original_index() const { return original_index_; }
435 ///@}
436
437 friend class BulkMutation;
438
439 private:
440 google::cloud::Status status_;
441 int original_index_;
442};
443
444/**
445 * Report unrecoverable errors in a partially completed mutation.
446 */
447class PermanentMutationFailure : public std::runtime_error {
448 public:
449 PermanentMutationFailure(char const* msg,
450 std::vector<FailedMutation> failures)
451 : std::runtime_error(msg), failures_(std::move(failures)) {}
452
453 PermanentMutationFailure(char const* msg, grpc::Status status,
454 std::vector<FailedMutation> failures)
455 : std::runtime_error(msg),
456 failures_(std::move(failures)),
457 status_(std::move(status)) {}
458
459 /**
460 * The details of each mutation failure.
461 *
462 * Because BulkApply() and Apply() take ownership of the data in the mutations
463 * the failures are returned with their full contents, in case the application
464 * wants to take further action with them. Any successful mutations are
465 * discarded.
466 *
467 * Any mutations that fail with an unknown state are included with a
468 * `grpc::StatusCode::OK`.
469 */
470 std::vector<FailedMutation> const& failures() const { return failures_; }
471
472 /**
473 * The `grpc::Status` of the request.
474 *
475 * Notice that it can return `grpc::Status::OK` when there are partial
476 * failures in a `BulkApply()` operation.
477 */
478 grpc::Status const& status() const { return status_; }
479
480 private:
481 std::vector<FailedMutation> failures_;
482 grpc::Status status_;
483};
484
485/**
486 * Represent a set of mutations across multiple rows.
487 *
488 * Cloud Bigtable can batch multiple mutations in a single request.
489 * The mutations are not atomic, but it is more efficient to send them
490 * in a batch than to make multiple smaller requests.
491 */
492class BulkMutation {
493 public:
494 /// Create an empty set of mutations.
495 BulkMutation() = default;
496
497 /// Create a multi-row mutation from a range of SingleRowMutations.
498 template <typename Iterator>
499 BulkMutation(Iterator begin, Iterator end) {
500 static_assert(
501 std::is_convertible<decltype(*begin), SingleRowMutation>::value,
502 "The iterator value type must be convertible to SingleRowMutation");
503 for (auto i = begin; i != end; ++i) {
504 push_back(*i);
505 }
506 }
507
508 /// Create a multi-row mutation from a initializer list.
509 BulkMutation(std::initializer_list<SingleRowMutation> list)
510 : BulkMutation(list.begin(), list.end()) {}
511
512 /// Create a multi-row mutation from a SingleRowMutation
513 explicit BulkMutation(SingleRowMutation mutation) : BulkMutation() {
514 emplace_back(std::move(mutation));
515 }
516
517 /// Create a multi-row mutation from two SingleRowMutation
519 emplace_back(std::move(m1));
520 emplace_back(std::move(m2));
521 }
522
523 /// Create a multi-row mutation from a variadic list.
524 template <typename... M,
525 /// @cond implementation_details
526 typename std::enable_if<absl::conjunction<std::is_convertible<
527 M, SingleRowMutation>...>::value,
528 int>::type = 0
529 /// @endcond
530 >
531 // NOLINTNEXTLINE(google-explicit-constructor)
532 BulkMutation(M&&... m) : BulkMutation() {
533 emplace_many(std::forward<M>(m)...);
534 }
535
536 // Add a mutation to the batch.
538 mut.MoveTo(request_.add_entries());
539 return *this;
540 }
541
542 // Add a failed mutation to the batch.
544 fm.status_ = google::cloud::Status();
545 return *this;
546 }
547
548 // Add a mutation to the batch.
550 mut.MoveTo(request_.add_entries());
551 return *this;
552 }
553
554 /// Move the contents into a bigtable::v2::MutateRowsRequest
555 void MoveTo(google::bigtable::v2::MutateRowsRequest* request) {
556 request_.Swap(request);
557 request_ = {};
558 }
559
560 /// Return true if there are no mutations in this set.
561 bool empty() const { return request_.entries().empty(); }
562
563 /// Return the number of mutations in this set.
564 std::size_t size() const { return request_.entries().size(); }
565
566 /// Return the estimated size in bytes of all the mutations in this set.
567 std::size_t estimated_size_in_bytes() const {
568 return request_.ByteSizeLong();
569 }
570
571 private:
572 template <typename... M>
573 void emplace_many(SingleRowMutation first, M&&... tail) {
574 emplace_back(std::move(first));
575 emplace_many(std::forward<M>(tail)...);
576 }
577
578 void emplace_many(SingleRowMutation m) { emplace_back(std::move(m)); }
579
580 google::bigtable::v2::MutateRowsRequest request_;
581};
582
583GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
584} // namespace bigtable
585} // namespace cloud
586} // namespace google
587
588#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_MUTATIONS_H
Status & operator=(Status &&) noexcept
friend friend bool operator==(Status const &a, Status const &b)
Status(Status &&) noexcept
Represent a set of mutations across multiple rows.
Definition: mutations.h:492
bool empty() const
Return true if there are no mutations in this set.
Definition: mutations.h:561
BulkMutation(std::initializer_list< SingleRowMutation > list)
Create a multi-row mutation from a initializer list.
Definition: mutations.h:509
BulkMutation(SingleRowMutation mutation)
Create a multi-row mutation from a SingleRowMutation.
Definition: mutations.h:513
BulkMutation(Iterator begin, Iterator end)
Create a multi-row mutation from a range of SingleRowMutations.
Definition: mutations.h:499
BulkMutation(SingleRowMutation m1, SingleRowMutation m2)
Create a multi-row mutation from two SingleRowMutation.
Definition: mutations.h:518
BulkMutation & emplace_back(FailedMutation fm)
Definition: mutations.h:543
void MoveTo(google::bigtable::v2::MutateRowsRequest *request)
Move the contents into a bigtable::v2::MutateRowsRequest.
Definition: mutations.h:555
BulkMutation()=default
Create an empty set of mutations.
BulkMutation & emplace_back(SingleRowMutation mut)
Definition: mutations.h:537
std::size_t size() const
Return the number of mutations in this set.
Definition: mutations.h:564
BulkMutation(M &&... m)
Create a multi-row mutation from a variadic list.
Definition: mutations.h:532
std::size_t estimated_size_in_bytes() const
Return the estimated size in bytes of all the mutations in this set.
Definition: mutations.h:567
BulkMutation & push_back(SingleRowMutation mut)
Definition: mutations.h:549
The in-memory representation of a Bigtable cell.
Definition: cell.h:90
A SingleRowMutation that failed.
Definition: mutations.h:409
FailedMutation(google::cloud::Status status, int index)
Definition: mutations.h:411
FailedMutation(google::rpc::Status const &status, int index)
Definition: mutations.h:414
friend bool operator==(FailedMutation const &a, FailedMutation const &b) noexcept
Definition: mutations.h:422
FailedMutation & operator=(FailedMutation const &)=default
google::cloud::Status const & status() const
Definition: mutations.h:433
FailedMutation(FailedMutation const &)=default
FailedMutation(FailedMutation &&)=default
friend bool operator!=(FailedMutation const &a, FailedMutation const &b) noexcept
Definition: mutations.h:426
FailedMutation & operator=(FailedMutation &&)=default
int original_index() const
Definition: mutations.h:434
Report unrecoverable errors in a partially completed mutation.
Definition: mutations.h:447
std::vector< FailedMutation > const & failures() const
The details of each mutation failure.
Definition: mutations.h:470
PermanentMutationFailure(char const *msg, std::vector< FailedMutation > failures)
Definition: mutations.h:449
grpc::Status const & status() const
The grpc::Status of the request.
Definition: mutations.h:478
PermanentMutationFailure(char const *msg, grpc::Status status, std::vector< FailedMutation > failures)
Definition: mutations.h:453
Represent a single row mutation.
Definition: mutations.h:296
SingleRowMutation(RowKey &&row_key)
Create an empty mutation.
Definition: mutations.h:306
void MoveTo(google::bigtable::v2::MutateRowsRequest::Entry *entry)
Move the contents into a bigtable::v2::MutateRowsRequest::Entry.
Definition: mutations.h:374
void Clear()
Remove the contents of the mutation.
Definition: mutations.h:386
SingleRowMutation & operator=(SingleRowMutation &&)=default
SingleRowMutation(SingleRowMutation &&)=default
friend bool operator==(SingleRowMutation const &a, SingleRowMutation const &b) noexcept
Definition: mutations.h:363
SingleRowMutation & emplace_back(Mutation mut)
Definition: mutations.h:348
void MoveTo(google::bigtable::v2::MutateRowRequest &request)
Transfer the contents to request.
Definition: mutations.h:380
RowKeyType const & row_key() const
Definition: mutations.h:354
SingleRowMutation(RowKey &&row_key, std::initializer_list< Mutation > list)
Create a row mutation from a initializer list.
Definition: mutations.h:312
SingleRowMutation(::google::bigtable::v2::MutateRowRequest request)
Create a row mutation from gRPC proto.
Definition: mutations.h:344
SingleRowMutation & operator=(SingleRowMutation const &)=default
SingleRowMutation(SingleRowMutation const &)=default
SingleRowMutation(::google::bigtable::v2::MutateRowsRequest::Entry entry)
Create a row mutation from gRPC proto.
Definition: mutations.h:336
friend bool operator!=(SingleRowMutation const &a, SingleRowMutation const &b) noexcept
Definition: mutations.h:368
SingleRowMutation(RowKey &&row_key, M &&... m)
Create a single-row multiple-cell mutation from a variadic list.
Definition: mutations.h:326
The main interface to interact with data in a Cloud Bigtable table.
Definition: table.h:166
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28
Mutation SetCell(std::string family, ColumnType &&column, std::chrono::milliseconds timestamp, std::int64_t value)
Create a mutation to store a 64-bit big endian integer value.
Definition: mutations.h:73
Mutation DeleteFromColumn(std::string family, ColumnType &&column)
Delete all the values for the column.
Definition: mutations.h:273
Mutation DeleteFromFamily(std::string family)
Create a mutation to delete all the cells in a column family.
constexpr std::int64_t ServerSetTimestamp()
A magic value where the server sets the timestamp.
Definition: mutations.h:55
Mutation SetCell(Cell)
Create a mutation to set a cell value based on a bigtable::Cell.
Mutation SetCell(std::string family, ColumnType &&column, std::chrono::milliseconds timestamp, ValueType &&value)
Create a mutation to set a cell value.
Definition: mutations.h:59
Mutation DeleteFromColumnStartingFrom(std::string family, ColumnType &&column, std::chrono::duration< Rep1, Period1 > timestamp_begin)
Delete all the values for the column.
Definition: mutations.h:215
Mutation DeleteFromColumn(std::string family, ColumnType &&column, std::chrono::duration< Rep1, Period1 > timestamp_begin, std::chrono::duration< Rep2, Period2 > timestamp_end)
Definition: mutations.h:169
Mutation SetCell(std::string family, ColumnType &&column, std::int64_t value)
Create a mutation to store a 64-bit big endian integer value.
Definition: mutations.h:108
Mutation DeleteFromRow()
Create a mutation to delete all the cells in a row.
Mutation DeleteFromColumnEndingAt(std::string family, ColumnType &&column, std::chrono::duration< Rep2, Period2 > timestamp_end)
Delete all the values for the column.
Definition: mutations.h:258
Mutation SetCell(std::string family, ColumnType &&column, ValueType &&value)
Create a mutation to set a cell value where the server sets the time.
Definition: mutations.h:91
google::cloud::Status MakeStatusFromRpcError(google::rpc::Status const &proto)
Represent a single change to a specific row in a Table.
Definition: mutations.h:45
google::bigtable::v2::Mutation op
Definition: mutations.h:46