google-cloud-bigtable 2.4.1 → 2.6.2
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 +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +32 -0
- data/CONTRIBUTING.md +2 -3
- data/OVERVIEW.md +1 -1
- data/lib/google/cloud/bigtable/app_profile.rb +20 -21
- data/lib/google/cloud/bigtable/app_profile/job.rb +4 -4
- data/lib/google/cloud/bigtable/app_profile/list.rb +5 -7
- data/lib/google/cloud/bigtable/backup.rb +83 -32
- data/lib/google/cloud/bigtable/backup/job.rb +8 -8
- data/lib/google/cloud/bigtable/backup/list.rb +9 -11
- data/lib/google/cloud/bigtable/cluster.rb +37 -17
- data/lib/google/cloud/bigtable/cluster/job.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +2 -2
- data/lib/google/cloud/bigtable/column_family_map.rb +14 -14
- data/lib/google/cloud/bigtable/column_range.rb +7 -7
- data/lib/google/cloud/bigtable/encryption_info.rb +118 -0
- data/lib/google/cloud/bigtable/gc_rule.rb +20 -20
- data/lib/google/cloud/bigtable/instance.rb +40 -40
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +61 -21
- data/lib/google/cloud/bigtable/instance/job.rb +4 -4
- data/lib/google/cloud/bigtable/mutation_entry.rb +21 -21
- data/lib/google/cloud/bigtable/mutation_operations.rb +34 -34
- data/lib/google/cloud/bigtable/policy.rb +4 -4
- data/lib/google/cloud/bigtable/project.rb +15 -15
- data/lib/google/cloud/bigtable/read_operations.rb +31 -31
- data/lib/google/cloud/bigtable/routing_policy.rb +6 -6
- data/lib/google/cloud/bigtable/row_filter.rb +28 -28
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +30 -29
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +6 -6
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +27 -26
- data/lib/google/cloud/bigtable/row_range.rb +18 -18
- data/lib/google/cloud/bigtable/sample_row_key.rb +1 -1
- data/lib/google/cloud/bigtable/service.rb +6 -3
- data/lib/google/cloud/bigtable/status.rb +2 -2
- data/lib/google/cloud/bigtable/table.rb +66 -43
- data/lib/google/cloud/bigtable/table/cluster_state.rb +43 -9
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/table/restore_job.rb +12 -12
- data/lib/google/cloud/bigtable/value_range.rb +18 -18
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +4 -3
@@ -38,9 +38,9 @@ module Google
|
|
38
38
|
# "my-instance",
|
39
39
|
# display_name: "Instance for user data",
|
40
40
|
# type: :DEVELOPMENT,
|
41
|
-
# labels: { "env" => "dev"}
|
41
|
+
# labels: { "env" => "dev" }
|
42
42
|
# ) do |clusters|
|
43
|
-
# clusters.add
|
43
|
+
# clusters.add "test-cluster", "us-east1-b" # nodes not allowed
|
44
44
|
# end
|
45
45
|
#
|
46
46
|
# # Check and reload.
|
@@ -74,9 +74,9 @@ module Google
|
|
74
74
|
# "my-instance",
|
75
75
|
# display_name: "Instance for user data",
|
76
76
|
# type: :DEVELOPMENT,
|
77
|
-
# labels: { "env" => "dev"}
|
77
|
+
# labels: { "env" => "dev" }
|
78
78
|
# ) do |clusters|
|
79
|
-
# clusters.add
|
79
|
+
# clusters.add "test-cluster", "us-east1-b" # nodes not allowed
|
80
80
|
# end
|
81
81
|
#
|
82
82
|
# job.done? #=> false
|
@@ -33,14 +33,14 @@ module Google
|
|
33
33
|
# See {Google::Cloud::Bigtable::Table#check_and_mutate_row}
|
34
34
|
#
|
35
35
|
# @example
|
36
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
37
|
-
# timestamp_micros = (Time.now.to_f *
|
36
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
37
|
+
# timestamp_micros = (Time.now.to_f * 1_000_000).round(-3)
|
38
38
|
# entry.set_cell(
|
39
39
|
# "cf1", "fiel01", "XYZ", timestamp: timestamp_micros
|
40
40
|
# ).delete_cells(
|
41
41
|
# "cf2",
|
42
42
|
# "field02",
|
43
|
-
# timestamp_from: timestamp_micros -
|
43
|
+
# timestamp_from: timestamp_micros - 5_000_000,
|
44
44
|
# timestamp_to: timestamp_micros
|
45
45
|
# ).delete_from_family("cf3").delete_from_row
|
46
46
|
#
|
@@ -48,10 +48,10 @@ module Google
|
|
48
48
|
# require "google/cloud/bigtable"
|
49
49
|
#
|
50
50
|
# bigtable = Google::Cloud::Bigtable.new
|
51
|
-
# table = bigtable.table
|
51
|
+
# table = bigtable.table "my-instance", "my-table"
|
52
52
|
#
|
53
|
-
# entry = table.new_mutation_entry
|
54
|
-
# timestamp_micros = (Time.now.to_f *
|
53
|
+
# entry = table.new_mutation_entry "user-1"
|
54
|
+
# timestamp_micros = (Time.now.to_f * 1_000_000).round(-3)
|
55
55
|
# entry.set_cell(
|
56
56
|
# "cf1", "fiel01", "XYZ", timestamp: timestamp_micros
|
57
57
|
# )
|
@@ -101,16 +101,16 @@ module Google
|
|
101
101
|
# @return [MutationEntry] `self` object of entry for chaining.
|
102
102
|
#
|
103
103
|
# @example
|
104
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
105
|
-
# entry.set_cell
|
104
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
105
|
+
# entry.set_cell "cf1", "field01", "XYZ"
|
106
106
|
#
|
107
107
|
# @example With timestamp.
|
108
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
108
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
109
109
|
# entry.set_cell(
|
110
110
|
# "cf1",
|
111
111
|
# "field1",
|
112
112
|
# "XYZ",
|
113
|
-
# timestamp: (Time.now.to_f *
|
113
|
+
# timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
|
114
114
|
# )
|
115
115
|
#
|
116
116
|
def set_cell family, qualifier, value, timestamp: nil
|
@@ -158,25 +158,25 @@ module Google
|
|
158
158
|
# @return [MutationEntry] `self` object of entry for chaining.
|
159
159
|
#
|
160
160
|
# @example Without timestamp range.
|
161
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
162
|
-
# entry.delete_cells
|
161
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
162
|
+
# entry.delete_cells "cf1", "field1"
|
163
163
|
#
|
164
164
|
# @example With timestamp range.
|
165
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
166
|
-
# timestamp_micros = (Time.now.to_f *
|
165
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
166
|
+
# timestamp_micros = (Time.now.to_f * 1_000_000).round(-3)
|
167
167
|
# entry.delete_cells(
|
168
168
|
# "cf1",
|
169
169
|
# "field1",
|
170
|
-
# timestamp_from: timestamp_micros -
|
170
|
+
# timestamp_from: timestamp_micros - 5_000_000,
|
171
171
|
# timestamp_to: timestamp_micros
|
172
172
|
# )
|
173
173
|
# @example With timestamp range with lower boundary only.
|
174
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
175
|
-
# timestamp_micros = (Time.now.to_f *
|
174
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
175
|
+
# timestamp_micros = (Time.now.to_f * 1_000_000).round(-3)
|
176
176
|
# entry.delete_cells(
|
177
177
|
# "cf1",
|
178
178
|
# "field1",
|
179
|
-
# timestamp_from: timestamp_micros -
|
179
|
+
# timestamp_from: timestamp_micros - 5_000_000
|
180
180
|
# )
|
181
181
|
#
|
182
182
|
def delete_cells family, qualifier, timestamp_from: nil, timestamp_to: nil
|
@@ -203,8 +203,8 @@ module Google
|
|
203
203
|
# @return [MutationEntry] `self` object of entry for chaining.
|
204
204
|
#
|
205
205
|
# @example
|
206
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
207
|
-
# entry.delete_from_family
|
206
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
207
|
+
# entry.delete_from_family "cf1"
|
208
208
|
#
|
209
209
|
def delete_from_family family
|
210
210
|
@mutations << Google::Cloud::Bigtable::V2::Mutation.new(delete_from_family: { family_name: family })
|
@@ -219,7 +219,7 @@ module Google
|
|
219
219
|
# @return [MutationEntry] `self` object of entry for chaining.
|
220
220
|
#
|
221
221
|
# @example
|
222
|
-
# entry = Google::Cloud::Bigtable::MutationEntry.new
|
222
|
+
# entry = Google::Cloud::Bigtable::MutationEntry.new "user-1"
|
223
223
|
# entry.delete_from_row
|
224
224
|
#
|
225
225
|
def delete_from_row
|
@@ -50,28 +50,28 @@ module Google
|
|
50
50
|
#
|
51
51
|
# bigtable = Google::Cloud::Bigtable.new
|
52
52
|
#
|
53
|
-
# table = bigtable.table
|
53
|
+
# table = bigtable.table "my-instance", "my-table"
|
54
54
|
#
|
55
|
-
# entry = table.new_mutation_entry
|
56
|
-
# entry.set_cell
|
57
|
-
# table.mutate_row
|
55
|
+
# entry = table.new_mutation_entry "user-1"
|
56
|
+
# entry.set_cell "cf1", "field1", "XYZ"
|
57
|
+
# table.mutate_row entry
|
58
58
|
#
|
59
59
|
# @example Multiple mutations on row.
|
60
60
|
# require "google/cloud/bigtable"
|
61
61
|
#
|
62
62
|
# bigtable = Google::Cloud::Bigtable.new
|
63
63
|
#
|
64
|
-
# table = bigtable.table
|
64
|
+
# table = bigtable.table "my-instance", "my-table"
|
65
65
|
#
|
66
|
-
# entry = table.new_mutation_entry
|
66
|
+
# entry = table.new_mutation_entry "user-1"
|
67
67
|
# entry.set_cell(
|
68
68
|
# "cf1",
|
69
69
|
# "field1",
|
70
70
|
# "XYZ",
|
71
|
-
# timestamp: (Time.now.to_f *
|
72
|
-
# ).delete_cells
|
71
|
+
# timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
|
72
|
+
# ).delete_cells "cf2", "field02"
|
73
73
|
#
|
74
|
-
# table.mutate_row
|
74
|
+
# table.mutate_row entry
|
75
75
|
#
|
76
76
|
def mutate_row entry
|
77
77
|
service.mutate_row path, entry.row_key, entry.mutations, app_profile_id: @app_profile_id
|
@@ -96,12 +96,12 @@ module Google
|
|
96
96
|
#
|
97
97
|
# bigtable = Google::Cloud::Bigtable.new
|
98
98
|
#
|
99
|
-
# table = bigtable.table
|
99
|
+
# table = bigtable.table "my-instance", "my-table"
|
100
100
|
#
|
101
101
|
# entries = []
|
102
102
|
# entries << table.new_mutation_entry("row-1").set_cell("cf1", "field1", "XYZ")
|
103
103
|
# entries << table.new_mutation_entry("row-2").set_cell("cf1", "field1", "ABC")
|
104
|
-
# responses = table.mutate_rows
|
104
|
+
# responses = table.mutate_rows entries
|
105
105
|
#
|
106
106
|
# responses.each do |response|
|
107
107
|
# puts response.status.description
|
@@ -131,15 +131,15 @@ module Google
|
|
131
131
|
# require "google/cloud/bigtable"
|
132
132
|
#
|
133
133
|
# bigtable = Google::Cloud::Bigtable.new
|
134
|
-
# table = bigtable.table
|
134
|
+
# table = bigtable.table "my-instance", "my-table"
|
135
135
|
#
|
136
|
-
# rule_1 = table.new_read_modify_write_rule
|
137
|
-
# rule_1.append
|
136
|
+
# rule_1 = table.new_read_modify_write_rule "cf", "field01"
|
137
|
+
# rule_1.append "append-xyz"
|
138
138
|
#
|
139
|
-
# rule_2 = table.new_read_modify_write_rule
|
140
|
-
# rule_2.increment
|
139
|
+
# rule_2 = table.new_read_modify_write_rule "cf", "field01"
|
140
|
+
# rule_2.increment 1
|
141
141
|
#
|
142
|
-
# row = table.read_modify_write_row
|
142
|
+
# row = table.read_modify_write_row "user01", [rule_1, rule_2]
|
143
143
|
#
|
144
144
|
# puts row.cells
|
145
145
|
#
|
@@ -147,11 +147,11 @@ module Google
|
|
147
147
|
# require "google/cloud/bigtable"
|
148
148
|
#
|
149
149
|
# bigtable = Google::Cloud::Bigtable.new
|
150
|
-
# table = bigtable.table
|
150
|
+
# table = bigtable.table "my-instance", "my-table"
|
151
151
|
#
|
152
152
|
# rule = table.new_read_modify_write_rule("cf", "field01").append("append-xyz")
|
153
153
|
#
|
154
|
-
# row = table.read_modify_write_row
|
154
|
+
# row = table.read_modify_write_row "user01", rule
|
155
155
|
#
|
156
156
|
# puts row.cells
|
157
157
|
#
|
@@ -214,19 +214,19 @@ module Google
|
|
214
214
|
# require "google/cloud/bigtable"
|
215
215
|
#
|
216
216
|
# bigtable = Google::Cloud::Bigtable.new
|
217
|
-
# table = bigtable.table
|
217
|
+
# table = bigtable.table "my-instance", "my-table"
|
218
218
|
#
|
219
|
-
# predicate_filter = Google::Cloud::Bigtable::RowFilter.key
|
219
|
+
# predicate_filter = Google::Cloud::Bigtable::RowFilter.key "user-10"
|
220
220
|
# on_match_mutations = Google::Cloud::Bigtable::MutationEntry.new
|
221
221
|
# on_match_mutations.set_cell(
|
222
222
|
# "cf1",
|
223
223
|
# "field1",
|
224
224
|
# "XYZ",
|
225
|
-
# timestamp: (Time.now.to_f *
|
226
|
-
# ).delete_cells
|
225
|
+
# timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
|
226
|
+
# ).delete_cells "cf2", "field02"
|
227
227
|
#
|
228
228
|
# otherwise_mutations = Google::Cloud::Bigtable::MutationEntry.new
|
229
|
-
# otherwise_mutations.delete_from_family
|
229
|
+
# otherwise_mutations.delete_from_family "cf3"
|
230
230
|
#
|
231
231
|
# predicate_matched = table.check_and_mutate_row(
|
232
232
|
# "user01",
|
@@ -264,9 +264,9 @@ module Google
|
|
264
264
|
# require "google/cloud/bigtable"
|
265
265
|
#
|
266
266
|
# bigtable = Google::Cloud::Bigtable.new
|
267
|
-
# table = bigtable.table
|
267
|
+
# table = bigtable.table "my-instance", "my-table"
|
268
268
|
#
|
269
|
-
# entry = table.new_mutation_entry
|
269
|
+
# entry = table.new_mutation_entry "row-key-1"
|
270
270
|
#
|
271
271
|
# # Without row key
|
272
272
|
# entry = table.new_mutation_entry
|
@@ -289,17 +289,17 @@ module Google
|
|
289
289
|
# require "google/cloud/bigtable"
|
290
290
|
#
|
291
291
|
# bigtable = Google::Cloud::Bigtable.new
|
292
|
-
# table = bigtable.table
|
293
|
-
# rule = table.new_read_modify_write_rule
|
294
|
-
# rule.append
|
292
|
+
# table = bigtable.table "my-instance", "my-table"
|
293
|
+
# rule = table.new_read_modify_write_rule "cf", "qualifier-1"
|
294
|
+
# rule.append "append-xyz"
|
295
295
|
#
|
296
296
|
# @example Create rule to increment qualifier value.
|
297
297
|
# require "google/cloud/bigtable"
|
298
298
|
#
|
299
299
|
# bigtable = Google::Cloud::Bigtable.new
|
300
|
-
# table = bigtable.table
|
301
|
-
# rule = table.new_read_modify_write_rule
|
302
|
-
# rule.increment
|
300
|
+
# table = bigtable.table "my-instance", "my-table"
|
301
|
+
# rule = table.new_read_modify_write_rule "cf", "qualifier-1"
|
302
|
+
# rule.increment 100
|
303
303
|
#
|
304
304
|
def new_read_modify_write_rule family, qualifier
|
305
305
|
Google::Cloud::Bigtable::ReadModifyWriteRule.new family, qualifier
|
@@ -323,12 +323,12 @@ module Google
|
|
323
323
|
#
|
324
324
|
# bigtable = Google::Cloud::Bigtable.new
|
325
325
|
#
|
326
|
-
# table = bigtable.table
|
326
|
+
# table = bigtable.table "my-instance", "my-table"
|
327
327
|
#
|
328
328
|
# entries = []
|
329
329
|
# entries << table.new_mutation_entry("row-1").set_cell("cf1", "field1", "XYZ")
|
330
330
|
# entries << table.new_mutation_entry("row-2").set_cell("cf1", "field1", "ABC")
|
331
|
-
# responses = table.mutate_rows
|
331
|
+
# responses = table.mutate_rows entries
|
332
332
|
#
|
333
333
|
# responses.each do |response|
|
334
334
|
# puts response.status.description
|
@@ -49,8 +49,8 @@ module Google
|
|
49
49
|
# instance = bigtable.instance "my-instance"
|
50
50
|
#
|
51
51
|
# policy = instance.policy
|
52
|
-
# policy.remove
|
53
|
-
# policy.add
|
52
|
+
# policy.remove "roles/owner", "user:owner@example.com"
|
53
|
+
# policy.add "roles/owner", "user:newowner@example.com"
|
54
54
|
# policy.roles["roles/viewer"] = ["allUsers"]
|
55
55
|
#
|
56
56
|
class Policy
|
@@ -85,7 +85,7 @@ module Google
|
|
85
85
|
# instance = bigtable.instance "my-instance"
|
86
86
|
#
|
87
87
|
# policy = instance.policy
|
88
|
-
# policy.add
|
88
|
+
# policy.add "roles/owner", "user:newowner@example.com"
|
89
89
|
#
|
90
90
|
def add role_name, member
|
91
91
|
role(role_name) << member
|
@@ -111,7 +111,7 @@ module Google
|
|
111
111
|
# instance = bigtable.instance "my-instance"
|
112
112
|
#
|
113
113
|
# policy = instance.policy
|
114
|
-
# policy.remove
|
114
|
+
# policy.remove "roles/owner", "user:newowner@example.com"
|
115
115
|
#
|
116
116
|
def remove role_name, member
|
117
117
|
role(role_name).delete member
|
@@ -46,7 +46,7 @@ module Google
|
|
46
46
|
#
|
47
47
|
# bigtable = Google::Cloud::Bigtable.new
|
48
48
|
#
|
49
|
-
# instance = bigtable.instance
|
49
|
+
# instance = bigtable.instance "my-instance"
|
50
50
|
# clusters = bigtable.clusters # All clusters in the project
|
51
51
|
#
|
52
52
|
class Project
|
@@ -117,7 +117,7 @@ module Google
|
|
117
117
|
#
|
118
118
|
# bigtable = Google::Cloud::Bigtable.new
|
119
119
|
#
|
120
|
-
# instance = bigtable.instance
|
120
|
+
# instance = bigtable.instance "my-instance"
|
121
121
|
#
|
122
122
|
# if instance
|
123
123
|
# puts instance.instance_id
|
@@ -181,9 +181,9 @@ module Google
|
|
181
181
|
# "my-instance",
|
182
182
|
# display_name: "Instance for user data",
|
183
183
|
# type: :DEVELOPMENT,
|
184
|
-
# labels: { "env" => "dev"}
|
184
|
+
# labels: { "env" => "dev" }
|
185
185
|
# ) do |clusters|
|
186
|
-
# clusters.add
|
186
|
+
# clusters.add "test-cluster", "us-east1-b" # nodes not allowed
|
187
187
|
# end
|
188
188
|
#
|
189
189
|
# job.done? #=> false
|
@@ -206,9 +206,9 @@ module Google
|
|
206
206
|
# job = bigtable.create_instance(
|
207
207
|
# "my-instance",
|
208
208
|
# display_name: "Instance for user data",
|
209
|
-
# labels: { "env" => "dev"}
|
209
|
+
# labels: { "env" => "dev" }
|
210
210
|
# ) do |clusters|
|
211
|
-
# clusters.add
|
211
|
+
# clusters.add "test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD
|
212
212
|
# end
|
213
213
|
#
|
214
214
|
# job.done? #=> false
|
@@ -314,14 +314,14 @@ module Google
|
|
314
314
|
#
|
315
315
|
# bigtable = Google::Cloud::Bigtable.new
|
316
316
|
#
|
317
|
-
# table = bigtable.table
|
317
|
+
# table = bigtable.table "my-instance", "my-table"
|
318
318
|
#
|
319
319
|
# @example Retrieve a table with a schema-only view.
|
320
320
|
# require "google/cloud/bigtable"
|
321
321
|
#
|
322
322
|
# bigtable = Google::Cloud::Bigtable.new
|
323
323
|
#
|
324
|
-
# table = bigtable.table
|
324
|
+
# table = bigtable.table "my-instance", "my-table", perform_lookup: true
|
325
325
|
# if table
|
326
326
|
# puts table.name
|
327
327
|
# puts table.column_families
|
@@ -332,7 +332,7 @@ module Google
|
|
332
332
|
#
|
333
333
|
# bigtable = Google::Cloud::Bigtable.new
|
334
334
|
#
|
335
|
-
# table = bigtable.table
|
335
|
+
# table = bigtable.table "my-instance", "my-table", view: :FULL, perform_lookup: true
|
336
336
|
# if table
|
337
337
|
# puts table.name
|
338
338
|
# puts table.column_families
|
@@ -402,7 +402,7 @@ module Google
|
|
402
402
|
#
|
403
403
|
# bigtable = Google::Cloud::Bigtable.new
|
404
404
|
#
|
405
|
-
# table = bigtable.create_table
|
405
|
+
# table = bigtable.create_table "my-instance", "my-table"
|
406
406
|
# puts table.name
|
407
407
|
#
|
408
408
|
# @example Create a table with initial splits and column families.
|
@@ -411,15 +411,15 @@ module Google
|
|
411
411
|
# bigtable = Google::Cloud::Bigtable.new
|
412
412
|
#
|
413
413
|
# initial_splits = ["user-00001", "user-100000", "others"]
|
414
|
-
# table = bigtable.create_table
|
415
|
-
# cfm.add
|
416
|
-
# cfm.add
|
414
|
+
# table = bigtable.create_table "my-instance", "my-table", initial_splits: initial_splits do |cfm|
|
415
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
|
416
|
+
# cfm.add "cf2", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
|
417
417
|
#
|
418
418
|
# gc_rule = Google::Cloud::Bigtable::GcRule.union(
|
419
419
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
420
420
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
421
421
|
# )
|
422
|
-
# cfm.add
|
422
|
+
# cfm.add "cf3", gc_rule: gc_rule
|
423
423
|
# end
|
424
424
|
#
|
425
425
|
# puts table
|
@@ -450,7 +450,7 @@ module Google
|
|
450
450
|
#
|
451
451
|
# bigtable = Google::Cloud::Bigtable.new
|
452
452
|
#
|
453
|
-
# bigtable.delete_table
|
453
|
+
# bigtable.delete_table "my-instance", "my-table"
|
454
454
|
#
|
455
455
|
def delete_table instance_id, table_id
|
456
456
|
service.delete_table instance_id, table_id
|
@@ -50,7 +50,7 @@ module Google
|
|
50
50
|
# require "google/cloud/bigtable"
|
51
51
|
#
|
52
52
|
# bigtable = Google::Cloud::Bigtable.new
|
53
|
-
# table = bigtable.table
|
53
|
+
# table = bigtable.table "my-instance", "my-table"
|
54
54
|
#
|
55
55
|
# table.sample_row_keys.each do |sample_row_key|
|
56
56
|
# p sample_row_key.key # user00116
|
@@ -90,7 +90,7 @@ module Google
|
|
90
90
|
# require "google/cloud/bigtable"
|
91
91
|
#
|
92
92
|
# bigtable = Google::Cloud::Bigtable.new
|
93
|
-
# table = bigtable.table
|
93
|
+
# table = bigtable.table "my-instance", "my-table"
|
94
94
|
#
|
95
95
|
# table.read_rows(limit: 10).each do |row|
|
96
96
|
# puts row
|
@@ -100,7 +100,7 @@ module Google
|
|
100
100
|
# require "google/cloud/bigtable"
|
101
101
|
#
|
102
102
|
# bigtable = Google::Cloud::Bigtable.new
|
103
|
-
# table = bigtable.table
|
103
|
+
# table = bigtable.table "my-instance", "my-table"
|
104
104
|
#
|
105
105
|
# table.read_rows(keys: ["user-1", "user-2"]).each do |row|
|
106
106
|
# puts row
|
@@ -110,9 +110,9 @@ module Google
|
|
110
110
|
# require "google/cloud/bigtable"
|
111
111
|
#
|
112
112
|
# bigtable = Google::Cloud::Bigtable.new
|
113
|
-
# table = bigtable.table
|
113
|
+
# table = bigtable.table "my-instance", "my-table"
|
114
114
|
#
|
115
|
-
# range = table.new_row_range.between
|
115
|
+
# range = table.new_row_range.between "user-1", "user-100"
|
116
116
|
#
|
117
117
|
# table.read_rows(ranges: range).each do |row|
|
118
118
|
# puts row
|
@@ -122,11 +122,11 @@ module Google
|
|
122
122
|
# require "google/cloud/bigtable"
|
123
123
|
#
|
124
124
|
# bigtable = Google::Cloud::Bigtable.new
|
125
|
-
# table = bigtable.table
|
125
|
+
# table = bigtable.table "my-instance", "my-table"
|
126
126
|
#
|
127
|
-
# filter = table.filter.key
|
127
|
+
# filter = table.filter.key "user-*"
|
128
128
|
# # OR
|
129
|
-
# # filter = Google::Cloud::Bigtable::RowFilter.key
|
129
|
+
# # filter = Google::Cloud::Bigtable::RowFilter.key "user-*"
|
130
130
|
#
|
131
131
|
# table.read_rows(filter: filter).each do |row|
|
132
132
|
# puts row
|
@@ -136,11 +136,11 @@ module Google
|
|
136
136
|
# require "google/cloud/bigtable"
|
137
137
|
#
|
138
138
|
# bigtable = Google::Cloud::Bigtable.new
|
139
|
-
# table = bigtable.table
|
139
|
+
# table = bigtable.table "my-instance", "my-table"
|
140
140
|
#
|
141
|
-
# filter = table.filter.key
|
141
|
+
# filter = table.filter.key "user-*"
|
142
142
|
# # OR
|
143
|
-
# # filter = Google::Cloud::Bigtable::RowFilter.key
|
143
|
+
# # filter = Google::Cloud::Bigtable::RowFilter.key "user-*"
|
144
144
|
#
|
145
145
|
# table.read_rows(filter: filter, limit: 10).each do |row|
|
146
146
|
# puts row
|
@@ -176,19 +176,19 @@ module Google
|
|
176
176
|
# require "google/cloud/bigtable"
|
177
177
|
#
|
178
178
|
# bigtable = Google::Cloud::Bigtable.new
|
179
|
-
# table = bigtable.table
|
179
|
+
# table = bigtable.table "my-instance", "my-table"
|
180
180
|
#
|
181
|
-
# row = table.read_row
|
181
|
+
# row = table.read_row "user-1"
|
182
182
|
#
|
183
183
|
# @example Read row with filter.
|
184
184
|
# require "google/cloud/bigtable"
|
185
185
|
#
|
186
186
|
# bigtable = Google::Cloud::Bigtable.new
|
187
|
-
# table = bigtable.table
|
187
|
+
# table = bigtable.table "my-instance", "my-table"
|
188
188
|
#
|
189
|
-
# filter = Google::Cloud::Bigtable::RowFilter.cells_per_row
|
189
|
+
# filter = Google::Cloud::Bigtable::RowFilter.cells_per_row 3
|
190
190
|
#
|
191
|
-
# row = table.read_row
|
191
|
+
# row = table.read_row "user-1", filter: filter
|
192
192
|
#
|
193
193
|
def read_row key, filter: nil
|
194
194
|
read_rows(keys: [key], filter: filter).first
|
@@ -203,11 +203,11 @@ module Google
|
|
203
203
|
# require "google/cloud/bigtable"
|
204
204
|
#
|
205
205
|
# bigtable = Google::Cloud::Bigtable.new
|
206
|
-
# table = bigtable.table
|
206
|
+
# table = bigtable.table "my-instance", "my-table"
|
207
207
|
#
|
208
208
|
# range = table.new_value_range
|
209
|
-
# range.from
|
210
|
-
# range.to
|
209
|
+
# range.from "abc"
|
210
|
+
# range.to "xyz"
|
211
211
|
#
|
212
212
|
# # OR
|
213
213
|
# range = table.new_value_range.from("abc").to("xyz")
|
@@ -216,7 +216,7 @@ module Google
|
|
216
216
|
# require "google/cloud/bigtable"
|
217
217
|
#
|
218
218
|
# bigtable = Google::Cloud::Bigtable.new
|
219
|
-
# table = bigtable.table
|
219
|
+
# table = bigtable.table "my-instance", "my-table"
|
220
220
|
#
|
221
221
|
# range = table.new_value_range.from("abc", inclusive: false).to("xyz")
|
222
222
|
#
|
@@ -234,11 +234,11 @@ module Google
|
|
234
234
|
# require "google/cloud/bigtable"
|
235
235
|
#
|
236
236
|
# bigtable = Google::Cloud::Bigtable.new
|
237
|
-
# table = bigtable.table
|
237
|
+
# table = bigtable.table "my-instance", "my-table"
|
238
238
|
#
|
239
|
-
# range = table.new_column_range
|
240
|
-
# range.from
|
241
|
-
# range.to
|
239
|
+
# range = table.new_column_range "test-family"
|
240
|
+
# range.from "abc"
|
241
|
+
# range.to "xyz"
|
242
242
|
#
|
243
243
|
# # OR
|
244
244
|
# range = table.new_column_range("test-family").from("key-1").to("key-5")
|
@@ -247,7 +247,7 @@ module Google
|
|
247
247
|
# require "google/cloud/bigtable"
|
248
248
|
#
|
249
249
|
# bigtable = Google::Cloud::Bigtable.new
|
250
|
-
# table = bigtable.table
|
250
|
+
# table = bigtable.table "my-instance", "my-table"
|
251
251
|
#
|
252
252
|
# range = table.new_column_range("test-family").from("key-1", inclusive: false).to("key-5")
|
253
253
|
#
|
@@ -264,11 +264,11 @@ module Google
|
|
264
264
|
# require "google/cloud/bigtable"
|
265
265
|
#
|
266
266
|
# bigtable = Google::Cloud::Bigtable.new
|
267
|
-
# table = bigtable.table
|
267
|
+
# table = bigtable.table "my-instance", "my-table"
|
268
268
|
#
|
269
269
|
# range = table.new_row_range
|
270
|
-
# range.from
|
271
|
-
# range.to
|
270
|
+
# range.from "abc"
|
271
|
+
# range.to "xyz"
|
272
272
|
#
|
273
273
|
# # OR
|
274
274
|
# range = table.new_row_range.from("key-1").to("key-5")
|
@@ -277,7 +277,7 @@ module Google
|
|
277
277
|
# require "google/cloud/bigtable"
|
278
278
|
#
|
279
279
|
# bigtable = Google::Cloud::Bigtable.new
|
280
|
-
# table = bigtable.table
|
280
|
+
# table = bigtable.table "my-instance", "my-table"
|
281
281
|
#
|
282
282
|
# range = table.new_row_range.from("key-1", inclusive: false).to("key-5")
|
283
283
|
#
|
@@ -294,9 +294,9 @@ module Google
|
|
294
294
|
# require "google/cloud/bigtable"
|
295
295
|
#
|
296
296
|
# bigtable = Google::Cloud::Bigtable.new
|
297
|
-
# table = bigtable.table
|
297
|
+
# table = bigtable.table "my-instance", "my-table"
|
298
298
|
#
|
299
|
-
# filter = table.filter.key
|
299
|
+
# filter = table.filter.key "user-*"
|
300
300
|
#
|
301
301
|
def filter
|
302
302
|
Google::Cloud::Bigtable::RowFilter
|