google-cloud-bigtable 2.6.0 → 2.10.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +10 -27
  3. data/CHANGELOG.md +72 -0
  4. data/CONTRIBUTING.md +328 -115
  5. data/EMULATOR.md +1 -1
  6. data/LOGGING.md +1 -1
  7. data/OVERVIEW.md +1 -1
  8. data/lib/google/cloud/bigtable/app_profile/job.rb +4 -4
  9. data/lib/google/cloud/bigtable/app_profile/list.rb +5 -7
  10. data/lib/google/cloud/bigtable/app_profile.rb +20 -21
  11. data/lib/google/cloud/bigtable/backup/job.rb +8 -8
  12. data/lib/google/cloud/bigtable/backup/list.rb +9 -11
  13. data/lib/google/cloud/bigtable/backup.rb +103 -36
  14. data/lib/google/cloud/bigtable/chunk_processor.rb +5 -5
  15. data/lib/google/cloud/bigtable/cluster/job.rb +2 -2
  16. data/lib/google/cloud/bigtable/cluster.rb +15 -15
  17. data/lib/google/cloud/bigtable/column_family.rb +2 -2
  18. data/lib/google/cloud/bigtable/column_family_map.rb +18 -21
  19. data/lib/google/cloud/bigtable/column_range.rb +7 -7
  20. data/lib/google/cloud/bigtable/convert.rb +34 -0
  21. data/lib/google/cloud/bigtable/encryption_info.rb +4 -4
  22. data/lib/google/cloud/bigtable/gc_rule.rb +20 -20
  23. data/lib/google/cloud/bigtable/instance/cluster_map.rb +7 -7
  24. data/lib/google/cloud/bigtable/instance/job.rb +4 -4
  25. data/lib/google/cloud/bigtable/instance.rb +49 -52
  26. data/lib/google/cloud/bigtable/mutation_entry.rb +21 -21
  27. data/lib/google/cloud/bigtable/mutation_operations.rb +34 -34
  28. data/lib/google/cloud/bigtable/policy.rb +4 -4
  29. data/lib/google/cloud/bigtable/project.rb +84 -26
  30. data/lib/google/cloud/bigtable/read_operations.rb +40 -33
  31. data/lib/google/cloud/bigtable/routing_policy.rb +6 -6
  32. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +30 -29
  33. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +6 -6
  34. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +27 -26
  35. data/lib/google/cloud/bigtable/row_filter.rb +28 -28
  36. data/lib/google/cloud/bigtable/row_range.rb +18 -18
  37. data/lib/google/cloud/bigtable/rows_reader.rb +77 -32
  38. data/lib/google/cloud/bigtable/sample_row_key.rb +1 -1
  39. data/lib/google/cloud/bigtable/service.rb +69 -29
  40. data/lib/google/cloud/bigtable/status.rb +2 -2
  41. data/lib/google/cloud/bigtable/table/cluster_state.rb +1 -1
  42. data/lib/google/cloud/bigtable/table/list.rb +2 -2
  43. data/lib/google/cloud/bigtable/table/restore_job.rb +12 -12
  44. data/lib/google/cloud/bigtable/table.rb +42 -40
  45. data/lib/google/cloud/bigtable/value_range.rb +18 -18
  46. data/lib/google/cloud/bigtable/version.rb +1 -1
  47. data/lib/google/cloud/bigtable.rb +28 -7
  48. data/lib/google-cloud-bigtable.rb +6 -2
  49. metadata +15 -113
@@ -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("test-cluster", "us-east1-b") # nodes not allowed
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("my-instance")
206
+ # instance = bigtable.instance "my-instance"
207
207
  #
208
208
  # instance.development? # true
209
209
  # instance.type = :PRODUCTION
@@ -245,7 +245,7 @@ module Google
245
245
  labels ||= {}
246
246
  @grpc.labels = Google::Protobuf::Map.new(
247
247
  :string, :string,
248
- Hash[labels.map { |k, v| [String(k), String(v)] }]
248
+ labels.to_h { |k, v| [String(k), String(v)] }
249
249
  )
250
250
  end
251
251
 
@@ -267,7 +267,7 @@ module Google
267
267
  #
268
268
  # bigtable = Google::Cloud::Bigtable.new
269
269
  #
270
- # instance = bigtable.instance("my-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("my-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("my-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("my-instance")
369
+ # instance = bigtable.instance "my-instance"
370
370
  #
371
- # cluster = instance.cluster("my-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("my-instance")
406
+ # instance = bigtable.instance "my-instance"
407
407
  # job = instance.create_cluster(
408
408
  # "my-new-cluster",
409
409
  # "us-east-1b",
@@ -429,7 +429,7 @@ module Google
429
429
  serve_nodes: nodes,
430
430
  default_storage_type: storage_type,
431
431
  location: location
432
- }.delete_if { |_, v| v.nil? }
432
+ }.compact
433
433
 
434
434
  cluster = Google::Cloud::Bigtable::Admin::V2::Cluster.new attrs
435
435
  grpc = service.create_cluster instance_id, cluster_id, cluster
@@ -450,7 +450,7 @@ module Google
450
450
  #
451
451
  # bigtable = Google::Cloud::Bigtable.new
452
452
  #
453
- # instance = bigtable.instance("my-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("my-instance")
493
+ # instance = bigtable.instance "my-instance"
494
494
  #
495
- # table = instance.table("my-table", perform_lookup: true)
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("my-table", view: :NAME_ONLY, perform_lookup: true)
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,31 +505,28 @@ module Google
505
505
  #
506
506
  # bigtable = Google::Cloud::Bigtable.new
507
507
  #
508
- # table = bigtable.table("my-instance", "my-table")
508
+ # table = bigtable.table "my-instance", "my-table"
509
509
  #
510
- # entry = table.new_mutation_entry("user-1")
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 * 1000000).round(-3) # microseconds
516
- # ).delete_cells("cf2", "field02")
515
+ # timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
516
+ # ).delete_cells "cf2", "field02"
517
517
  #
518
- # table.mutate_row(entry)
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!
522
522
 
523
523
  view ||= :SCHEMA_VIEW
524
- table = if perform_lookup
525
- grpc = service.get_table instance_id, table_id, view: view
526
- Table.from_grpc grpc, service, view: view
527
- else
528
- Table.from_path service.table_path(instance_id, table_id), service
529
- end
530
-
531
- table.app_profile_id = app_profile_id
532
- table
524
+ if perform_lookup
525
+ grpc = service.get_table instance_id, table_id, view: view
526
+ Table.from_grpc grpc, service, view: view, app_profile_id: app_profile_id
527
+ else
528
+ Table.from_path service.table_path(instance_id, table_id), service, app_profile_id: app_profile_id
529
+ end
533
530
  rescue Google::Cloud::NotFoundError
534
531
  nil
535
532
  end
@@ -581,9 +578,9 @@ module Google
581
578
  #
582
579
  # bigtable = Google::Cloud::Bigtable.new
583
580
  #
584
- # instance = bigtable.instance("my-instance")
581
+ # instance = bigtable.instance "my-instance"
585
582
  #
586
- # table = instance.create_table("my-table")
583
+ # table = instance.create_table "my-table"
587
584
  # puts table.name
588
585
  #
589
586
  # @example Create a table with initial splits and column families.
@@ -591,18 +588,18 @@ module Google
591
588
  #
592
589
  # bigtable = Google::Cloud::Bigtable.new
593
590
  #
594
- # instance = bigtable.instance("my-instance")
591
+ # instance = bigtable.instance "my-instance"
595
592
  #
596
593
  # initial_splits = ["user-00001", "user-100000", "others"]
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))
594
+ # table = instance.create_table "my-table", initial_splits: initial_splits do |cfm|
595
+ # cfm.add "cf1", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
596
+ # cfm.add "cf2", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
600
597
  #
601
598
  # gc_rule = Google::Cloud::Bigtable::GcRule.union(
602
- # Google::Cloud::Bigtable::GcRule.max_age(1800),
599
+ # Google::Cloud::Bigtable::GcRule.max_age(1800),
603
600
  # Google::Cloud::Bigtable::GcRule.max_versions(3)
604
601
  # )
605
- # cfm.add('cf3', gc_rule: gc_rule)
602
+ # cfm.add "cf3", gc_rule: gc_rule
606
603
  # end
607
604
  #
608
605
  # puts table
@@ -660,10 +657,10 @@ module Google
660
657
  #
661
658
  # bigtable = Google::Cloud::Bigtable.new
662
659
  #
663
- # instance = bigtable.instance("my-instance")
660
+ # instance = bigtable.instance "my-instance"
664
661
  #
665
662
  # routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
666
- # "my-instance-cluster-1",
663
+ # "my-cluster",
667
664
  # allow_transactional_writes: true
668
665
  # )
669
666
  #
@@ -679,7 +676,7 @@ module Google
679
676
  #
680
677
  # bigtable = Google::Cloud::Bigtable.new
681
678
  #
682
- # instance = bigtable.instance("my-instance")
679
+ # instance = bigtable.instance "my-instance"
683
680
  #
684
681
  # routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
685
682
  #
@@ -695,7 +692,7 @@ module Google
695
692
  #
696
693
  # bigtable = Google::Cloud::Bigtable.new
697
694
  #
698
- # instance = bigtable.instance("my-instance")
695
+ # instance = bigtable.instance "my-instance"
699
696
  #
700
697
  # routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
701
698
  #
@@ -721,7 +718,7 @@ module Google
721
718
  single_cluster_routing: single_cluster_routing,
722
719
  description: description,
723
720
  etag: etag
724
- }.delete_if { |_, v| v.nil? }
721
+ }.compact
725
722
 
726
723
  grpc = service.create_app_profile(
727
724
  instance_id,
@@ -746,9 +743,9 @@ module Google
746
743
  #
747
744
  # bigtable = Google::Cloud::Bigtable.new
748
745
  #
749
- # instance = bigtable.instance("my-instance")
746
+ # instance = bigtable.instance "my-instance"
750
747
  #
751
- # app_profile = instance.app_profile("my-app-profile")
748
+ # app_profile = instance.app_profile "my-app-profile"
752
749
  #
753
750
  # if app_profile
754
751
  # puts app_profile.name
@@ -776,7 +773,7 @@ module Google
776
773
  #
777
774
  # bigtable = Google::Cloud::Bigtable.new
778
775
  #
779
- # instance = bigtable.instance("my-instance")
776
+ # instance = bigtable.instance "my-instance"
780
777
  #
781
778
  # instance.app_profiles.all do |app_profile|
782
779
  # puts app_profile.name
@@ -808,17 +805,17 @@ module Google
808
805
  #
809
806
  # bigtable = Google::Cloud::Bigtable.new
810
807
  #
811
- # instance = bigtable.instance("my-instance")
808
+ # instance = bigtable.instance "my-instance"
812
809
  # policy = instance.policy
813
810
  #
814
811
  # @example Update the policy by passing a block.
815
812
  # require "google/cloud/bigtable"
816
813
  #
817
814
  # bigtable = Google::Cloud::Bigtable.new
818
- # instance = bigtable.instance("my-instance")
815
+ # instance = bigtable.instance "my-instance"
819
816
  #
820
817
  # instance.policy do |p|
821
- # p.add("roles/owner", "user:owner@example.com")
818
+ # p.add "roles/owner", "user:owner@example.com"
822
819
  # end # 2 API calls
823
820
  #
824
821
  def policy
@@ -849,11 +846,11 @@ module Google
849
846
  #
850
847
  # bigtable = Google::Cloud::Bigtable.new
851
848
  #
852
- # instance = bigtable.instance("my-instance")
849
+ # instance = bigtable.instance "my-instance"
853
850
  #
854
851
  # policy = instance.policy
855
- # policy.add("roles/owner", "user:owner@example.com")
856
- # updated_policy = instance.update_policy(policy)
852
+ # policy.add "roles/owner", "user:owner@example.com"
853
+ # updated_policy = instance.update_policy policy
857
854
  #
858
855
  # puts updated_policy.roles
859
856
  #
@@ -892,7 +889,7 @@ module Google
892
889
  #
893
890
  # bigtable = Google::Cloud::Bigtable.new
894
891
  #
895
- # instance = bigtable.instance("my-instance")
892
+ # instance = bigtable.instance "my-instance"
896
893
  #
897
894
  # permissions = instance.test_iam_permissions(
898
895
  # "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("user-1")
37
- # timestamp_micros = (Time.now.to_f * 1000000).round(-3)
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 - 5000000,
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("my-instance", "my-table")
51
+ # table = bigtable.table "my-instance", "my-table"
52
52
  #
53
- # entry = table.new_mutation_entry("user-1")
54
- # timestamp_micros = (Time.now.to_f * 1000000).round(-3)
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("user-1")
105
- # entry.set_cell("cf1", "field01", "XYZ")
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("user-1")
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 * 1000000).round(-3) # microseconds
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("user-1")
162
- # entry.delete_cells("cf1", "field1")
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("user-1")
166
- # timestamp_micros = (Time.now.to_f * 1000000).round(-3)
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 - 5000000,
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("user-1")
175
- # timestamp_micros = (Time.now.to_f * 1000000).round(-3)
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 - 5000000
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("user-1")
207
- # entry.delete_from_family("cf1")
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("user-1")
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("my-instance", "my-table")
53
+ # table = bigtable.table "my-instance", "my-table"
54
54
  #
55
- # entry = table.new_mutation_entry("user-1")
56
- # entry.set_cell("cf1", "field1", "XYZ")
57
- # table.mutate_row(entry)
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("my-instance", "my-table")
64
+ # table = bigtable.table "my-instance", "my-table"
65
65
  #
66
- # entry = table.new_mutation_entry("user-1")
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 * 1000000).round(-3) # microseconds
72
- # ).delete_cells("cf2", "field02")
71
+ # timestamp: (Time.now.to_f * 1_000_000).round(-3) # microseconds
72
+ # ).delete_cells "cf2", "field02"
73
73
  #
74
- # table.mutate_row(entry)
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("my-instance", "my-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(entries)
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("my-instance", "my-table")
134
+ # table = bigtable.table "my-instance", "my-table"
135
135
  #
136
- # rule_1 = table.new_read_modify_write_rule("cf", "field01")
137
- # rule_1.append("append-xyz")
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("cf", "field01")
140
- # rule_2.increment(1)
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("user01", [rule_1, rule_2])
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("my-instance", "my-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("user01", rule)
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("my-instance", "my-table")
217
+ # table = bigtable.table "my-instance", "my-table"
218
218
  #
219
- # predicate_filter = Google::Cloud::Bigtable::RowFilter.key("user-10")
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 * 1000000).round(-3) # microseconds
226
- # ).delete_cells("cf2", "field02")
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("cf3")
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("my-instance", "my-table")
267
+ # table = bigtable.table "my-instance", "my-table"
268
268
  #
269
- # entry = table.new_mutation_entry("row-key-1")
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("my-instance", "my-table")
293
- # rule = table.new_read_modify_write_rule("cf", "qualifier-1")
294
- # rule.append("append-xyz")
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("my-instance", "my-table")
301
- # rule = table.new_read_modify_write_rule("cf", "qualifier-1")
302
- # rule.increment(100)
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("my-instance", "my-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(entries)
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("roles/owner", "user:owner@example.com")
53
- # policy.add("roles/owner", "user:newowner@example.com")
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("roles/owner", "user:newowner@example.com")
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("roles/owner", "user:newowner@example.com")
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