google-cloud-bigtable 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +10 -0
- data/LICENSE +201 -0
- data/README.md +65 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +139 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +85 -0
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +137 -0
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +117 -0
- data/lib/google/bigtable/admin/v2/common_pb.rb +24 -0
- data/lib/google/bigtable/admin/v2/instance_pb.rb +72 -0
- data/lib/google/bigtable/admin/v2/table_pb.rb +88 -0
- data/lib/google/bigtable/v2/bigtable_pb.rb +109 -0
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +67 -0
- data/lib/google/bigtable/v2/data_pb.rb +155 -0
- data/lib/google/cloud/bigtable/admin/credentials.rb +26 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1417 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +123 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1079 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +109 -0
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +50 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +279 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +353 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +194 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +209 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +62 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +127 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +124 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +90 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +106 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/bigtable/admin/v2.rb +200 -0
- data/lib/google/cloud/bigtable/admin.rb +196 -0
- data/lib/google/cloud/bigtable/app_profile/job.rb +102 -0
- data/lib/google/cloud/bigtable/app_profile/list.rb +159 -0
- data/lib/google/cloud/bigtable/app_profile.rb +373 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +253 -0
- data/lib/google/cloud/bigtable/cluster/job.rb +92 -0
- data/lib/google/cloud/bigtable/cluster/list.rb +169 -0
- data/lib/google/cloud/bigtable/cluster.rb +264 -0
- data/lib/google/cloud/bigtable/column_family.rb +280 -0
- data/lib/google/cloud/bigtable/column_range.rb +186 -0
- data/lib/google/cloud/bigtable/convert.rb +75 -0
- data/lib/google/cloud/bigtable/credentials.rb +24 -0
- data/lib/google/cloud/bigtable/errors.rb +35 -0
- data/lib/google/cloud/bigtable/gc_rule.rb +215 -0
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +70 -0
- data/lib/google/cloud/bigtable/instance/job.rb +97 -0
- data/lib/google/cloud/bigtable/instance/list.rb +159 -0
- data/lib/google/cloud/bigtable/instance.rb +921 -0
- data/lib/google/cloud/bigtable/longrunning_job.rb +105 -0
- data/lib/google/cloud/bigtable/mutation_entry.rb +244 -0
- data/lib/google/cloud/bigtable/mutation_operations.rb +338 -0
- data/lib/google/cloud/bigtable/policy.rb +163 -0
- data/lib/google/cloud/bigtable/project.rb +580 -0
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +129 -0
- data/lib/google/cloud/bigtable/read_operations.rb +345 -0
- data/lib/google/cloud/bigtable/row.rb +125 -0
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +539 -0
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +108 -0
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +570 -0
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +273 -0
- data/lib/google/cloud/bigtable/row_filter.rb +593 -0
- data/lib/google/cloud/bigtable/row_range.rb +174 -0
- data/lib/google/cloud/bigtable/rows_mutator.rb +120 -0
- data/lib/google/cloud/bigtable/rows_reader.rb +196 -0
- data/lib/google/cloud/bigtable/sample_row_key.rb +82 -0
- data/lib/google/cloud/bigtable/service.rb +817 -0
- data/lib/google/cloud/bigtable/table/cluster_state.rb +93 -0
- data/lib/google/cloud/bigtable/table/column_family_map.rb +68 -0
- data/lib/google/cloud/bigtable/table/list.rb +147 -0
- data/lib/google/cloud/bigtable/table.rb +676 -0
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +579 -0
- data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +65 -0
- data/lib/google/cloud/bigtable/v2/credentials.rb +45 -0
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +286 -0
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +492 -0
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +124 -0
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +89 -0
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/bigtable/v2.rb +132 -0
- data/lib/google/cloud/bigtable/value_range.rb +175 -0
- data/lib/google/cloud/bigtable/version.rb +22 -0
- data/lib/google/cloud/bigtable.rb +223 -0
- data/lib/google-cloud-bigtable.rb +167 -0
- metadata +283 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2018 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
require "google/cloud/bigtable/gc_rule"
|
|
19
|
+
|
|
20
|
+
module Google
|
|
21
|
+
module Cloud
|
|
22
|
+
module Bigtable
|
|
23
|
+
# # ColumnFamily
|
|
24
|
+
#
|
|
25
|
+
# A set of columns within a table which share a common configuration.
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# require "google/cloud/bigtable"
|
|
29
|
+
#
|
|
30
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
31
|
+
#
|
|
32
|
+
# instance = bigtable.instance("my-instance")
|
|
33
|
+
# table = instance.table("my-table")
|
|
34
|
+
#
|
|
35
|
+
# # Create
|
|
36
|
+
# gc_rule = Google::Cloud::Bigtable::GcRule.max_versions(5)
|
|
37
|
+
# column_family = table.column_families.create("cf1", gc_rule: gc_rule)
|
|
38
|
+
#
|
|
39
|
+
# # Update
|
|
40
|
+
# column_family = table.column_families.find_by_name("cf2")
|
|
41
|
+
# column_family.gc_rule = Google::Cloud::Bigtable::GcRule.max_age(600)
|
|
42
|
+
# column_family.update
|
|
43
|
+
#
|
|
44
|
+
# # Delete
|
|
45
|
+
# column_family = table.column_families.find_by_name("cf3")
|
|
46
|
+
# column_family.delete
|
|
47
|
+
#
|
|
48
|
+
class ColumnFamily
|
|
49
|
+
# @private
|
|
50
|
+
# The gRPC Service object.
|
|
51
|
+
attr_accessor :service
|
|
52
|
+
|
|
53
|
+
# @private
|
|
54
|
+
attr_accessor :instance_id
|
|
55
|
+
|
|
56
|
+
# @private
|
|
57
|
+
attr_accessor :table_id
|
|
58
|
+
|
|
59
|
+
# Column family name
|
|
60
|
+
attr_reader :name
|
|
61
|
+
|
|
62
|
+
# @private
|
|
63
|
+
#
|
|
64
|
+
# Create instance of ColumnFamily
|
|
65
|
+
# @param service [Google::Cloud::Bigtable::Service]
|
|
66
|
+
# @param grpc [Google::Bigtable::Admin::V2::ColumnFamily]
|
|
67
|
+
# @param name [String] Name of the column family
|
|
68
|
+
#
|
|
69
|
+
def initialize service, grpc: nil, name: nil
|
|
70
|
+
@service = service
|
|
71
|
+
@grpc = grpc || Google::Bigtable::Admin::V2::ColumnFamily.new
|
|
72
|
+
@name = name
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Set GC rule
|
|
76
|
+
#
|
|
77
|
+
# @param rule [Google::Cloud::Bigtable::GcRule]
|
|
78
|
+
#
|
|
79
|
+
def gc_rule= rule
|
|
80
|
+
@grpc.gc_rule = rule.to_grpc
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Get GC rule
|
|
84
|
+
#
|
|
85
|
+
# @return [Google::Cloud::Bigtable::GcRule]
|
|
86
|
+
#
|
|
87
|
+
def gc_rule
|
|
88
|
+
GcRule.from_grpc(@grpc.gc_rule) if @grpc.gc_rule
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Create column family.
|
|
92
|
+
#
|
|
93
|
+
# @return [Google::Cloud::Bigtable::ColumnFamily]
|
|
94
|
+
#
|
|
95
|
+
# @example
|
|
96
|
+
# require "google/cloud/bigtable"
|
|
97
|
+
#
|
|
98
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
99
|
+
#
|
|
100
|
+
# instance = bigtable.instance("my-instance")
|
|
101
|
+
# table = instance.table("my-table")
|
|
102
|
+
#
|
|
103
|
+
# gc_rule = Google::Cloud::Bigtable::GcRule.max_versions(3)
|
|
104
|
+
# cf = table.column_family("cf", gc_rule)
|
|
105
|
+
# cf.create
|
|
106
|
+
#
|
|
107
|
+
def create
|
|
108
|
+
modify_column_family(self.class.create_modification(name, gc_rule))
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Update column family.
|
|
112
|
+
#
|
|
113
|
+
# @return [Google::Cloud::Bigtable::ColumnFamily]
|
|
114
|
+
#
|
|
115
|
+
# @example
|
|
116
|
+
# require "google/cloud/bigtable"
|
|
117
|
+
#
|
|
118
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
119
|
+
#
|
|
120
|
+
# instance = bigtable.instance("my-instance")
|
|
121
|
+
# table = instance.table("my-table")
|
|
122
|
+
#
|
|
123
|
+
# column_family = table.column_families.find {|cf| cf.name == "cf" }
|
|
124
|
+
# column_family.gc_rule = Google::Cloud::Bigtable::GcRule.max_age(600)
|
|
125
|
+
# column_family.save
|
|
126
|
+
#
|
|
127
|
+
def save
|
|
128
|
+
modify_column_family(self.class.update_modification(name, gc_rule))
|
|
129
|
+
end
|
|
130
|
+
alias update save
|
|
131
|
+
|
|
132
|
+
# Permanently delete column family from table.
|
|
133
|
+
#
|
|
134
|
+
# @return [Google::Cloud::Bigtable::Table]
|
|
135
|
+
#
|
|
136
|
+
# @example
|
|
137
|
+
# require "google/cloud/bigtable"
|
|
138
|
+
#
|
|
139
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
140
|
+
#
|
|
141
|
+
# instance = bigtable.instance("my-instance")
|
|
142
|
+
# table = instance.table("my-table")
|
|
143
|
+
#
|
|
144
|
+
# column_family = table.column_families.find {|cf| cf.name == "cf" }
|
|
145
|
+
# column_family.delete
|
|
146
|
+
#
|
|
147
|
+
def delete
|
|
148
|
+
modify_column_family(self.class.drop_modification(name)).nil?
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Create gPRC instance to create column family modification
|
|
152
|
+
#
|
|
153
|
+
# @param name [String] Column family name
|
|
154
|
+
# @param gc_rule [Google::Cloud::Bigtable::GcRule] GC Rule
|
|
155
|
+
# @return [Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification]
|
|
156
|
+
#
|
|
157
|
+
# @example
|
|
158
|
+
# require "google/cloud/bigtable"
|
|
159
|
+
#
|
|
160
|
+
# Google::Cloud::Bigtable::ColumnFamily.create_modification(
|
|
161
|
+
# "cf1", Google::Cloud::Bigtable::GcRule.max_age(600))
|
|
162
|
+
# )
|
|
163
|
+
#
|
|
164
|
+
def self.create_modification name, gc_rule
|
|
165
|
+
column_modification_grpc(:create, name, gc_rule)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Create update column family modification gPRC instance
|
|
169
|
+
#
|
|
170
|
+
# @param name [String] Column family name
|
|
171
|
+
# @param gc_rule [Google::Cloud::Bigtable::GcRule] GC Rule
|
|
172
|
+
# @return [Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification]
|
|
173
|
+
#
|
|
174
|
+
# @example
|
|
175
|
+
# require "google/cloud/bigtable"
|
|
176
|
+
#
|
|
177
|
+
# Google::Cloud::Bigtable::ColumnFamily.update_modification(
|
|
178
|
+
# "cf1", Google::Cloud::Bigtable::GcRule.max_age(600))
|
|
179
|
+
# )
|
|
180
|
+
#
|
|
181
|
+
def self.update_modification name, gc_rule
|
|
182
|
+
column_modification_grpc(:update, name, gc_rule)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Create drop column family modification gRPC instance
|
|
186
|
+
#
|
|
187
|
+
# @param name [String] Column family name
|
|
188
|
+
# @return [Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification]
|
|
189
|
+
#
|
|
190
|
+
# @example
|
|
191
|
+
# require "google/cloud/bigtable"
|
|
192
|
+
#
|
|
193
|
+
# Google::Cloud::Bigtable::ColumnFamily.drop_modification("cf1")
|
|
194
|
+
#
|
|
195
|
+
def self.drop_modification name
|
|
196
|
+
column_modification_grpc(:drop, name)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# @private
|
|
200
|
+
#
|
|
201
|
+
# Creates a new ColumnFamily instance from a
|
|
202
|
+
# Google::Bigtable::Admin::V2::ColumnFamily.
|
|
203
|
+
#
|
|
204
|
+
# @param grpc [Google::Bigtable::Admin::V2::ColumnFamily]
|
|
205
|
+
# @param service [Google::Cloud::Bigtable::Service]
|
|
206
|
+
# @param name [String] Column family name
|
|
207
|
+
# @param instance_id [String]
|
|
208
|
+
# @param table_id [String]
|
|
209
|
+
# @return [Google::Cloud::Bigtable::ColumnFamily]
|
|
210
|
+
#
|
|
211
|
+
def self.from_grpc \
|
|
212
|
+
grpc,
|
|
213
|
+
service,
|
|
214
|
+
name: nil,
|
|
215
|
+
instance_id: nil,
|
|
216
|
+
table_id: nil
|
|
217
|
+
new(service, grpc: grpc, name: name).tap do |cf|
|
|
218
|
+
cf.table_id = table_id
|
|
219
|
+
cf.instance_id = instance_id
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# @private
|
|
224
|
+
#
|
|
225
|
+
# Create column family modification gRPC instance.
|
|
226
|
+
#
|
|
227
|
+
# @param type [Symbol] Type of modification.
|
|
228
|
+
# Valid values are `:create`, `:update`, `drop`
|
|
229
|
+
# @param family_name [String] Column family name
|
|
230
|
+
# @param gc_rule [Google::Cloud::Bigtable::GcRule]
|
|
231
|
+
# Required for only create and update modification type.
|
|
232
|
+
# @return [Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification]
|
|
233
|
+
#
|
|
234
|
+
def self.column_modification_grpc type, family_name, gc_rule = nil
|
|
235
|
+
attrs = { id: family_name }
|
|
236
|
+
|
|
237
|
+
attrs[type] = if type == :drop
|
|
238
|
+
true
|
|
239
|
+
else
|
|
240
|
+
Google::Bigtable::Admin::V2::ColumnFamily.new(
|
|
241
|
+
gc_rule: gc_rule.to_grpc
|
|
242
|
+
)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest:: \
|
|
246
|
+
Modification.new(attrs)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
protected
|
|
250
|
+
|
|
251
|
+
# @private
|
|
252
|
+
#
|
|
253
|
+
# Create/Update/Delete column_family.
|
|
254
|
+
#
|
|
255
|
+
# @param modification [Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification]
|
|
256
|
+
# @return [Google::Cloud::Bigtable::ColumnFamily]
|
|
257
|
+
#
|
|
258
|
+
def modify_column_family modification
|
|
259
|
+
ensure_service!
|
|
260
|
+
table = Table.modify_column_families(
|
|
261
|
+
service,
|
|
262
|
+
instance_id,
|
|
263
|
+
table_id,
|
|
264
|
+
modification
|
|
265
|
+
)
|
|
266
|
+
table.column_families.find { |cf| cf.name == name }
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# @private
|
|
270
|
+
#
|
|
271
|
+
# Raise an error unless an active connection to the service is
|
|
272
|
+
# available.
|
|
273
|
+
#
|
|
274
|
+
def ensure_service!
|
|
275
|
+
raise "Must have active connection to service" unless service
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2018 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
module Google
|
|
19
|
+
module Cloud
|
|
20
|
+
module Bigtable
|
|
21
|
+
# # ColumnRange
|
|
22
|
+
#
|
|
23
|
+
# Specifies a contiguous range of column qualifiers.
|
|
24
|
+
#
|
|
25
|
+
# * Start qualifier bound : The qualifier at which to start the range.
|
|
26
|
+
# If neither field is set, interpreted as the empty string, inclusive.
|
|
27
|
+
# * End qualifier bound: The qualifier at which to end the range.
|
|
28
|
+
# If neither field is set, interpreted as the infinite string qualifier, exclusive.
|
|
29
|
+
#
|
|
30
|
+
# @example
|
|
31
|
+
# require "google/cloud/bigtable"
|
|
32
|
+
#
|
|
33
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
34
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
35
|
+
#
|
|
36
|
+
# # Range that includes all qualifiers including "user-001" up until "user-010"
|
|
37
|
+
# table.new_column_range("cf").from("user-001").to("user-010")
|
|
38
|
+
#
|
|
39
|
+
# # Range that includes all qualifiers including "user-001" up incluing "user-005"
|
|
40
|
+
# table.new_column_range("cf").from("user-001").to("user-005", inclusive: true)
|
|
41
|
+
#
|
|
42
|
+
# # Range that includes all qualifiers until end of the row key "user-001".
|
|
43
|
+
# table.new_column_range("cf").to("user-010") # exclusive
|
|
44
|
+
#
|
|
45
|
+
# # Range with unbounded start and the inclusive end "user-100"
|
|
46
|
+
# table.new_column_range("cf").to("user-100", inclusive: true)
|
|
47
|
+
#
|
|
48
|
+
# # Range that includes all qualifiers including "user-001" up to including "user-100"
|
|
49
|
+
# table.new_column_range("cf").between("user-001", "user-100")
|
|
50
|
+
#
|
|
51
|
+
class ColumnRange
|
|
52
|
+
# Create qualifier range instance.
|
|
53
|
+
#
|
|
54
|
+
# @param family [String] Column family name.
|
|
55
|
+
#
|
|
56
|
+
def initialize family
|
|
57
|
+
@grpc = Google::Bigtable::V2::ColumnRange.new(family_name: family)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Get column family name
|
|
61
|
+
#
|
|
62
|
+
# @return [String]
|
|
63
|
+
#
|
|
64
|
+
def family
|
|
65
|
+
@grpc.family_name
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Set column family name
|
|
69
|
+
#
|
|
70
|
+
# @param name [String] Column family name
|
|
71
|
+
#
|
|
72
|
+
def family= name
|
|
73
|
+
@grpc.family_name = name
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Set column range with the lower bound.
|
|
77
|
+
#
|
|
78
|
+
# @param qualifier [String] Column qualifier name. Required
|
|
79
|
+
# @param inclusive [String] Lower bound flag. Inclusive/Exclusive.
|
|
80
|
+
# Default it is an inclusive lower bound.
|
|
81
|
+
# @return [Google::Cloud::Bigtable::ColumnRange]
|
|
82
|
+
#
|
|
83
|
+
# @example Inclusive lower bound.
|
|
84
|
+
# require "google/cloud/bigtable"
|
|
85
|
+
#
|
|
86
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
87
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
88
|
+
#
|
|
89
|
+
# table.new_column_range("cf").from("qualifier-1")
|
|
90
|
+
#
|
|
91
|
+
# @example Exclusive lower bound.
|
|
92
|
+
# require "google/cloud/bigtable"
|
|
93
|
+
#
|
|
94
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
95
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
96
|
+
#
|
|
97
|
+
# table.new_column_range("cf").from("qualifier-1", inclusive: false)
|
|
98
|
+
#
|
|
99
|
+
def from qualifier, inclusive: true
|
|
100
|
+
if inclusive
|
|
101
|
+
@grpc.start_qualifier_closed = qualifier
|
|
102
|
+
else
|
|
103
|
+
@grpc.start_qualifier_open = qualifier
|
|
104
|
+
end
|
|
105
|
+
self
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Set column range with the upper bound.
|
|
109
|
+
#
|
|
110
|
+
# @param qualifier [String] Column qualifier name. Required
|
|
111
|
+
# @param inclusive [String] Upper bound flag. Inclusive/Exclusive..
|
|
112
|
+
# Default it is an inclusive upper bound.
|
|
113
|
+
# @return [Google::Cloud::Bigtable::ColumnRange]
|
|
114
|
+
#
|
|
115
|
+
# @example Inclusive upper bound.
|
|
116
|
+
# require "google/cloud/bigtable"
|
|
117
|
+
#
|
|
118
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
119
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
120
|
+
#
|
|
121
|
+
# table.new_column_range("cf").to("qualifier-10", inclusive: true)
|
|
122
|
+
#
|
|
123
|
+
# @example Exclusive upper bound.
|
|
124
|
+
# require "google/cloud/bigtable"
|
|
125
|
+
#
|
|
126
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
127
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
128
|
+
#
|
|
129
|
+
# table.new_column_range("cf").to("qualifier-10")
|
|
130
|
+
#
|
|
131
|
+
def to qualifier, inclusive: false
|
|
132
|
+
if inclusive
|
|
133
|
+
@grpc.end_qualifier_closed = qualifier
|
|
134
|
+
else
|
|
135
|
+
@grpc.end_qualifier_open = qualifier
|
|
136
|
+
end
|
|
137
|
+
self
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Set column range with the inclusive upper and lower bound.
|
|
141
|
+
#
|
|
142
|
+
# @param from_qualifier [String] Inclusive from qualifier. Required
|
|
143
|
+
# @param to_qualifier [String] Inclusive to qualifier. Required
|
|
144
|
+
# @return [Google::Cloud::Bigtable::ColumnRange]
|
|
145
|
+
#
|
|
146
|
+
# @example
|
|
147
|
+
# require "google/cloud/bigtable"
|
|
148
|
+
#
|
|
149
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
150
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
151
|
+
#
|
|
152
|
+
# table.new_column_range("cf").between("qualifier-1", "qualifier-10")
|
|
153
|
+
#
|
|
154
|
+
def between from_qualifier, to_qualifier
|
|
155
|
+
from(from_qualifier).to(to_qualifier, inclusive: true)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Set column range with the inclusive upper and the exclusive lower bound.
|
|
159
|
+
#
|
|
160
|
+
# @param from_qualifier [String] Inclusive from qualifier
|
|
161
|
+
# @param to_qualifier [String] Exclusive to qualifier
|
|
162
|
+
# @return [Google::Cloud::Bigtable::ColumnRange]
|
|
163
|
+
#
|
|
164
|
+
# @example
|
|
165
|
+
# require "google/cloud/bigtable"
|
|
166
|
+
#
|
|
167
|
+
# bigtable = Google::Cloud::Bigtable.new
|
|
168
|
+
# table = bigtable.table("my-instance", "my-table")
|
|
169
|
+
#
|
|
170
|
+
# table.new_column_range("cf").of("qualifier-1", "qualifier-10")
|
|
171
|
+
#
|
|
172
|
+
def of from_qualifier, to_qualifier
|
|
173
|
+
from(from_qualifier).to(to_qualifier)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# @private
|
|
177
|
+
#
|
|
178
|
+
# @return [Google::Bigtable::V2::ColumnRange]
|
|
179
|
+
#
|
|
180
|
+
def to_grpc
|
|
181
|
+
@grpc
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|