15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_COLUMN_FAMILY_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_COLUMN_FAMILY_H
18#include "google/cloud/bigtable/version.h"
19#include "absl/meta/type_traits.h"
20#include <google/bigtable/admin/v2/bigtable_table_admin.pb.h>
21#include <google/bigtable/admin/v2/table.pb.h>
22#include <google/protobuf/util/message_differencer.h>
30GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
32
33
34
35
41 tmp.gc_rule_.set_max_num_versions(n);
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 template <
typename Rep,
typename Period>
73 static GcRule MaxAge(std::chrono::duration<Rep, Period> duration) {
75 auto& max_age = *tmp.gc_rule_.mutable_max_age();
76 auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
77 max_age.set_seconds(seconds.count());
78 std::chrono::nanoseconds nanos =
79 std::chrono::duration_cast<std::chrono::nanoseconds>(duration) -
81 max_age.set_nanos(
static_cast<std::int32_t>(nanos.count()));
86
87
88
89
90
91
92
93 template <
typename... GcRuleTypes>
99 absl::conjunction<std::is_convertible<GcRuleTypes,
GcRule>...>::value,
100 "The arguments to Intersection must be convertible to GcRule");
102 auto& intersection = *tmp.gc_rule_.mutable_intersection();
103 std::initializer_list<
GcRule> list{std::forward<GcRuleTypes>(gc_rules)...};
104 for (
GcRule const& rule : list) {
111
112
113
114
115
116
117
118 template <
typename... GcRuleTypes>
124 absl::conjunction<std::is_convertible<GcRuleTypes,
GcRule>...>::value,
125 "The arguments to Union must be convertible to GcRule");
127 auto& gc_rule_union = *tmp.gc_rule_.mutable_union_();
128 std::initializer_list<
GcRule> list{std::forward<GcRuleTypes>(gc_rules)...};
129 for (
GcRule const& rule : list) {
142 return std::move(gc_rule_);
154 return google::protobuf::util::MessageDifferencer::Equivalent(a.gc_rule_,
164 google::bigtable::admin::v2::GcRule gc_rule_;
168
169
170
171
172
173
174
175
176
177
183 tmp.mod_.set_id(std::move(id));
184 *tmp.mod_.mutable_create()->mutable_gc_rule() = std::move(gc)
.as_proto();
191 tmp.mod_.set_id(std::move(id));
192 *tmp.mod_.mutable_update()->mutable_gc_rule() = std::move(gc)
.as_proto();
199 tmp.mod_.set_id(std::move(id));
200 tmp.mod_.set_drop(
true);
205 ::
google::bigtable::admin::v2::ModifyColumnFamiliesRequest::
212 ::
google::bigtable::admin::v2::ModifyColumnFamiliesRequest::Modification&&
214 return std::move(mod_);
228 return google::protobuf::util::MessageDifferencer::Equivalent(a.mod_,
237 ColumnFamilyModification() =
default;
239 ::
google::bigtable::admin::v2::ModifyColumnFamiliesRequest::Modification mod_;
242GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Define the interfaces to create column family modifications.
Definition: column_family.h:178
ColumnFamilyModification & operator=(ColumnFamilyModification const &)=default
ColumnFamilyModification(ColumnFamilyModification const &)=default
static ColumnFamilyModification Create(std::string id, GcRule gc)
Return a modification that creates a new column family.
Definition: column_family.h:181
ColumnFamilyModification(ColumnFamilyModification &&)=default
ColumnFamilyModification & operator=(ColumnFamilyModification &&)=default
friend bool operator==(ColumnFamilyModification const &a, ColumnFamilyModification const &b) noexcept
Definition: column_family.h:226
friend bool operator!=(ColumnFamilyModification const &a, ColumnFamilyModification const &b) noexcept
Definition: column_family.h:231
static ColumnFamilyModification Drop(std::string id)
Return a modification that drops the id column family.
Definition: column_family.h:197
static ColumnFamilyModification Update(std::string id, GcRule gc)
Return a modification that creates a new column family.
Definition: column_family.h:189
::google::bigtable::admin::v2::ModifyColumnFamiliesRequest::Modification const & as_proto() const &
Convert to the proto form.
Definition: column_family.h:207
::google::bigtable::admin::v2::ModifyColumnFamiliesRequest::Modification && as_proto() &&
Move out the underlying proto contents.
Definition: column_family.h:213
Implement a thin wrapper around google::bigtable::admin::v2::GcRule.
Definition: column_family.h:36
GcRule & operator=(GcRule const &)=default
GcRule(GcRule const &)=default
static GcRule Union(GcRuleTypes &&... gc_rules)
Return a GcRule that deletes cells if any the rules passed in would delete the cells.
Definition: column_family.h:119
friend bool operator==(GcRule const &a, GcRule const &b) noexcept
Definition: column_family.h:153
static GcRule MaxNumVersions(std::int32_t n)
Create a garbage collection rule that keeps the last n versions.
Definition: column_family.h:39
google::bigtable::admin::v2::GcRule const & as_proto() const &
Convert to the proto form.
Definition: column_family.h:136
static GcRule MaxAge(std::chrono::duration< Rep, Period > duration)
Return a garbage collection rule that deletes cells in a column older than the given duration.
Definition: column_family.h:73
google::bigtable::admin::v2::GcRule && as_proto() &&
Move the internal proto out.
Definition: column_family.h:141
static GcRule Intersection(GcRuleTypes &&... gc_rules)
Return a GcRule that deletes cells if all the rules passed in would delete the cells.
Definition: column_family.h:94
GcRule(GcRule &&)=default
friend bool operator!=(GcRule const &a, GcRule const &b) noexcept
Definition: column_family.h:157
GcRule & operator=(GcRule &&)=default
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28