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
@@ -20,6 +20,9 @@ require "google/cloud/bigtable/errors"
20
20
  require "google/cloud/bigtable/credentials"
21
21
  require "google/cloud/bigtable/v2"
22
22
  require "google/cloud/bigtable/admin/v2"
23
+ require "google/cloud/bigtable/convert"
24
+ require "gapic/lru_hash"
25
+ require "concurrent"
23
26
 
24
27
  module Google
25
28
  module Cloud
@@ -49,12 +52,17 @@ module Google
49
52
  # @param timeout [Integer]
50
53
  # The default timeout, in seconds, for calls made through this client.
51
54
  #
52
- def initialize project_id, credentials, host: nil, host_admin: nil, timeout: nil
55
+ def initialize project_id, credentials, host: nil, host_admin: nil, timeout: nil,
56
+ channel_selection: nil, channel_count: nil
53
57
  @project_id = project_id
54
58
  @credentials = credentials
55
59
  @host = host
56
60
  @host_admin = host_admin
57
61
  @timeout = timeout
62
+ @channel_selection = channel_selection
63
+ @channel_count = channel_count
64
+ @bigtable_clients = ::Gapic::LruHash.new 10
65
+ @mutex = Mutex.new
58
66
  end
59
67
 
60
68
  def instances
@@ -83,15 +91,15 @@ module Google
83
91
  end
84
92
  attr_accessor :mocked_tables
85
93
 
86
- def client
94
+ def client table_path, app_profile_id
87
95
  return mocked_client if mocked_client
88
- @client ||= V2::Bigtable::Client.new do |config|
89
- config.credentials = credentials if credentials
90
- config.timeout = timeout if timeout
91
- config.endpoint = host if host
92
- config.lib_name = "gccl"
93
- config.lib_version = Google::Cloud::Bigtable::VERSION
94
- config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
96
+ table_key = "#{table_path}_#{app_profile_id}"
97
+ @mutex.synchronize do
98
+ if @bigtable_clients.get(table_key).nil?
99
+ bigtable_client = create_bigtable_client table_path, app_profile_id
100
+ @bigtable_clients.put table_key, bigtable_client
101
+ end
102
+ @bigtable_clients.get table_key
95
103
  end
96
104
  end
97
105
  attr_accessor :mocked_client
@@ -282,12 +290,12 @@ module Google
282
290
  initial_splits = initial_splits.map { |key| { key: key } } if initial_splits
283
291
 
284
292
  tables.create_table(
285
- {
293
+ **{
286
294
  parent: instance_path(instance_id),
287
295
  table_id: table_id,
288
296
  table: table,
289
297
  initial_splits: initial_splits
290
- }.delete_if { |_, v| v.nil? }
298
+ }.compact
291
299
  )
292
300
  end
293
301
 
@@ -649,35 +657,37 @@ module Google
649
657
  end
650
658
 
651
659
  def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
652
- client.read_rows table_name: table_path(instance_id, table_id),
653
- rows: rows,
654
- filter: filter,
655
- rows_limit: rows_limit,
656
- app_profile_id: app_profile_id
660
+ client(table_path(instance_id, table_id), app_profile_id).read_rows(
661
+ table_name: table_path(instance_id, table_id),
662
+ rows: rows,
663
+ filter: filter,
664
+ rows_limit: rows_limit,
665
+ app_profile_id: app_profile_id
666
+ )
657
667
  end
658
668
 
659
669
  def sample_row_keys table_name, app_profile_id: nil
660
- client.sample_row_keys table_name: table_name, app_profile_id: app_profile_id
670
+ client(table_name, app_profile_id).sample_row_keys table_name: table_name, app_profile_id: app_profile_id
661
671
  end
662
672
 
663
673
  def mutate_row table_name, row_key, mutations, app_profile_id: nil
664
- client.mutate_row(
665
- {
674
+ client(table_name, app_profile_id).mutate_row(
675
+ **{
666
676
  table_name: table_name,
667
677
  app_profile_id: app_profile_id,
668
678
  row_key: row_key,
669
679
  mutations: mutations
670
- }.delete_if { |_, v| v.nil? }
680
+ }.compact
671
681
  )
672
682
  end
673
683
 
674
684
  def mutate_rows table_name, entries, app_profile_id: nil
675
- client.mutate_rows(
676
- {
685
+ client(table_name, app_profile_id).mutate_rows(
686
+ **{
677
687
  table_name: table_name,
678
688
  app_profile_id: app_profile_id,
679
689
  entries: entries
680
- }.delete_if { |_, v| v.nil? }
690
+ }.compact
681
691
  )
682
692
  end
683
693
 
@@ -687,26 +697,26 @@ module Google
687
697
  predicate_filter: nil,
688
698
  true_mutations: nil,
689
699
  false_mutations: nil
690
- client.check_and_mutate_row(
691
- {
700
+ client(table_name, app_profile_id).check_and_mutate_row(
701
+ **{
692
702
  table_name: table_name,
693
703
  app_profile_id: app_profile_id,
694
704
  row_key: row_key,
695
705
  predicate_filter: predicate_filter,
696
706
  true_mutations: true_mutations,
697
707
  false_mutations: false_mutations
698
- }.delete_if { |_, v| v.nil? }
708
+ }.compact
699
709
  )
700
710
  end
701
711
 
702
712
  def read_modify_write_row table_name, row_key, rules, app_profile_id: nil
703
- client.read_modify_write_row(
704
- {
713
+ client(table_name, app_profile_id).read_modify_write_row(
714
+ **{
705
715
  table_name: table_name,
706
716
  app_profile_id: app_profile_id,
707
717
  row_key: row_key,
708
718
  rules: rules
709
- }.delete_if { |_, v| v.nil? }
719
+ }.compact
710
720
  )
711
721
  end
712
722
 
@@ -721,6 +731,19 @@ module Google
721
731
  tables.create_backup parent: cluster_path(instance_id, cluster_id), backup_id: backup_id, backup: backup
722
732
  end
723
733
 
734
+ ##
735
+ # Starts copying the selected backup to the chosen location.
736
+ # The underlying Google::Longrunning::Operation tracks the copying of backup.
737
+ #
738
+ # @return [Gapic::Operation]
739
+ #
740
+ def copy_backup project_id:, instance_id:, cluster_id:, backup_id:, source_backup:, expire_time:
741
+ tables.copy_backup parent: "projects/#{project_id}/instances/#{instance_id}/clusters/#{cluster_id}",
742
+ backup_id: backup_id,
743
+ source_backup: source_backup,
744
+ expire_time: expire_time
745
+ end
746
+
724
747
  ##
725
748
  # @return [Google::Cloud::Bigtable::Admin::V2::Backup]
726
749
  #
@@ -868,6 +891,23 @@ module Google
868
891
  def inspect
869
892
  "#{self.class}(#{@project_id})"
870
893
  end
894
+
895
+ def create_bigtable_client table_path, app_profile_id
896
+ V2::Bigtable::Client.new do |config|
897
+ config.credentials = credentials if credentials
898
+ config.timeout = timeout if timeout
899
+ config.endpoint = host if host
900
+ config.lib_name = "gccl"
901
+ config.lib_version = Google::Cloud::Bigtable::VERSION
902
+ config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
903
+ config.channel_pool.channel_selection = @channel_selection
904
+ config.channel_pool.channel_count = @channel_count
905
+ request, options = Convert.ping_and_warm_request table_path, app_profile_id, timeout
906
+ config.channel_pool.on_channel_create = proc do |channel|
907
+ channel.call_rpc :ping_and_warm, request, options: options
908
+ end
909
+ end
910
+ end
871
911
  end
872
912
  end
873
913
  end
@@ -35,12 +35,12 @@ module Google
35
35
  #
36
36
  # bigtable = Google::Cloud::Bigtable.new
37
37
  #
38
- # table = bigtable.table("my-instance", "my-table")
38
+ # table = bigtable.table "my-instance", "my-table"
39
39
  #
40
40
  # entries = []
41
41
  # entries << table.new_mutation_entry("row-1").set_cell("cf1", "field1", "XYZ")
42
42
  # entries << table.new_mutation_entry("row-2").set_cell("cf1", "field1", "ABC")
43
- # responses = table.mutate_rows(entries)
43
+ # responses = table.mutate_rows entries
44
44
  #
45
45
  # responses.each do |response|
46
46
  # puts response.status.description
@@ -31,7 +31,7 @@ module Google
31
31
  #
32
32
  # bigtable = Google::Cloud::Bigtable.new
33
33
  #
34
- # table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
34
+ # table = bigtable.table "my-instance", "my-table", view: :FULL, perform_lookup: true
35
35
  #
36
36
  # table.cluster_states.each do |cs|
37
37
  # puts cs.cluster_name
@@ -48,7 +48,7 @@ module Google
48
48
  #
49
49
  # bigtable = Google::Cloud::Bigtable.new
50
50
  #
51
- # tables = bigtable.tables("my-instance")
51
+ # tables = bigtable.tables "my-instance"
52
52
  # if tables.next?
53
53
  # next_tables = tables.next
54
54
  # end
@@ -67,7 +67,7 @@ module Google
67
67
  #
68
68
  # bigtable = Google::Cloud::Bigtable.new
69
69
  #
70
- # tables = bigtable.tables("my-instance")
70
+ # tables = bigtable.tables "my-instance"
71
71
  # if tables.next?
72
72
  # next_tables = tables.next
73
73
  # end
@@ -32,12 +32,12 @@ module Google
32
32
  # require "google/cloud/bigtable"
33
33
  #
34
34
  # bigtable = Google::Cloud::Bigtable.new
35
- # instance = bigtable.instance("my-instance")
36
- # cluster = instance.cluster("my-cluster")
35
+ # instance = bigtable.instance "my-instance"
36
+ # cluster = instance.cluster "my-cluster"
37
37
  #
38
- # backup = cluster.backup("my-backup")
38
+ # backup = cluster.backup "my-backup"
39
39
  #
40
- # job = backup.restore("my-new-table")
40
+ # job = backup.restore "my-new-table"
41
41
  #
42
42
  # job.wait_until_done!
43
43
  # job.done? #=> true
@@ -60,12 +60,12 @@ module Google
60
60
  # require "google/cloud/bigtable"
61
61
  #
62
62
  # bigtable = Google::Cloud::Bigtable.new
63
- # instance = bigtable.instance("my-instance")
64
- # cluster = instance.cluster("my-cluster")
63
+ # instance = bigtable.instance "my-instance"
64
+ # cluster = instance.cluster "my-cluster"
65
65
  #
66
- # backup = cluster.backup("my-backup")
66
+ # backup = cluster.backup "my-backup"
67
67
  #
68
- # job = backup.restore("my-new-table")
68
+ # job = backup.restore "my-new-table"
69
69
  #
70
70
  # job.wait_until_done!
71
71
  # job.done? #=> true
@@ -90,12 +90,12 @@ module Google
90
90
  # require "google/cloud/bigtable"
91
91
  #
92
92
  # bigtable = Google::Cloud::Bigtable.new
93
- # instance = bigtable.instance("my-instance")
94
- # cluster = instance.cluster("my-cluster")
93
+ # instance = bigtable.instance "my-instance"
94
+ # cluster = instance.cluster "my-cluster"
95
95
  #
96
- # backup = cluster.backup("my-backup")
96
+ # backup = cluster.backup "my-backup"
97
97
  #
98
- # job = backup.restore("my-new-table")
98
+ # job = backup.restore "my-new-table"
99
99
  #
100
100
  # job.wait_until_done!
101
101
  # job.done? #=> true
@@ -37,7 +37,7 @@ module Google
37
37
  #
38
38
  # bigtable = Google::Cloud::Bigtable.new
39
39
  #
40
- # table = bigtable.table("my-instance", "my-table")
40
+ # table = bigtable.table "my-instance", "my-table"
41
41
  #
42
42
  # if table.exists?
43
43
  # p "Table exists."
@@ -72,11 +72,13 @@ module Google
72
72
  # @private
73
73
  #
74
74
  # Creates a new Table instance.
75
- def initialize grpc, service, view:
75
+ def initialize grpc, service, view:, app_profile_id: nil
76
76
  @grpc = grpc
77
77
  @service = service
78
+ @app_profile_id = app_profile_id
78
79
  raise ArgumentError, "view must not be nil" if view.nil?
79
80
  @loaded_views = Set[view]
81
+ @service.client path, app_profile_id
80
82
  end
81
83
 
82
84
  ##
@@ -158,7 +160,7 @@ module Google
158
160
  #
159
161
  # bigtable = Google::Cloud::Bigtable.new
160
162
  #
161
- # table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
163
+ # table = bigtable.table "my-instance", "my-table", view: :FULL, perform_lookup: true
162
164
  #
163
165
  # table.cluster_states.each do |cs|
164
166
  # puts cs.cluster_name
@@ -207,7 +209,7 @@ module Google
207
209
  #
208
210
  # bigtable = Google::Cloud::Bigtable.new
209
211
  #
210
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
212
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
211
213
  #
212
214
  # table.column_families.each do |name, cf|
213
215
  # puts name
@@ -222,15 +224,15 @@ module Google
222
224
  #
223
225
  # bigtable = Google::Cloud::Bigtable.new
224
226
  #
225
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
227
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
226
228
  #
227
229
  # table.column_families do |cfm|
228
230
  # cfm.add "cf4", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
229
231
  # cfm.add "cf5", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
230
232
  #
231
- # rule_1 = Google::Cloud::Bigtable::GcRule.max_versions(3)
232
- # rule_2 = Google::Cloud::Bigtable::GcRule.max_age(600)
233
- # rule_union = Google::Cloud::Bigtable::GcRule.union(rule_1, rule_2)
233
+ # rule_1 = Google::Cloud::Bigtable::GcRule.max_versions 3
234
+ # rule_2 = Google::Cloud::Bigtable::GcRule.max_age 600
235
+ # rule_union = Google::Cloud::Bigtable::GcRule.union rule_1, rule_2
234
236
  # cfm.update "cf2", gc_rule: rule_union
235
237
  #
236
238
  # cfm.delete "cf3"
@@ -296,7 +298,7 @@ module Google
296
298
  #
297
299
  # bigtable = Google::Cloud::Bigtable.new
298
300
  #
299
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
301
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
300
302
  # policy = table.policy
301
303
  #
302
304
  # @example Update the policy by passing a block.
@@ -304,10 +306,10 @@ module Google
304
306
  #
305
307
  # bigtable = Google::Cloud::Bigtable.new
306
308
  #
307
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
309
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
308
310
  #
309
311
  # table.policy do |p|
310
- # p.add("roles/owner", "user:owner@example.com")
312
+ # p.add "roles/owner", "user:owner@example.com"
311
313
  # end # 2 API calls
312
314
  #
313
315
  def policy
@@ -338,11 +340,11 @@ module Google
338
340
  #
339
341
  # bigtable = Google::Cloud::Bigtable.new
340
342
  #
341
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
343
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
342
344
  #
343
345
  # policy = table.policy
344
- # policy.add("roles/owner", "user:owner@example.com")
345
- # updated_policy = table.update_policy(policy)
346
+ # policy.add "roles/owner", "user:owner@example.com"
347
+ # updated_policy = table.update_policy policy
346
348
  #
347
349
  # puts updated_policy.roles
348
350
  #
@@ -372,7 +374,7 @@ module Google
372
374
  #
373
375
  # bigtable = Google::Cloud::Bigtable.new
374
376
  #
375
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
377
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
376
378
  #
377
379
  # permissions = table.test_iam_permissions(
378
380
  # "bigtable.tables.delete",
@@ -397,7 +399,7 @@ module Google
397
399
  #
398
400
  # bigtable = Google::Cloud::Bigtable.new
399
401
  #
400
- # table = bigtable.table("my-instance", "my-table")
402
+ # table = bigtable.table "my-instance", "my-table"
401
403
  # table.delete
402
404
  #
403
405
  def delete
@@ -416,7 +418,7 @@ module Google
416
418
  #
417
419
  # bigtable = Google::Cloud::Bigtable.new
418
420
  #
419
- # table = bigtable.table("my-instance", "my-table")
421
+ # table = bigtable.table "my-instance", "my-table"
420
422
  #
421
423
  # if table.exists?
422
424
  # p "Table exists."
@@ -429,8 +431,8 @@ module Google
429
431
  #
430
432
  # bigtable = Google::Cloud::Bigtable.new
431
433
  #
432
- # instance = bigtable.instance("my-instance")
433
- # table = instance.table("my-table")
434
+ # instance = bigtable.instance "my-instance"
435
+ # table = instance.table "my-table"
434
436
  #
435
437
  # if table.exists?
436
438
  # p "Table exists."
@@ -470,7 +472,7 @@ module Google
470
472
  table = Google::Cloud::Bigtable::Admin::V2::Table.new({
471
473
  column_families: column_families.to_grpc_hash,
472
474
  granularity: granularity
473
- }.delete_if { |_, v| v.nil? })
475
+ }.compact)
474
476
 
475
477
  grpc = service.create_table instance_id, table_id, table, initial_splits: initial_splits
476
478
  from_grpc grpc, service, view: :SCHEMA_VIEW
@@ -489,8 +491,8 @@ module Google
489
491
  #
490
492
  # bigtable = Google::Cloud::Bigtable.new
491
493
  #
492
- # instance = bigtable.instance("my-instance")
493
- # table = instance.table("my-table")
494
+ # instance = bigtable.instance "my-instance"
495
+ # table = instance.table "my-table"
494
496
  #
495
497
  # table.generate_consistency_token # "l947XelENinaxJQP0nnrZJjHnAF7YrwW8HCJLotwrF"
496
498
  #
@@ -512,12 +514,12 @@ module Google
512
514
  #
513
515
  # bigtable = Google::Cloud::Bigtable.new
514
516
  #
515
- # instance = bigtable.instance("my-instance")
516
- # table = instance.table("my-table")
517
+ # instance = bigtable.instance "my-instance"
518
+ # table = instance.table "my-table"
517
519
  #
518
520
  # token = "l947XelENinaxJQP0nnrZJjHnAF7YrwW8HCJLotwrF"
519
521
  #
520
- # if table.check_consistency(token)
522
+ # if table.check_consistency token
521
523
  # puts "Replication is consistent"
522
524
  # end
523
525
  #
@@ -546,14 +548,14 @@ module Google
546
548
  #
547
549
  # bigtable = Google::Cloud::Bigtable.new
548
550
  #
549
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
551
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
550
552
  #
551
553
  # if table.wait_for_replication
552
554
  # puts "Replication done"
553
555
  # end
554
556
  #
555
557
  # # With custom timeout and interval
556
- # if table.wait_for_replication(timeout: 300, check_interval: 10)
558
+ # if table.wait_for_replication timeout: 300, check_interval: 10
557
559
  # puts "Replication done"
558
560
  # end
559
561
  #
@@ -585,12 +587,12 @@ module Google
585
587
  #
586
588
  # bigtable = Google::Cloud::Bigtable.new
587
589
  #
588
- # instance = bigtable.instance("my-instance")
589
- # table = instance.table("my-table")
590
+ # instance = bigtable.instance "my-instance"
591
+ # table = instance.table "my-table"
590
592
  # table.delete_all_rows
591
593
  #
592
594
  # # With timeout
593
- # table.delete_all_rows(timeout: 120) # 120 seconds.
595
+ # table.delete_all_rows timeout: 120 # 120 seconds.
594
596
  #
595
597
  def delete_all_rows timeout: nil
596
598
  drop_row_range delete_all_data: true, timeout: timeout
@@ -607,12 +609,12 @@ module Google
607
609
  #
608
610
  # bigtable = Google::Cloud::Bigtable.new
609
611
  #
610
- # table = bigtable.table("my-instance", "my-table")
612
+ # table = bigtable.table "my-instance", "my-table"
611
613
  #
612
- # table.delete_rows_by_prefix("user-100")
614
+ # table.delete_rows_by_prefix "user-100"
613
615
  #
614
616
  # # With timeout
615
- # table.delete_rows_by_prefix("user-1", timeout: 120) # 120 seconds.
617
+ # table.delete_rows_by_prefix "user-1", timeout: 120 # 120 seconds.
616
618
  #
617
619
  def delete_rows_by_prefix prefix, timeout: nil
618
620
  drop_row_range row_key_prefix: prefix, timeout: timeout
@@ -631,13 +633,13 @@ module Google
631
633
  #
632
634
  # bigtable = Google::Cloud::Bigtable.new
633
635
  #
634
- # table = bigtable.table("my-instance", "my-table")
636
+ # table = bigtable.table "my-instance", "my-table"
635
637
  #
636
638
  # # Delete rows using row key prefix.
637
- # table.drop_row_range(row_key_prefix: "user-100")
639
+ # table.drop_row_range row_key_prefix: "user-100"
638
640
  #
639
641
  # # Delete all data With timeout
640
- # table.drop_row_range(delete_all_data: true, timeout: 120) # 120 seconds.
642
+ # table.drop_row_range delete_all_data: true, timeout: 120 # 120 seconds.
641
643
  #
642
644
  def drop_row_range row_key_prefix: nil, delete_all_data: nil, timeout: nil
643
645
  ensure_service!
@@ -659,8 +661,8 @@ module Google
659
661
  # @param view [Symbol] View type.
660
662
  # @return [Google::Cloud::Bigtable::Table]
661
663
  #
662
- def self.from_grpc grpc, service, view:
663
- new grpc, service, view: view
664
+ def self.from_grpc grpc, service, view:, app_profile_id: nil
665
+ new grpc, service, view: view, app_profile_id: app_profile_id
664
666
  end
665
667
 
666
668
  # @private
@@ -672,9 +674,9 @@ module Google
672
674
  # @param service [Google::Cloud::Bigtable::Service]
673
675
  # @return [Google::Cloud::Bigtable::Table]
674
676
  #
675
- def self.from_path path, service
677
+ def self.from_path path, service, app_profile_id: nil
676
678
  grpc = Google::Cloud::Bigtable::Admin::V2::Table.new name: path
677
- new grpc, service, view: :NAME_ONLY
679
+ new grpc, service, view: :NAME_ONLY, app_profile_id: app_profile_id
678
680
  end
679
681
 
680
682
  protected
@@ -34,7 +34,7 @@ module Google
34
34
  # require "google/cloud/bigtable"
35
35
  #
36
36
  # bigtable = Google::Cloud::Bigtable.new
37
- # table = bigtable.table("my-instance", "my-table")
37
+ # table = bigtable.table "my-instance", "my-table"
38
38
  #
39
39
  # # Range that includes all row keys including "value-001" to "value-005" excluding.
40
40
  # table.new_value_range.from("value-001").to("value-005")
@@ -43,19 +43,19 @@ module Google
43
43
  # table.new_value_range.from("value-001").to("value-010", inclusive: true)
44
44
  #
45
45
  # # Range that includes all row keys including "value-001" up until end of the row keys.
46
- # table.new_value_range.from("value-001")
46
+ # table.new_value_range.from "value-001"
47
47
  #
48
48
  # # Range that includes all row keys exclusive "value-001" up until end of the row keys.
49
- # table.new_value_range.from("value-001", inclusive: false)
49
+ # table.new_value_range.from "value-001", inclusive: false
50
50
  #
51
51
  # # Range with unbounded from and the exclusive end "value-100".
52
- # table.new_value_range.to("value-100")
52
+ # table.new_value_range.to "value-100"
53
53
  #
54
54
  # # Range that includes all row keys including from and end row keys "value-001", "value-100".
55
- # table.new_value_range.between("value-001", "value-100")
55
+ # table.new_value_range.between "value-001", "value-100"
56
56
  #
57
57
  # # Range that includes all row keys including "value-001" up until "value-100".
58
- # table.new_value_range.of("value-001", "value-100")
58
+ # table.new_value_range.of "value-001", "value-100"
59
59
  #
60
60
  class ValueRange
61
61
  # @private
@@ -78,17 +78,17 @@ module Google
78
78
  # require "google/cloud/bigtable"
79
79
  #
80
80
  # bigtable = Google::Cloud::Bigtable.new
81
- # table = bigtable.table("my-instance", "my-table")
81
+ # table = bigtable.table "my-instance", "my-table"
82
82
  #
83
- # range = table.new_value_range.from("value-001")
83
+ # range = table.new_value_range.from "value-001"
84
84
  #
85
85
  # @example Exclusive lower bound.
86
86
  # require "google/cloud/bigtable"
87
87
  #
88
88
  # bigtable = Google::Cloud::Bigtable.new
89
- # table = bigtable.table("my-instance", "my-table")
89
+ # table = bigtable.table "my-instance", "my-table"
90
90
  #
91
- # range = table.new_value_range.from("value-001", inclusive: false)
91
+ # range = table.new_value_range.from "value-001", inclusive: false
92
92
  #
93
93
  def from value, inclusive: true
94
94
  # If value is integer, covert it to a 64-bit signed big-endian integer.
@@ -115,17 +115,17 @@ module Google
115
115
  # require "google/cloud/bigtable"
116
116
  #
117
117
  # bigtable = Google::Cloud::Bigtable.new
118
- # table = bigtable.table("my-instance", "my-table")
118
+ # table = bigtable.table "my-instance", "my-table"
119
119
  #
120
- # range = table.new_value_range.to("value-010", inclusive: true)
120
+ # range = table.new_value_range.to "value-010", inclusive: true
121
121
  #
122
122
  # @example Exclusive upper bound.
123
123
  # require "google/cloud/bigtable"
124
124
  #
125
125
  # bigtable = Google::Cloud::Bigtable.new
126
- # table = bigtable.table("my-instance", "my-table")
126
+ # table = bigtable.table "my-instance", "my-table"
127
127
  #
128
- # range = table.new_value_range.to("value-010")
128
+ # range = table.new_value_range.to "value-010"
129
129
  #
130
130
  def to value, inclusive: false
131
131
  # If value is integer, covert it to a 64-bit signed big-endian integer.
@@ -154,9 +154,9 @@ module Google
154
154
  # require "google/cloud/bigtable"
155
155
  #
156
156
  # bigtable = Google::Cloud::Bigtable.new
157
- # table = bigtable.table("my-instance", "my-table")
157
+ # table = bigtable.table "my-instance", "my-table"
158
158
  #
159
- # range = table.new_value_range.between("value-001", "value-010")
159
+ # range = table.new_value_range.between "value-001", "value-010"
160
160
  #
161
161
  def between from_value, to_value
162
162
  from(from_value).to(to_value, inclusive: true)
@@ -178,9 +178,9 @@ module Google
178
178
  # require "google/cloud/bigtable"
179
179
  #
180
180
  # bigtable = Google::Cloud::Bigtable.new
181
- # table = bigtable.table("my-instance", "my-table")
181
+ # table = bigtable.table "my-instance", "my-table"
182
182
  #
183
- # range = table.new_value_range.of("value-001", "value-010")
183
+ # range = table.new_value_range.of "value-001", "value-010"
184
184
  #
185
185
  def of from_value, to_value
186
186
  from(from_value).to(to_value)
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "2.6.0".freeze
19
+ VERSION = "2.10.1".freeze
20
20
  end
21
21
  end
22
22
  end