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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +32 -0
  4. data/CONTRIBUTING.md +2 -3
  5. data/OVERVIEW.md +1 -1
  6. data/lib/google/cloud/bigtable/app_profile.rb +20 -21
  7. data/lib/google/cloud/bigtable/app_profile/job.rb +4 -4
  8. data/lib/google/cloud/bigtable/app_profile/list.rb +5 -7
  9. data/lib/google/cloud/bigtable/backup.rb +83 -32
  10. data/lib/google/cloud/bigtable/backup/job.rb +8 -8
  11. data/lib/google/cloud/bigtable/backup/list.rb +9 -11
  12. data/lib/google/cloud/bigtable/cluster.rb +37 -17
  13. data/lib/google/cloud/bigtable/cluster/job.rb +2 -2
  14. data/lib/google/cloud/bigtable/column_family.rb +2 -2
  15. data/lib/google/cloud/bigtable/column_family_map.rb +14 -14
  16. data/lib/google/cloud/bigtable/column_range.rb +7 -7
  17. data/lib/google/cloud/bigtable/encryption_info.rb +118 -0
  18. data/lib/google/cloud/bigtable/gc_rule.rb +20 -20
  19. data/lib/google/cloud/bigtable/instance.rb +40 -40
  20. data/lib/google/cloud/bigtable/instance/cluster_map.rb +61 -21
  21. data/lib/google/cloud/bigtable/instance/job.rb +4 -4
  22. data/lib/google/cloud/bigtable/mutation_entry.rb +21 -21
  23. data/lib/google/cloud/bigtable/mutation_operations.rb +34 -34
  24. data/lib/google/cloud/bigtable/policy.rb +4 -4
  25. data/lib/google/cloud/bigtable/project.rb +15 -15
  26. data/lib/google/cloud/bigtable/read_operations.rb +31 -31
  27. data/lib/google/cloud/bigtable/routing_policy.rb +6 -6
  28. data/lib/google/cloud/bigtable/row_filter.rb +28 -28
  29. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +30 -29
  30. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +6 -6
  31. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +27 -26
  32. data/lib/google/cloud/bigtable/row_range.rb +18 -18
  33. data/lib/google/cloud/bigtable/sample_row_key.rb +1 -1
  34. data/lib/google/cloud/bigtable/service.rb +6 -3
  35. data/lib/google/cloud/bigtable/status.rb +2 -2
  36. data/lib/google/cloud/bigtable/table.rb +66 -43
  37. data/lib/google/cloud/bigtable/table/cluster_state.rb +43 -9
  38. data/lib/google/cloud/bigtable/table/list.rb +2 -2
  39. data/lib/google/cloud/bigtable/table/restore_job.rb +12 -12
  40. data/lib/google/cloud/bigtable/value_range.rb +18 -18
  41. data/lib/google/cloud/bigtable/version.rb +1 -1
  42. metadata +4 -3
@@ -30,7 +30,7 @@ module Google
30
30
  # require "google/cloud/bigtable"
31
31
  #
32
32
  # bigtable = Google::Cloud::Bigtable.new
33
- # table = bigtable.table("my-instance", "my-table")
33
+ # table = bigtable.table "my-instance", "my-table"
34
34
  #
35
35
  # # Range that includes all row keys including "user-001" to "user-005"
36
36
  # table.new_row_range.from("user-001").to("user-005", inclusive: true)
@@ -39,19 +39,19 @@ module Google
39
39
  # table.new_row_range.from("user-001").to("user-010")
40
40
  #
41
41
  # # Range that includes all row keys including "user-001" up until end of the row keys.
42
- # table.new_row_range.from("user-001")
42
+ # table.new_row_range.from "user-001"
43
43
  #
44
44
  # # Range that includes all row keys exclusive "user-001" up until end of the row keys.
45
- # table.new_row_range.from("user-001", inclusive: false)
45
+ # table.new_row_range.from "user-001", inclusive: false
46
46
  #
47
47
  # # Range with unbounded from and the exclusive end "user-010"
48
- # table.new_row_range.to("user-010")
48
+ # table.new_row_range.to "user-010"
49
49
  #
50
50
  # # Range that includes all row keys including from and end row keys "user-001", "user-010"
51
- # table.new_row_range.between("user-001", "user-010")
51
+ # table.new_row_range.between "user-001", "user-010"
52
52
  #
53
53
  # # Range that includes all row keys including "user-001" up until "user-010"
54
- # table.new_row_range.of("user-001", "user-010")
54
+ # table.new_row_range.of "user-001", "user-010"
55
55
  #
56
56
  class RowRange
57
57
  # @private
@@ -72,17 +72,17 @@ module Google
72
72
  # require "google/cloud/bigtable"
73
73
  #
74
74
  # bigtable = Google::Cloud::Bigtable.new
75
- # table = bigtable.table("my-instance", "my-table")
75
+ # table = bigtable.table "my-instance", "my-table"
76
76
  #
77
- # range = table.new_row_range.from("key-001")
77
+ # range = table.new_row_range.from "key-001"
78
78
  #
79
79
  # @example Exclusive lower bound.
80
80
  # require "google/cloud/bigtable"
81
81
  #
82
82
  # bigtable = Google::Cloud::Bigtable.new
83
- # table = bigtable.table("my-instance", "my-table")
83
+ # table = bigtable.table "my-instance", "my-table"
84
84
  #
85
- # range = table.new_row_range.from("key-001", inclusive: false)
85
+ # range = table.new_row_range.from "key-001", inclusive: false
86
86
  #
87
87
  def from key, inclusive: true
88
88
  if inclusive
@@ -105,17 +105,17 @@ module Google
105
105
  # require "google/cloud/bigtable"
106
106
  #
107
107
  # bigtable = Google::Cloud::Bigtable.new
108
- # table = bigtable.table("my-instance", "my-table")
108
+ # table = bigtable.table "my-instance", "my-table"
109
109
  #
110
- # range = table.new_row_range.to("key-001", inclusive: true)
110
+ # range = table.new_row_range.to "key-001", inclusive: true
111
111
  #
112
112
  # @example Exclusive upper bound.
113
113
  # require "google/cloud/bigtable"
114
114
  #
115
115
  # bigtable = Google::Cloud::Bigtable.new
116
- # table = bigtable.table("my-instance", "my-table")
116
+ # table = bigtable.table "my-instance", "my-table"
117
117
  #
118
- # range = table.new_row_range.to("key-001")
118
+ # range = table.new_row_range.to "key-001"
119
119
  #
120
120
  def to key, inclusive: false
121
121
  if inclusive
@@ -138,9 +138,9 @@ module Google
138
138
  # require "google/cloud/bigtable"
139
139
  #
140
140
  # bigtable = Google::Cloud::Bigtable.new
141
- # table = bigtable.table("my-instance", "my-table")
141
+ # table = bigtable.table "my-instance", "my-table"
142
142
  #
143
- # range = table.new_row_range.between("key-001", "key-010")
143
+ # range = table.new_row_range.between "key-001", "key-010"
144
144
  #
145
145
  def between from_key, to_key
146
146
  from(from_key).to(to_key, inclusive: true)
@@ -158,9 +158,9 @@ module Google
158
158
  # require "google/cloud/bigtable"
159
159
  #
160
160
  # bigtable = Google::Cloud::Bigtable.new
161
- # table = bigtable.table("my-instance", "my-table")
161
+ # table = bigtable.table "my-instance", "my-table"
162
162
  #
163
- # range = table.new_row_range.of("key-001", "key-010")
163
+ # range = table.new_row_range.of "key-001", "key-010"
164
164
  #
165
165
  def of from_key, to_key
166
166
  from(from_key).to(to_key)
@@ -42,7 +42,7 @@ module Google
42
42
  #
43
43
  # bigtable = Google::Cloud::Bigtable.new
44
44
  #
45
- # table = bigtable.table("my-instance", "my-table")
45
+ # table = bigtable.table "my-instance", "my-table"
46
46
  #
47
47
  # table.sample_row_keys.each do |r|
48
48
  # p r
@@ -752,17 +752,20 @@ module Google
752
752
  # Create a new table by restoring from a completed backup.
753
753
  #
754
754
  # @param table_id [String] The table ID for the new table. This table must not yet exist.
755
- # @param instance_id [String] The instance ID for the source backup. The table will be created in this instance.
755
+ # @param instance_id [String] The instance ID for the source backup. The table will be created in this instance
756
+ # if table_instance_id is not provided.
756
757
  # @param cluster_id [String] The cluster ID for the source backup.
757
758
  # @param backup_id [String] The backup ID for the source backup.
759
+ # @param table_instance_id [String] The instance ID for the table, if different from instance_id. Optional.
758
760
  #
759
761
  # @return [Gapic::Operation] The {Google::Longrunning::Operation#metadata metadata} field type is
760
762
  # {Google::Cloud::Bigtable::Admin::RestoreTableMetadata RestoreTableMetadata}. The
761
763
  # {Google::Longrunning::Operation#response response} type is
762
764
  # {Google::Cloud::Bigtable::Admin::V2::Table Table}, if successful.
763
765
  #
764
- def restore_table table_id, instance_id, cluster_id, backup_id
765
- tables.restore_table parent: instance_path(instance_id),
766
+ def restore_table table_id, instance_id, cluster_id, backup_id, table_instance_id: nil
767
+ table_instance_id ||= instance_id
768
+ tables.restore_table parent: instance_path(table_instance_id),
766
769
  table_id: table_id,
767
770
  backup: backup_path(instance_id, cluster_id, backup_id)
768
771
  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
@@ -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."
@@ -140,19 +140,34 @@ module Google
140
140
  end
141
141
 
142
142
  ##
143
- # Map from cluster ID to per-cluster table state.
143
+ # Returns an array of {Table::ClusterState} objects that map cluster ID
144
+ # to per-cluster table state.
145
+ #
144
146
  # If it could not be determined whether or not the table has data in a
145
147
  # particular cluster (for example, if its zone is unavailable), then
146
- # there will be an entry for the cluster with UNKNOWN `replication_status`.
148
+ # the cluster state's `replication_state` will be `UNKNOWN`.
147
149
  #
148
- # Reloads the table if necessary to retrieve the cluster states data,
149
- # since it is only available in a table with view type `REPLICATION_VIEW`
150
- # or `FULL`. Previously loaded data is retained.
150
+ # Reloads the table with the `FULL` view type to retrieve the cluster states
151
+ # data, unless the table was previously loaded with view type `ENCRYPTION_VIEW`,
152
+ # `REPLICATION_VIEW` or `FULL`.
151
153
  #
152
154
  # @return [Array<Google::Cloud::Bigtable::Table::ClusterState>]
153
155
  #
156
+ # @example Retrieve a table with cluster states.
157
+ # require "google/cloud/bigtable"
158
+ #
159
+ # bigtable = Google::Cloud::Bigtable.new
160
+ #
161
+ # table = bigtable.table "my-instance", "my-table", view: :FULL, perform_lookup: true
162
+ #
163
+ # table.cluster_states.each do |cs|
164
+ # puts cs.cluster_name
165
+ # puts cs.replication_state
166
+ # puts cs.encryption_infos.first.encryption_type
167
+ # end
168
+ #
154
169
  def cluster_states
155
- check_view_and_load :REPLICATION_VIEW
170
+ check_view_and_load :FULL, skip_if: [:ENCRYPTION_VIEW, :REPLICATION_VIEW]
156
171
  @grpc.cluster_states.map do |name, state_grpc|
157
172
  ClusterState.from_grpc state_grpc, name
158
173
  end
@@ -192,7 +207,7 @@ module Google
192
207
  #
193
208
  # bigtable = Google::Cloud::Bigtable.new
194
209
  #
195
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
210
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
196
211
  #
197
212
  # table.column_families.each do |name, cf|
198
213
  # puts name
@@ -207,15 +222,15 @@ module Google
207
222
  #
208
223
  # bigtable = Google::Cloud::Bigtable.new
209
224
  #
210
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
225
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
211
226
  #
212
227
  # table.column_families do |cfm|
213
228
  # cfm.add "cf4", gc_rule: Google::Cloud::Bigtable::GcRule.max_age(600)
214
229
  # cfm.add "cf5", gc_rule: Google::Cloud::Bigtable::GcRule.max_versions(5)
215
230
  #
216
- # rule_1 = Google::Cloud::Bigtable::GcRule.max_versions(3)
217
- # rule_2 = Google::Cloud::Bigtable::GcRule.max_age(600)
218
- # rule_union = Google::Cloud::Bigtable::GcRule.union(rule_1, rule_2)
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
219
234
  # cfm.update "cf2", gc_rule: rule_union
220
235
  #
221
236
  # cfm.delete "cf3"
@@ -281,7 +296,7 @@ module Google
281
296
  #
282
297
  # bigtable = Google::Cloud::Bigtable.new
283
298
  #
284
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
299
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
285
300
  # policy = table.policy
286
301
  #
287
302
  # @example Update the policy by passing a block.
@@ -289,10 +304,10 @@ module Google
289
304
  #
290
305
  # bigtable = Google::Cloud::Bigtable.new
291
306
  #
292
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
307
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
293
308
  #
294
309
  # table.policy do |p|
295
- # p.add("roles/owner", "user:owner@example.com")
310
+ # p.add "roles/owner", "user:owner@example.com"
296
311
  # end # 2 API calls
297
312
  #
298
313
  def policy
@@ -323,11 +338,11 @@ module Google
323
338
  #
324
339
  # bigtable = Google::Cloud::Bigtable.new
325
340
  #
326
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
341
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
327
342
  #
328
343
  # policy = table.policy
329
- # policy.add("roles/owner", "user:owner@example.com")
330
- # updated_policy = table.update_policy(policy)
344
+ # policy.add "roles/owner", "user:owner@example.com"
345
+ # updated_policy = table.update_policy policy
331
346
  #
332
347
  # puts updated_policy.roles
333
348
  #
@@ -357,7 +372,7 @@ module Google
357
372
  #
358
373
  # bigtable = Google::Cloud::Bigtable.new
359
374
  #
360
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
375
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
361
376
  #
362
377
  # permissions = table.test_iam_permissions(
363
378
  # "bigtable.tables.delete",
@@ -382,7 +397,7 @@ module Google
382
397
  #
383
398
  # bigtable = Google::Cloud::Bigtable.new
384
399
  #
385
- # table = bigtable.table("my-instance", "my-table")
400
+ # table = bigtable.table "my-instance", "my-table"
386
401
  # table.delete
387
402
  #
388
403
  def delete
@@ -401,7 +416,7 @@ module Google
401
416
  #
402
417
  # bigtable = Google::Cloud::Bigtable.new
403
418
  #
404
- # table = bigtable.table("my-instance", "my-table")
419
+ # table = bigtable.table "my-instance", "my-table"
405
420
  #
406
421
  # if table.exists?
407
422
  # p "Table exists."
@@ -414,8 +429,8 @@ module Google
414
429
  #
415
430
  # bigtable = Google::Cloud::Bigtable.new
416
431
  #
417
- # instance = bigtable.instance("my-instance")
418
- # table = instance.table("my-table")
432
+ # instance = bigtable.instance "my-instance"
433
+ # table = instance.table "my-table"
419
434
  #
420
435
  # if table.exists?
421
436
  # p "Table exists."
@@ -474,8 +489,8 @@ module Google
474
489
  #
475
490
  # bigtable = Google::Cloud::Bigtable.new
476
491
  #
477
- # instance = bigtable.instance("my-instance")
478
- # table = instance.table("my-table")
492
+ # instance = bigtable.instance "my-instance"
493
+ # table = instance.table "my-table"
479
494
  #
480
495
  # table.generate_consistency_token # "l947XelENinaxJQP0nnrZJjHnAF7YrwW8HCJLotwrF"
481
496
  #
@@ -497,12 +512,12 @@ module Google
497
512
  #
498
513
  # bigtable = Google::Cloud::Bigtable.new
499
514
  #
500
- # instance = bigtable.instance("my-instance")
501
- # table = instance.table("my-table")
515
+ # instance = bigtable.instance "my-instance"
516
+ # table = instance.table "my-table"
502
517
  #
503
518
  # token = "l947XelENinaxJQP0nnrZJjHnAF7YrwW8HCJLotwrF"
504
519
  #
505
- # if table.check_consistency(token)
520
+ # if table.check_consistency token
506
521
  # puts "Replication is consistent"
507
522
  # end
508
523
  #
@@ -531,14 +546,14 @@ module Google
531
546
  #
532
547
  # bigtable = Google::Cloud::Bigtable.new
533
548
  #
534
- # table = bigtable.table("my-instance", "my-table", perform_lookup: true)
549
+ # table = bigtable.table "my-instance", "my-table", perform_lookup: true
535
550
  #
536
551
  # if table.wait_for_replication
537
552
  # puts "Replication done"
538
553
  # end
539
554
  #
540
555
  # # With custom timeout and interval
541
- # if table.wait_for_replication(timeout: 300, check_interval: 10)
556
+ # if table.wait_for_replication timeout: 300, check_interval: 10
542
557
  # puts "Replication done"
543
558
  # end
544
559
  #
@@ -570,12 +585,12 @@ module Google
570
585
  #
571
586
  # bigtable = Google::Cloud::Bigtable.new
572
587
  #
573
- # instance = bigtable.instance("my-instance")
574
- # table = instance.table("my-table")
588
+ # instance = bigtable.instance "my-instance"
589
+ # table = instance.table "my-table"
575
590
  # table.delete_all_rows
576
591
  #
577
592
  # # With timeout
578
- # table.delete_all_rows(timeout: 120) # 120 seconds.
593
+ # table.delete_all_rows timeout: 120 # 120 seconds.
579
594
  #
580
595
  def delete_all_rows timeout: nil
581
596
  drop_row_range delete_all_data: true, timeout: timeout
@@ -592,12 +607,12 @@ module Google
592
607
  #
593
608
  # bigtable = Google::Cloud::Bigtable.new
594
609
  #
595
- # table = bigtable.table("my-instance", "my-table")
610
+ # table = bigtable.table "my-instance", "my-table"
596
611
  #
597
- # table.delete_rows_by_prefix("user-100")
612
+ # table.delete_rows_by_prefix "user-100"
598
613
  #
599
614
  # # With timeout
600
- # table.delete_rows_by_prefix("user-1", timeout: 120) # 120 seconds.
615
+ # table.delete_rows_by_prefix "user-1", timeout: 120 # 120 seconds.
601
616
  #
602
617
  def delete_rows_by_prefix prefix, timeout: nil
603
618
  drop_row_range row_key_prefix: prefix, timeout: timeout
@@ -616,13 +631,13 @@ module Google
616
631
  #
617
632
  # bigtable = Google::Cloud::Bigtable.new
618
633
  #
619
- # table = bigtable.table("my-instance", "my-table")
634
+ # table = bigtable.table "my-instance", "my-table"
620
635
  #
621
636
  # # Delete rows using row key prefix.
622
- # table.drop_row_range(row_key_prefix: "user-100")
637
+ # table.drop_row_range row_key_prefix: "user-100"
623
638
  #
624
639
  # # Delete all data With timeout
625
- # table.drop_row_range(delete_all_data: true, timeout: 120) # 120 seconds.
640
+ # table.drop_row_range delete_all_data: true, timeout: 120 # 120 seconds.
626
641
  #
627
642
  def drop_row_range row_key_prefix: nil, delete_all_data: nil, timeout: nil
628
643
  ensure_service!
@@ -674,19 +689,24 @@ module Google
674
689
 
675
690
  FIELDS_BY_VIEW = {
676
691
  SCHEMA_VIEW: ["granularity", "column_families"],
692
+ ENCRYPTION_VIEW: ["cluster_states"],
677
693
  REPLICATION_VIEW: ["cluster_states"],
678
694
  FULL: ["granularity", "column_families", "cluster_states"]
679
695
  }.freeze
680
696
 
681
697
  # @private
682
698
  #
683
- # Checks and reloads table with expected view and sets fields.
684
- # @param view [Symbol] Expected view type.
699
+ # Checks and reloads table with expected view. Performs additive updates to fields specified by the given view.
700
+ # @param view [Symbol] The view type to load. If already loaded, no load is performed.
701
+ # @param skip_if [Symbol] Additional satisfying view types. If already loaded, no load is performed.
685
702
  #
686
- def check_view_and_load view
703
+ def check_view_and_load view, skip_if: nil
687
704
  ensure_service!
688
705
 
689
- return if @loaded_views.include?(view) || @loaded_views.include?(:FULL)
706
+ skip = Set.new skip_if
707
+ skip << view
708
+ skip << :FULL
709
+ return if (@loaded_views & skip).any?
690
710
 
691
711
  grpc = service.get_table instance_id, table_id, view: view
692
712
  @loaded_views << view
@@ -694,6 +714,9 @@ module Google
694
714
  FIELDS_BY_VIEW[view].each do |field|
695
715
  case grpc[field]
696
716
  when Google::Protobuf::Map
717
+ # Special handling for column_families:
718
+ # Replace contents of existing Map since setting the new Map won't work.
719
+ # See https://github.com/protocolbuffers/protobuf/issues/4969
697
720
  @grpc[field].clear
698
721
  grpc[field].each { |k, v| @grpc[field][k] = v }
699
722
  else
@@ -15,6 +15,8 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
+ require "google/cloud/bigtable/encryption_info"
19
+
18
20
  module Google
19
21
  module Cloud
20
22
  module Bigtable
@@ -23,6 +25,20 @@ module Google
23
25
  # Table::ClusterState is the state of a table's data in a particular cluster.
24
26
  #
25
27
  # @attr [String] cluster_name The name of the cluster.
28
+ #
29
+ # @example Retrieve a table with cluster states.
30
+ # require "google/cloud/bigtable"
31
+ #
32
+ # bigtable = Google::Cloud::Bigtable.new
33
+ #
34
+ # table = bigtable.table "my-instance", "my-table", view: :FULL, perform_lookup: true
35
+ #
36
+ # table.cluster_states.each do |cs|
37
+ # puts cs.cluster_name
38
+ # puts cs.replication_state
39
+ # puts cs.encryption_infos.first.encryption_type
40
+ # end
41
+ #
26
42
  class ClusterState
27
43
  attr_reader :cluster_name
28
44
 
@@ -36,7 +52,7 @@ module Google
36
52
 
37
53
  ##
38
54
  # The state of replication for the table in this cluster.
39
- # Valid values are:
55
+ # Valid values include:
40
56
  # * `:INITIALIZING` - The cluster was recently created.
41
57
  # * `:PLANNED_MAINTENANCE` - The table is temporarily unable to serve.
42
58
  # * `:UNPLANNED_MAINTENANCE` - The table is temporarily unable to serve.
@@ -45,6 +61,10 @@ module Google
45
61
  # after a restore, and is being optimized for performance. When
46
62
  # optimizations are complete, the table will transition to `READY`
47
63
  # state.
64
+ # * `:STATE_NOT_KNOWN` - If replication state is not present in the object
65
+ # because the table view is not `REPLICATION_VIEW` or `FULL`.
66
+ # * `:UNKNOWN` - If it could not be determined whether or not the table
67
+ # has data in a particular cluster (for example, if its zone is unavailable.)
48
68
  #
49
69
  # @return [Symbol] The state of replication.
50
70
  #
@@ -57,7 +77,8 @@ module Google
57
77
  # over pre-existing data from other clusters before it can begin
58
78
  # receiving live replication updates and serving.
59
79
  #
60
- # @return [Boolean] `true` if the table in this cluster is initializing.
80
+ # @return [Boolean] `true` if the value of {#replication_state} is `INITIALIZING`,
81
+ # `false` otherwise.
61
82
  #
62
83
  def initializing?
63
84
  replication_state == :INITIALIZING
@@ -67,8 +88,8 @@ module Google
67
88
  # The table is temporarily unable to serve
68
89
  # requests from this cluster due to planned internal maintenance.
69
90
  #
70
- # @return [Boolean] `true` if the table in this cluster is in planned
71
- # maintenance.
91
+ # @return [Boolean] `true` if the value of {#replication_state} is `PLANNED_MAINTENANCE`,
92
+ # `false` otherwise.
72
93
  #
73
94
  def planned_maintenance?
74
95
  replication_state == :PLANNED_MAINTENANCE
@@ -78,8 +99,8 @@ module Google
78
99
  # The table is temporarily unable to serve requests from this
79
100
  # cluster due to unplanned or emergency maintenance.
80
101
  #
81
- # @return [Boolean] `true` if the table in this cluster is in unplanned
82
- # maintenance.
102
+ # @return [Boolean] `true` if the value of {#replication_state} is `UNPLANNED_MAINTENANCE`,
103
+ # `false` otherwise.
83
104
  #
84
105
  def unplanned_maintenance?
85
106
  replication_state == :UNPLANNED_MAINTENANCE
@@ -90,7 +111,8 @@ module Google
90
111
  # Depending on replication delay, reads may not immediately
91
112
  # reflect the state of the table in other clusters.
92
113
  #
93
- # @return [Boolean] `true` if the table in this cluster is ready.
114
+ # @return [Boolean] `true` if the value of {#replication_state} is `READY`,
115
+ # `false` otherwise.
94
116
  #
95
117
  def ready?
96
118
  replication_state == :READY
@@ -102,13 +124,25 @@ module Google
102
124
  # optimizations are complete, the table will transition to `READY`
103
125
  # state.
104
126
  #
105
- # @return [Boolean] `true` if the table in this cluster is being
106
- # optimized.
127
+ # @return [Boolean] `true` if the value of {#replication_state} is `READY_OPTIMIZING`,
128
+ # `false` otherwise.
107
129
  #
108
130
  def ready_optimizing?
109
131
  replication_state == :READY_OPTIMIZING
110
132
  end
111
133
 
134
+ ##
135
+ # The encryption info value objects for the table in this cluster. The encryption info
136
+ # is only present when the table view is `ENCRYPTION_VIEW` or `FULL`. See also
137
+ # {Instance::ClusterMap#add}.
138
+ #
139
+ # @return [Array<Google::Cloud::Bigtable::EncryptionInfo>] The array of encryption info
140
+ # value objects, or an empty array if none are present.
141
+ #
142
+ def encryption_infos
143
+ @grpc.encryption_info.map { |ei_grpc| Google::Cloud::Bigtable::EncryptionInfo.from_grpc ei_grpc }
144
+ end
145
+
112
146
  # @private
113
147
  # New Table::ClusterState from a Google::Cloud::Bigtable::Admin::V2::Table::ClusterState object.
114
148
  # @param grpc [Google::Cloud::Bigtable::Admin::V2::Table::ClusterState]