google-cloud-bigtable 2.6.1 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +328 -115
- data/OVERVIEW.md +1 -1
- 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/app_profile.rb +20 -21
- 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/backup.rb +36 -36
- data/lib/google/cloud/bigtable/cluster/job.rb +2 -2
- data/lib/google/cloud/bigtable/cluster.rb +15 -15
- 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 +4 -4
- data/lib/google/cloud/bigtable/gc_rule.rb +20 -20
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +6 -6
- data/lib/google/cloud/bigtable/instance/job.rb +4 -4
- data/lib/google/cloud/bigtable/instance.rb +40 -40
- 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/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_filter.rb +28 -28
- 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/status.rb +2 -2
- data/lib/google/cloud/bigtable/table/cluster_state.rb +1 -1
- 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/table.rb +34 -34
- data/lib/google/cloud/bigtable/value_range.rb +18 -18
- data/lib/google/cloud/bigtable/version.rb +1 -1
- data/lib/google/cloud/bigtable.rb +2 -0
- metadata +3 -3
@@ -49,15 +49,15 @@ module Google
|
|
49
49
|
#
|
50
50
|
# bigtable = Google::Cloud::Bigtable.new
|
51
51
|
#
|
52
|
-
# table = bigtable.create_table
|
53
|
-
# cfm.add
|
54
|
-
# cfm.add
|
52
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
53
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
|
54
|
+
# cfm.add "cf2", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
|
55
55
|
#
|
56
56
|
# gc_rule = Google::Cloud::Bigtable::GcRule.union(
|
57
57
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
58
58
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
59
59
|
# )
|
60
|
-
# cfm.add
|
60
|
+
# cfm.add "cf3", gc_rule: gc_rule
|
61
61
|
# end
|
62
62
|
#
|
63
63
|
# puts table.column_families["cf1"].gc_rule.max_versions
|
@@ -95,8 +95,8 @@ module Google
|
|
95
95
|
#
|
96
96
|
# bigtable = Google::Cloud::Bigtable.new
|
97
97
|
#
|
98
|
-
# table = bigtable.create_table
|
99
|
-
# cfm.add
|
98
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
99
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
|
100
100
|
# end
|
101
101
|
#
|
102
102
|
# puts table.column_families["cf1"].gc_rule.max_versions
|
@@ -131,8 +131,8 @@ module Google
|
|
131
131
|
#
|
132
132
|
# bigtable = Google::Cloud::Bigtable.new
|
133
133
|
#
|
134
|
-
# table = bigtable.create_table
|
135
|
-
# cfm.add
|
134
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
135
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
|
136
136
|
# end
|
137
137
|
#
|
138
138
|
# puts table.column_families["cf1"].gc_rule.max_age
|
@@ -162,12 +162,12 @@ module Google
|
|
162
162
|
#
|
163
163
|
# bigtable = Google::Cloud::Bigtable.new
|
164
164
|
#
|
165
|
-
# table = bigtable.create_table
|
165
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
166
166
|
# gc_rule = Google::Cloud::Bigtable::GcRule.intersection(
|
167
167
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
168
168
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
169
169
|
# )
|
170
|
-
# cfm.add
|
170
|
+
# cfm.add "cf1", gc_rule: gc_rule
|
171
171
|
# end
|
172
172
|
#
|
173
173
|
# puts table.column_families["cf1"].gc_rule.intersection
|
@@ -203,12 +203,12 @@ module Google
|
|
203
203
|
#
|
204
204
|
# bigtable = Google::Cloud::Bigtable.new
|
205
205
|
#
|
206
|
-
# table = bigtable.create_table
|
206
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
207
207
|
# gc_rule = Google::Cloud::Bigtable::GcRule.union(
|
208
208
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
209
209
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
210
210
|
# )
|
211
|
-
# cfm.add
|
211
|
+
# cfm.add "cf1", gc_rule: gc_rule
|
212
212
|
# end
|
213
213
|
#
|
214
214
|
# puts table.column_families["cf1"].gc_rule.union
|
@@ -231,8 +231,8 @@ module Google
|
|
231
231
|
#
|
232
232
|
# bigtable = Google::Cloud::Bigtable.new
|
233
233
|
#
|
234
|
-
# table = bigtable.create_table
|
235
|
-
# cfm.add
|
234
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
235
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
|
236
236
|
# end
|
237
237
|
#
|
238
238
|
def self.max_versions versions
|
@@ -252,8 +252,8 @@ module Google
|
|
252
252
|
#
|
253
253
|
# bigtable = Google::Cloud::Bigtable.new
|
254
254
|
#
|
255
|
-
# table = bigtable.create_table
|
256
|
-
# cfm.add
|
255
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
256
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
|
257
257
|
# end
|
258
258
|
#
|
259
259
|
def self.max_age age
|
@@ -274,12 +274,12 @@ module Google
|
|
274
274
|
#
|
275
275
|
# bigtable = Google::Cloud::Bigtable.new
|
276
276
|
#
|
277
|
-
# table = bigtable.create_table
|
277
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
278
278
|
# gc_rule = Google::Cloud::Bigtable::GcRule.union(
|
279
279
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
280
280
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
281
281
|
# )
|
282
|
-
# cfm.add
|
282
|
+
# cfm.add "cf1", gc_rule: gc_rule
|
283
283
|
# end
|
284
284
|
#
|
285
285
|
def self.union *rules
|
@@ -300,12 +300,12 @@ module Google
|
|
300
300
|
#
|
301
301
|
# bigtable = Google::Cloud::Bigtable.new
|
302
302
|
#
|
303
|
-
# table = bigtable.create_table
|
303
|
+
# table = bigtable.create_table "my-instance", "my-table" do |cfm|
|
304
304
|
# gc_rule = Google::Cloud::Bigtable::GcRule.intersection(
|
305
305
|
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
306
306
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
307
307
|
# )
|
308
|
-
# cfm.add
|
308
|
+
# cfm.add "cf1", gc_rule: gc_rule
|
309
309
|
# end
|
310
310
|
#
|
311
311
|
def self.intersection *rules
|
@@ -30,8 +30,8 @@ module Google
|
|
30
30
|
#
|
31
31
|
# bigtable = Google::Cloud::Bigtable.new
|
32
32
|
#
|
33
|
-
# job = bigtable.create_instance
|
34
|
-
# clusters.add
|
33
|
+
# job = bigtable.create_instance "my-instance" do |clusters|
|
34
|
+
# clusters.add "test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD
|
35
35
|
# end
|
36
36
|
#
|
37
37
|
# job.wait_until_done!
|
@@ -74,8 +74,8 @@ module Google
|
|
74
74
|
#
|
75
75
|
# bigtable = Google::Cloud::Bigtable.new
|
76
76
|
#
|
77
|
-
# job = bigtable.create_instance
|
78
|
-
# clusters.add
|
77
|
+
# job = bigtable.create_instance "my-instance" do |clusters|
|
78
|
+
# clusters.add "test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD
|
79
79
|
# end
|
80
80
|
#
|
81
81
|
# job.wait_until_done!
|
@@ -86,8 +86,8 @@ module Google
|
|
86
86
|
# bigtable = Google::Cloud::Bigtable.new
|
87
87
|
#
|
88
88
|
# kms_key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
|
89
|
-
# job = bigtable.create_instance
|
90
|
-
# clusters.add
|
89
|
+
# job = bigtable.create_instance "my-instance" do |clusters|
|
90
|
+
# clusters.add "test-cluster", "us-east1-b", kms_key: kms_key_name
|
91
91
|
# end
|
92
92
|
#
|
93
93
|
# job.wait_until_done!
|
@@ -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
|
@@ -44,9 +44,9 @@ module Google
|
|
44
44
|
# "my-instance",
|
45
45
|
# display_name: "Instance for user data",
|
46
46
|
# type: :DEVELOPMENT,
|
47
|
-
# labels: { "env" => "dev"}
|
47
|
+
# labels: { "env" => "dev" }
|
48
48
|
# ) do |clusters|
|
49
|
-
# clusters.add
|
49
|
+
# clusters.add "test-cluster", "us-east1-b" # nodes not allowed
|
50
50
|
# end
|
51
51
|
#
|
52
52
|
# job.done? #=> false
|
@@ -203,7 +203,7 @@ module Google
|
|
203
203
|
#
|
204
204
|
# bigtable = Google::Cloud::Bigtable.new
|
205
205
|
#
|
206
|
-
# instance = bigtable.instance
|
206
|
+
# instance = bigtable.instance "my-instance"
|
207
207
|
#
|
208
208
|
# instance.development? # true
|
209
209
|
# instance.type = :PRODUCTION
|
@@ -267,7 +267,7 @@ module Google
|
|
267
267
|
#
|
268
268
|
# bigtable = Google::Cloud::Bigtable.new
|
269
269
|
#
|
270
|
-
# instance = bigtable.instance
|
270
|
+
# instance = bigtable.instance "my-instance"
|
271
271
|
# instance.display_name = "My app dev instance" # Set display name
|
272
272
|
# instance.labels = { env: "dev", data: "users" }
|
273
273
|
# job = instance.save
|
@@ -314,7 +314,7 @@ module Google
|
|
314
314
|
#
|
315
315
|
# bigtable = Google::Cloud::Bigtable.new
|
316
316
|
#
|
317
|
-
# instance = bigtable.instance
|
317
|
+
# instance = bigtable.instance "my-instance"
|
318
318
|
# instance.delete
|
319
319
|
#
|
320
320
|
def delete
|
@@ -340,7 +340,7 @@ module Google
|
|
340
340
|
#
|
341
341
|
# bigtable = Google::Cloud::Bigtable.new
|
342
342
|
#
|
343
|
-
# instance = bigtable.instance
|
343
|
+
# instance = bigtable.instance "my-instance"
|
344
344
|
#
|
345
345
|
# instance.clusters.all do |cluster|
|
346
346
|
# puts cluster.cluster_id
|
@@ -366,9 +366,9 @@ module Google
|
|
366
366
|
#
|
367
367
|
# bigtable = Google::Cloud::Bigtable.new
|
368
368
|
#
|
369
|
-
# instance = bigtable.instance
|
369
|
+
# instance = bigtable.instance "my-instance"
|
370
370
|
#
|
371
|
-
# cluster = instance.cluster
|
371
|
+
# cluster = instance.cluster "my-cluster"
|
372
372
|
# puts cluster.cluster_id
|
373
373
|
#
|
374
374
|
def cluster cluster_id
|
@@ -403,7 +403,7 @@ module Google
|
|
403
403
|
#
|
404
404
|
# bigtable = Google::Cloud::Bigtable.new
|
405
405
|
#
|
406
|
-
# instance = bigtable.instance
|
406
|
+
# instance = bigtable.instance "my-instance"
|
407
407
|
# job = instance.create_cluster(
|
408
408
|
# "my-new-cluster",
|
409
409
|
# "us-east-1b",
|
@@ -450,7 +450,7 @@ module Google
|
|
450
450
|
#
|
451
451
|
# bigtable = Google::Cloud::Bigtable.new
|
452
452
|
#
|
453
|
-
# instance = bigtable.instance
|
453
|
+
# instance = bigtable.instance "my-instance"
|
454
454
|
#
|
455
455
|
# # Default name-only view
|
456
456
|
# instance.tables.all do |table|
|
@@ -490,14 +490,14 @@ module Google
|
|
490
490
|
#
|
491
491
|
# bigtable = Google::Cloud::Bigtable.new
|
492
492
|
#
|
493
|
-
# instance = bigtable.instance
|
493
|
+
# instance = bigtable.instance "my-instance"
|
494
494
|
#
|
495
|
-
# table = instance.table
|
495
|
+
# table = instance.table "my-table", perform_lookup: true
|
496
496
|
# puts table.name
|
497
497
|
# puts table.column_families
|
498
498
|
#
|
499
499
|
# # Name-only view
|
500
|
-
# table = instance.table
|
500
|
+
# table = instance.table "my-table", view: :NAME_ONLY, perform_lookup: true
|
501
501
|
# puts table.name
|
502
502
|
#
|
503
503
|
# @example Mutate rows.
|
@@ -505,17 +505,17 @@ module Google
|
|
505
505
|
#
|
506
506
|
# bigtable = Google::Cloud::Bigtable.new
|
507
507
|
#
|
508
|
-
# table = bigtable.table
|
508
|
+
# table = bigtable.table "my-instance", "my-table"
|
509
509
|
#
|
510
|
-
# entry = table.new_mutation_entry
|
510
|
+
# entry = table.new_mutation_entry "user-1"
|
511
511
|
# entry.set_cell(
|
512
512
|
# "cf1",
|
513
513
|
# "field1",
|
514
514
|
# "XYZ",
|
515
|
-
# timestamp: (Time.now.to_f *
|
516
|
-
# ).delete_cells
|
515
|
+
# timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
|
516
|
+
# ).delete_cells "cf2", "field02"
|
517
517
|
#
|
518
|
-
# table.mutate_row
|
518
|
+
# table.mutate_row entry
|
519
519
|
#
|
520
520
|
def table table_id, view: nil, perform_lookup: nil, app_profile_id: nil
|
521
521
|
ensure_service!
|
@@ -581,9 +581,9 @@ module Google
|
|
581
581
|
#
|
582
582
|
# bigtable = Google::Cloud::Bigtable.new
|
583
583
|
#
|
584
|
-
# instance = bigtable.instance
|
584
|
+
# instance = bigtable.instance "my-instance"
|
585
585
|
#
|
586
|
-
# table = instance.create_table
|
586
|
+
# table = instance.create_table "my-table"
|
587
587
|
# puts table.name
|
588
588
|
#
|
589
589
|
# @example Create a table with initial splits and column families.
|
@@ -591,18 +591,18 @@ module Google
|
|
591
591
|
#
|
592
592
|
# bigtable = Google::Cloud::Bigtable.new
|
593
593
|
#
|
594
|
-
# instance = bigtable.instance
|
594
|
+
# instance = bigtable.instance "my-instance"
|
595
595
|
#
|
596
596
|
# initial_splits = ["user-00001", "user-100000", "others"]
|
597
|
-
# table = instance.create_table
|
598
|
-
# cfm.add
|
599
|
-
# cfm.add
|
597
|
+
# table = instance.create_table "my-table", initial_splits: initial_splits do |cfm|
|
598
|
+
# cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
|
599
|
+
# cfm.add "cf2", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
|
600
600
|
#
|
601
601
|
# gc_rule = Google::Cloud::Bigtable::GcRule.union(
|
602
|
-
#
|
602
|
+
# Google::Cloud::Bigtable::GcRule.max_age(1800),
|
603
603
|
# Google::Cloud::Bigtable::GcRule.max_versions(3)
|
604
604
|
# )
|
605
|
-
# cfm.add
|
605
|
+
# cfm.add "cf3", gc_rule: gc_rule
|
606
606
|
# end
|
607
607
|
#
|
608
608
|
# puts table
|
@@ -660,10 +660,10 @@ module Google
|
|
660
660
|
#
|
661
661
|
# bigtable = Google::Cloud::Bigtable.new
|
662
662
|
#
|
663
|
-
# instance = bigtable.instance
|
663
|
+
# instance = bigtable.instance "my-instance"
|
664
664
|
#
|
665
665
|
# routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
|
666
|
-
# "my-
|
666
|
+
# "my-cluster",
|
667
667
|
# allow_transactional_writes: true
|
668
668
|
# )
|
669
669
|
#
|
@@ -679,7 +679,7 @@ module Google
|
|
679
679
|
#
|
680
680
|
# bigtable = Google::Cloud::Bigtable.new
|
681
681
|
#
|
682
|
-
# instance = bigtable.instance
|
682
|
+
# instance = bigtable.instance "my-instance"
|
683
683
|
#
|
684
684
|
# routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
|
685
685
|
#
|
@@ -695,7 +695,7 @@ module Google
|
|
695
695
|
#
|
696
696
|
# bigtable = Google::Cloud::Bigtable.new
|
697
697
|
#
|
698
|
-
# instance = bigtable.instance
|
698
|
+
# instance = bigtable.instance "my-instance"
|
699
699
|
#
|
700
700
|
# routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
|
701
701
|
#
|
@@ -746,9 +746,9 @@ module Google
|
|
746
746
|
#
|
747
747
|
# bigtable = Google::Cloud::Bigtable.new
|
748
748
|
#
|
749
|
-
# instance = bigtable.instance
|
749
|
+
# instance = bigtable.instance "my-instance"
|
750
750
|
#
|
751
|
-
# app_profile = instance.app_profile
|
751
|
+
# app_profile = instance.app_profile "my-app-profile"
|
752
752
|
#
|
753
753
|
# if app_profile
|
754
754
|
# puts app_profile.name
|
@@ -776,7 +776,7 @@ module Google
|
|
776
776
|
#
|
777
777
|
# bigtable = Google::Cloud::Bigtable.new
|
778
778
|
#
|
779
|
-
# instance = bigtable.instance
|
779
|
+
# instance = bigtable.instance "my-instance"
|
780
780
|
#
|
781
781
|
# instance.app_profiles.all do |app_profile|
|
782
782
|
# puts app_profile.name
|
@@ -808,17 +808,17 @@ module Google
|
|
808
808
|
#
|
809
809
|
# bigtable = Google::Cloud::Bigtable.new
|
810
810
|
#
|
811
|
-
# instance = bigtable.instance
|
811
|
+
# instance = bigtable.instance "my-instance"
|
812
812
|
# policy = instance.policy
|
813
813
|
#
|
814
814
|
# @example Update the policy by passing a block.
|
815
815
|
# require "google/cloud/bigtable"
|
816
816
|
#
|
817
817
|
# bigtable = Google::Cloud::Bigtable.new
|
818
|
-
# instance = bigtable.instance
|
818
|
+
# instance = bigtable.instance "my-instance"
|
819
819
|
#
|
820
820
|
# instance.policy do |p|
|
821
|
-
# p.add
|
821
|
+
# p.add "roles/owner", "user:owner@example.com"
|
822
822
|
# end # 2 API calls
|
823
823
|
#
|
824
824
|
def policy
|
@@ -849,11 +849,11 @@ module Google
|
|
849
849
|
#
|
850
850
|
# bigtable = Google::Cloud::Bigtable.new
|
851
851
|
#
|
852
|
-
# instance = bigtable.instance
|
852
|
+
# instance = bigtable.instance "my-instance"
|
853
853
|
#
|
854
854
|
# policy = instance.policy
|
855
|
-
# policy.add
|
856
|
-
# updated_policy = instance.update_policy
|
855
|
+
# policy.add "roles/owner", "user:owner@example.com"
|
856
|
+
# updated_policy = instance.update_policy policy
|
857
857
|
#
|
858
858
|
# puts updated_policy.roles
|
859
859
|
#
|
@@ -892,7 +892,7 @@ module Google
|
|
892
892
|
#
|
893
893
|
# bigtable = Google::Cloud::Bigtable.new
|
894
894
|
#
|
895
|
-
# instance = bigtable.instance
|
895
|
+
# instance = bigtable.instance "my-instance"
|
896
896
|
#
|
897
897
|
# permissions = instance.test_iam_permissions(
|
898
898
|
# "bigtable.instances.get",
|
@@ -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
|