google-cloud-bigtable 2.7.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/google/cloud/bigtable/backup.rb +67 -0
- data/lib/google/cloud/bigtable/convert.rb +34 -0
- data/lib/google/cloud/bigtable/instance.rb +6 -9
- data/lib/google/cloud/bigtable/project.rb +67 -9
- data/lib/google/cloud/bigtable/service.rb +53 -15
- data/lib/google/cloud/bigtable/table.rb +7 -5
- data/lib/google/cloud/bigtable/version.rb +1 -1
- data/lib/google/cloud/bigtable.rb +26 -7
- data/lib/google-cloud-bigtable.rb +2 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf857acc4d00f606d2712fea755ba9f18d8c7d898599144029ff341081549f4c
|
4
|
+
data.tar.gz: aed266e0fabdd16d2ac25c21dde0501e4a0e4172a828f7cc5e468ec9b9caa190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f232903645d9d3e5614c862813005f2e35d998e369f6f1b0b949245e3f5a0a8fb5735d57ac3fb721c7b244d2d8e659ae94e7addef250b2fdd6cc01ad76fd6a5
|
7
|
+
data.tar.gz: 81cc42b99915c8fc15b42020a2582075bfaf5108420d9e3f8350dbece58da63a620316216fd1459ce34feb6b2d6c2341375b800a3c840ec2d7e1b647a09e1647
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.9.0 (2023-09-14)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Add support for channel pooling ([#22747](https://github.com/googleapis/google-cloud-ruby/issues/22747))
|
8
|
+
|
9
|
+
### 2.8.0 (2023-08-17)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Added support for copybackup ([#19341](https://github.com/googleapis/google-cloud-ruby/issues/19341))
|
14
|
+
|
3
15
|
### 2.7.1 (2023-06-16)
|
4
16
|
|
5
17
|
#### Documentation
|
@@ -109,6 +109,18 @@ module Google
|
|
109
109
|
@grpc.name
|
110
110
|
end
|
111
111
|
|
112
|
+
##
|
113
|
+
# The name of the backup from which this backup is copied.
|
114
|
+
# Value will be empty if its not a copied backup and of the form -
|
115
|
+
# `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<source_backup>`
|
116
|
+
# if this is a copied backup.
|
117
|
+
#
|
118
|
+
# @return [String]
|
119
|
+
#
|
120
|
+
def source_backup
|
121
|
+
@grpc.source_backup
|
122
|
+
end
|
123
|
+
|
112
124
|
##
|
113
125
|
# The table from which this backup was created.
|
114
126
|
#
|
@@ -412,6 +424,61 @@ module Google
|
|
412
424
|
Table::RestoreJob.from_grpc grpc, service
|
413
425
|
end
|
414
426
|
|
427
|
+
##
|
428
|
+
# Creates a copy of the backup at the desired location. Copy of the backup won't be created
|
429
|
+
# if the backup is already a copied one.
|
430
|
+
#
|
431
|
+
# @param dest_project_id [String] Existing project ID. Copy of the backup
|
432
|
+
# will be created in this project. Required.
|
433
|
+
# @param dest_instance_id [Instance, String] Existing instance ID. Copy
|
434
|
+
# of the backup will be created in this instance. Required.
|
435
|
+
# @param dest_cluster_id [String] Existing cluster ID. Copy of the backup
|
436
|
+
# will be created in this cluster. Required.
|
437
|
+
# @param new_backup_id [String] The id of the copy of the backup to be created. This string must
|
438
|
+
# be between 1 and 50 characters in length and match the regex
|
439
|
+
# `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. Required.
|
440
|
+
# @param expire_time [Time] The expiration time of the copy of the backup, with microseconds
|
441
|
+
# granularity that must be at least 6 hours and at most 30 days from the time the request
|
442
|
+
# is received. Once the `expire_time` has passed, Cloud Bigtable will delete the backup
|
443
|
+
# and free the resources used by the backup. Required.
|
444
|
+
#
|
445
|
+
# @return [Google::Cloud::Bigtable::Backup::Job] The job representing the long-running, asynchronous
|
446
|
+
# processing of a copy backup operation.
|
447
|
+
#
|
448
|
+
# @example Create a copy of the backup at a specific location
|
449
|
+
# require "google/cloud/bigtable"
|
450
|
+
#
|
451
|
+
# bigtable = Google::Cloud::Bigtable.new
|
452
|
+
# instance = bigtable.instance "my-instance"
|
453
|
+
# cluster = instance.cluster "my-cluster"
|
454
|
+
#
|
455
|
+
# backup = cluster.backup "my-backup"
|
456
|
+
#
|
457
|
+
# job = backup.copy dest_project_id:"my-project-2",
|
458
|
+
# dest_instance_id:"my-instance-2",
|
459
|
+
# dest_cluster_id:"my-cluster-2",
|
460
|
+
# new_backup_id:"my-backup-2",
|
461
|
+
# expire_time: Time.now + 60 * 60 * 7
|
462
|
+
#
|
463
|
+
# job.wait_until_done!
|
464
|
+
# job.done? #=> true
|
465
|
+
#
|
466
|
+
# if job.error?
|
467
|
+
# status = job.error
|
468
|
+
# else
|
469
|
+
# backup = job.backup
|
470
|
+
# end
|
471
|
+
#
|
472
|
+
def copy dest_project_id:, dest_instance_id:, dest_cluster_id:, new_backup_id:, expire_time:
|
473
|
+
grpc = service.copy_backup project_id: dest_project_id,
|
474
|
+
instance_id: dest_instance_id,
|
475
|
+
cluster_id: dest_cluster_id,
|
476
|
+
backup_id: new_backup_id,
|
477
|
+
source_backup: service.backup_path(instance_id, cluster_id, backup_id),
|
478
|
+
expire_time: expire_time
|
479
|
+
Backup::Job.from_grpc grpc, service
|
480
|
+
end
|
481
|
+
|
415
482
|
##
|
416
483
|
# Updates the backup.
|
417
484
|
#
|
@@ -17,6 +17,13 @@
|
|
17
17
|
|
18
18
|
require "time"
|
19
19
|
require "date"
|
20
|
+
require "gapic/protobuf"
|
21
|
+
require "gapic/call_options"
|
22
|
+
require "gapic/headers"
|
23
|
+
require "google/cloud/bigtable/version"
|
24
|
+
require "google/cloud/bigtable/v2/version"
|
25
|
+
require "google/bigtable/v2/bigtable_pb"
|
26
|
+
require "google/cloud/bigtable/admin/v2"
|
20
27
|
|
21
28
|
module Google
|
22
29
|
module Cloud
|
@@ -89,6 +96,33 @@ module Google
|
|
89
96
|
return [value].pack "q>" if value.is_a? Integer
|
90
97
|
value
|
91
98
|
end
|
99
|
+
|
100
|
+
def ping_and_warm_request table_path, app_profile_id, timeout
|
101
|
+
request = {
|
102
|
+
name: table_path.split("/").slice(0, 4).join("/"),
|
103
|
+
app_profile_id: app_profile_id
|
104
|
+
}
|
105
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigtable::V2::PingAndWarmRequest
|
106
|
+
|
107
|
+
header_params = {}
|
108
|
+
if request.name && %r{^projects/[^/]+/instances/[^/]+/?$}.match?(request.name)
|
109
|
+
header_params["name"] = request.name
|
110
|
+
end
|
111
|
+
if request.app_profile_id && !request.app_profile_id.empty?
|
112
|
+
header_params["app_profile_id"] = request.app_profile_id
|
113
|
+
end
|
114
|
+
request_params_header = URI.encode_www_form header_params
|
115
|
+
metadata = {
|
116
|
+
"x-goog-request-params": request_params_header,
|
117
|
+
"x-goog-api-client":
|
118
|
+
::Gapic::Headers.x_goog_api_client(lib_name: "gccl",
|
119
|
+
lib_version: ::Google::Cloud::Bigtable::VERSION,
|
120
|
+
gapic_version: ::Google::Cloud::Bigtable::V2::VERSION),
|
121
|
+
"google-cloud-resource-prefix": "projects/#{table_path.split('/')[1]}"
|
122
|
+
}
|
123
|
+
options = ::Gapic::CallOptions.new timeout: timeout, metadata: metadata
|
124
|
+
[request, options]
|
125
|
+
end
|
92
126
|
end
|
93
127
|
end
|
94
128
|
end
|
@@ -521,15 +521,12 @@ module Google
|
|
521
521
|
ensure_service!
|
522
522
|
|
523
523
|
view ||= :SCHEMA_VIEW
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
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
|
@@ -343,15 +343,12 @@ module Google
|
|
343
343
|
ensure_service!
|
344
344
|
|
345
345
|
view ||= :SCHEMA_VIEW
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
table.app_profile_id = app_profile_id
|
354
|
-
table
|
346
|
+
if perform_lookup
|
347
|
+
grpc = service.get_table instance_id, table_id, view: view
|
348
|
+
Table.from_grpc grpc, service, view: view, app_profile_id: app_profile_id
|
349
|
+
else
|
350
|
+
Table.from_path service.table_path(instance_id, table_id), service, app_profile_id: app_profile_id
|
351
|
+
end
|
355
352
|
rescue Google::Cloud::NotFoundError
|
356
353
|
nil
|
357
354
|
end
|
@@ -457,6 +454,67 @@ module Google
|
|
457
454
|
true
|
458
455
|
end
|
459
456
|
|
457
|
+
##
|
458
|
+
# Creates a copy of the backup at the desired location. Copy of the backup won't be created
|
459
|
+
# if the backup is already a copied one.
|
460
|
+
#
|
461
|
+
# @param dest_project_id [String] Existing project ID. Copy of the backup
|
462
|
+
# will be created in this project. Required.
|
463
|
+
# @param dest_instance_id [Instance, String] Existing instance ID. Copy
|
464
|
+
# of the backup will be created in this instance. Required.
|
465
|
+
# @param dest_cluster_id [String] Existing cluster ID. Copy of the backup
|
466
|
+
# will be created in this cluster. Required.
|
467
|
+
# @param new_backup_id [String] The id of the copy of the backup to be created. This string must
|
468
|
+
# be between 1 and 50 characters in length and match the regex
|
469
|
+
# `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. Required.
|
470
|
+
# @param source_instance_id [String] Existing instance ID. Backup will be copied from this instance. Required.
|
471
|
+
# @param source_cluster_id [String] Existing cluster ID. Backup will be copied from this cluster. Required.
|
472
|
+
# @param source_backup_id [Instance, String] Existing backup ID. This backup will be copied. Required.
|
473
|
+
# @param expire_time [Time] The expiration time of the copy of the backup, with microseconds
|
474
|
+
# granularity that must be at least 6 hours and at most 30 days from the time the request
|
475
|
+
# is received. Once the `expire_time` has passed, Cloud Bigtable will delete the backup
|
476
|
+
# and free the resources used by the backup. Required.
|
477
|
+
#
|
478
|
+
# @return [Google::Cloud::Bigtable::Backup::Job] The job representing the long-running, asynchronous
|
479
|
+
# processing of a copy backup operation.
|
480
|
+
#
|
481
|
+
# @example Create a copy of the specified backup at a specific location
|
482
|
+
# require "google/cloud/bigtable"
|
483
|
+
#
|
484
|
+
# bigtable = Google::Cloud::Bigtable.new
|
485
|
+
#
|
486
|
+
# job = bigtable.copy_backup dest_project_id:"my-project-2",
|
487
|
+
# dest_instance_id:"my-instance-2",
|
488
|
+
# dest_cluster_id:"my-cluster-2",
|
489
|
+
# new_backup_id:"my-backup-2",
|
490
|
+
# source_instance_id:"my-instance",
|
491
|
+
# source_cluster_id:"my-cluster",
|
492
|
+
# source_backup_id:"my-backup",
|
493
|
+
# expire_time: Time.now + 60 * 60 * 7
|
494
|
+
#
|
495
|
+
# job.wait_until_done!
|
496
|
+
# job.done? #=> true
|
497
|
+
#
|
498
|
+
# if job.error?
|
499
|
+
# status = job.error
|
500
|
+
# else
|
501
|
+
# backup = job.backup
|
502
|
+
# end
|
503
|
+
#
|
504
|
+
def copy_backup dest_project_id:, dest_instance_id:, dest_cluster_id:, new_backup_id:,
|
505
|
+
source_instance_id:, source_cluster_id:, source_backup_id:, expire_time:
|
506
|
+
ensure_service!
|
507
|
+
grpc = service.copy_backup project_id: dest_project_id,
|
508
|
+
instance_id: dest_instance_id,
|
509
|
+
cluster_id: dest_cluster_id,
|
510
|
+
backup_id: new_backup_id,
|
511
|
+
source_backup: service.backup_path(source_instance_id,
|
512
|
+
source_cluster_id,
|
513
|
+
source_backup_id),
|
514
|
+
expire_time: expire_time
|
515
|
+
Backup::Job.from_grpc grpc, service
|
516
|
+
end
|
517
|
+
|
460
518
|
protected
|
461
519
|
|
462
520
|
# @private
|
@@ -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
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
@@ -649,7 +657,7 @@ 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(
|
660
|
+
client(table_path(instance_id, table_id), app_profile_id).read_rows(
|
653
661
|
**{
|
654
662
|
table_name: table_path(instance_id, table_id),
|
655
663
|
rows: rows,
|
@@ -661,11 +669,11 @@ module Google
|
|
661
669
|
end
|
662
670
|
|
663
671
|
def sample_row_keys table_name, app_profile_id: nil
|
664
|
-
client.sample_row_keys table_name: table_name, app_profile_id: app_profile_id
|
672
|
+
client(table_name, app_profile_id).sample_row_keys table_name: table_name, app_profile_id: app_profile_id
|
665
673
|
end
|
666
674
|
|
667
675
|
def mutate_row table_name, row_key, mutations, app_profile_id: nil
|
668
|
-
client.mutate_row(
|
676
|
+
client(table_name, app_profile_id).mutate_row(
|
669
677
|
**{
|
670
678
|
table_name: table_name,
|
671
679
|
app_profile_id: app_profile_id,
|
@@ -676,7 +684,7 @@ module Google
|
|
676
684
|
end
|
677
685
|
|
678
686
|
def mutate_rows table_name, entries, app_profile_id: nil
|
679
|
-
client.mutate_rows(
|
687
|
+
client(table_name, app_profile_id).mutate_rows(
|
680
688
|
**{
|
681
689
|
table_name: table_name,
|
682
690
|
app_profile_id: app_profile_id,
|
@@ -691,7 +699,7 @@ module Google
|
|
691
699
|
predicate_filter: nil,
|
692
700
|
true_mutations: nil,
|
693
701
|
false_mutations: nil
|
694
|
-
client.check_and_mutate_row(
|
702
|
+
client(table_name, app_profile_id).check_and_mutate_row(
|
695
703
|
**{
|
696
704
|
table_name: table_name,
|
697
705
|
app_profile_id: app_profile_id,
|
@@ -704,7 +712,7 @@ module Google
|
|
704
712
|
end
|
705
713
|
|
706
714
|
def read_modify_write_row table_name, row_key, rules, app_profile_id: nil
|
707
|
-
client.read_modify_write_row(
|
715
|
+
client(table_name, app_profile_id).read_modify_write_row(
|
708
716
|
**{
|
709
717
|
table_name: table_name,
|
710
718
|
app_profile_id: app_profile_id,
|
@@ -725,6 +733,19 @@ module Google
|
|
725
733
|
tables.create_backup parent: cluster_path(instance_id, cluster_id), backup_id: backup_id, backup: backup
|
726
734
|
end
|
727
735
|
|
736
|
+
##
|
737
|
+
# Starts copying the selected backup to the chosen location.
|
738
|
+
# The underlying Google::Longrunning::Operation tracks the copying of backup.
|
739
|
+
#
|
740
|
+
# @return [Gapic::Operation]
|
741
|
+
#
|
742
|
+
def copy_backup project_id:, instance_id:, cluster_id:, backup_id:, source_backup:, expire_time:
|
743
|
+
tables.copy_backup parent: "projects/#{project_id}/instances/#{instance_id}/clusters/#{cluster_id}",
|
744
|
+
backup_id: backup_id,
|
745
|
+
source_backup: source_backup,
|
746
|
+
expire_time: expire_time
|
747
|
+
end
|
748
|
+
|
728
749
|
##
|
729
750
|
# @return [Google::Cloud::Bigtable::Admin::V2::Backup]
|
730
751
|
#
|
@@ -872,6 +893,23 @@ module Google
|
|
872
893
|
def inspect
|
873
894
|
"#{self.class}(#{@project_id})"
|
874
895
|
end
|
896
|
+
|
897
|
+
def create_bigtable_client table_path, app_profile_id
|
898
|
+
V2::Bigtable::Client.new do |config|
|
899
|
+
config.credentials = credentials if credentials
|
900
|
+
config.timeout = timeout if timeout
|
901
|
+
config.endpoint = host if host
|
902
|
+
config.lib_name = "gccl"
|
903
|
+
config.lib_version = Google::Cloud::Bigtable::VERSION
|
904
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
|
905
|
+
config.channel_pool.channel_selection = @channel_selection
|
906
|
+
config.channel_pool.channel_count = @channel_count
|
907
|
+
request, options = Convert.ping_and_warm_request table_path, app_profile_id, timeout
|
908
|
+
config.channel_pool.on_channel_create = proc do |channel|
|
909
|
+
channel.call_rpc :ping_and_warm, request, options: options
|
910
|
+
end
|
911
|
+
end
|
912
|
+
end
|
875
913
|
end
|
876
914
|
end
|
877
915
|
end
|
@@ -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
|
##
|
@@ -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
|
@@ -63,6 +63,10 @@ module Google
|
|
63
63
|
# updater_proc is supplied.
|
64
64
|
# @param timeout [Integer]
|
65
65
|
# The default timeout, in seconds, for calls made through this client. Optional.
|
66
|
+
# @param channel_selection [Symbol] The algorithm for selecting a channel from the
|
67
|
+
# pool of available channels. This parameter can have the following symbols:
|
68
|
+
# * `:least_loaded` selects the channel having least number of concurrent streams.
|
69
|
+
# @param channel_count [Integer] The number of channels in the pool.
|
66
70
|
# @return [Google::Cloud::Bigtable::Project]
|
67
71
|
#
|
68
72
|
# @example
|
@@ -70,19 +74,25 @@ module Google
|
|
70
74
|
#
|
71
75
|
# client = Google::Cloud::Bigtable.new
|
72
76
|
#
|
77
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
78
|
+
# rubocop:disable Metrics/AbcSize
|
73
79
|
def self.new project_id: nil,
|
74
80
|
credentials: nil,
|
75
81
|
emulator_host: nil,
|
76
82
|
scope: nil,
|
77
83
|
endpoint: nil,
|
78
84
|
endpoint_admin: nil,
|
79
|
-
timeout: nil
|
80
|
-
|
81
|
-
|
82
|
-
|
85
|
+
timeout: nil,
|
86
|
+
channel_selection: nil,
|
87
|
+
channel_count: nil
|
88
|
+
project_id ||= default_project_id
|
89
|
+
scope ||= configure.scope
|
90
|
+
timeout ||= configure.timeout
|
83
91
|
emulator_host ||= configure.emulator_host
|
84
|
-
endpoint
|
92
|
+
endpoint ||= configure.endpoint
|
85
93
|
endpoint_admin ||= configure.endpoint_admin
|
94
|
+
channel_selection ||= configure.channel_selection
|
95
|
+
channel_count ||= configure.channel_count
|
86
96
|
|
87
97
|
return new_with_emulator project_id, emulator_host, timeout if emulator_host
|
88
98
|
|
@@ -90,10 +100,15 @@ module Google
|
|
90
100
|
project_id = resolve_project_id project_id, credentials
|
91
101
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
92
102
|
|
93
|
-
service = Bigtable::Service.new
|
94
|
-
|
103
|
+
service = Bigtable::Service.new project_id, credentials, host: endpoint,
|
104
|
+
host_admin: endpoint_admin, timeout: timeout,
|
105
|
+
channel_selection: channel_selection,
|
106
|
+
channel_count: channel_count
|
95
107
|
Bigtable::Project.new service
|
96
108
|
end
|
109
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
110
|
+
# rubocop:enable Metrics/AbcSize
|
111
|
+
|
97
112
|
|
98
113
|
##
|
99
114
|
# Configure the Google Cloud Bigtable library.
|
@@ -116,6 +131,10 @@ module Google
|
|
116
131
|
# to use the default endpoint.
|
117
132
|
# * `endpoint_admin` - (String) Override of the admin service endpoint
|
118
133
|
# host name, or `nil` to use the default admin endpoint.
|
134
|
+
# * `channel_selection` - (Symbol) The algorithm for selecting a channel from the
|
135
|
+
# pool of available channels. This parameter can have the following symbols:
|
136
|
+
# `:least_loaded` selects the channel having least number of concurrent streams.
|
137
|
+
# * `channel_count` - (Integer) The number of channels in the pool.
|
119
138
|
#
|
120
139
|
# @return [Google::Cloud::Config] The configuration object the
|
121
140
|
# Google::Cloud::Bigtable library uses.
|
@@ -171,4 +171,6 @@ Google::Cloud.configure.add_config! :bigtable do |config|
|
|
171
171
|
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
172
172
|
config.add_field! :endpoint, "bigtable.googleapis.com", match: String
|
173
173
|
config.add_field! :endpoint_admin, "bigtableadmin.googleapis.com", match: String
|
174
|
+
config.add_field! :channel_selection, :least_loaded, match: Symbol
|
175
|
+
config.add_field! :channel_count, 1, match: Integer
|
174
176
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: google-cloud-bigtable-admin-v2
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,14 +44,14 @@ dependencies:
|
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
47
|
+
version: '0.14'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
54
|
+
version: '0.14'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: google-cloud-core
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
263
|
- !ruby/object:Gem::Version
|
250
264
|
version: '0'
|
251
265
|
requirements: []
|
252
|
-
rubygems_version: 3.4.
|
266
|
+
rubygems_version: 3.4.19
|
253
267
|
signing_key:
|
254
268
|
specification_version: 4
|
255
269
|
summary: API Client library for Cloud Bigtable API
|