Module: Google::Cloud::Bigtable

Defined in:
lib/google/cloud/bigtable.rb,
lib/google/cloud/bigtable/row.rb,
lib/google/cloud/bigtable/table.rb,
lib/google/cloud/bigtable/backup.rb,
lib/google/cloud/bigtable/errors.rb,
lib/google/cloud/bigtable/policy.rb,
lib/google/cloud/bigtable/status.rb,
lib/google/cloud/bigtable/cluster.rb,
lib/google/cloud/bigtable/convert.rb,
lib/google/cloud/bigtable/gc_rule.rb,
lib/google/cloud/bigtable/project.rb,
lib/google/cloud/bigtable/service.rb,
lib/google/cloud/bigtable/version.rb,
lib/google/cloud/bigtable/instance.rb,
lib/google/cloud/bigtable/row_range.rb,
lib/google/cloud/bigtable/backup/job.rb,
lib/google/cloud/bigtable/row_filter.rb,
lib/google/cloud/bigtable/table/list.rb,
lib/google/cloud/bigtable/app_profile.rb,
lib/google/cloud/bigtable/backup/list.rb,
lib/google/cloud/bigtable/cluster/job.rb,
lib/google/cloud/bigtable/credentials.rb,
lib/google/cloud/bigtable/rows_reader.rb,
lib/google/cloud/bigtable/value_range.rb,
lib/google/cloud/bigtable/cluster/list.rb,
lib/google/cloud/bigtable/column_range.rb,
lib/google/cloud/bigtable/instance/job.rb,
lib/google/cloud/bigtable/rows_mutator.rb,
lib/google/cloud/bigtable/column_family.rb,
lib/google/cloud/bigtable/instance/list.rb,
lib/google/cloud/bigtable/mutation_entry.rb,
lib/google/cloud/bigtable/routing_policy.rb,
lib/google/cloud/bigtable/sample_row_key.rb,
lib/google/cloud/bigtable/app_profile/job.rb,
lib/google/cloud/bigtable/chunk_processor.rb,
lib/google/cloud/bigtable/encryption_info.rb,
lib/google/cloud/bigtable/longrunning_job.rb,
lib/google/cloud/bigtable/read_operations.rb,
lib/google/cloud/bigtable/app_profile/list.rb,
lib/google/cloud/bigtable/column_family_map.rb,
lib/google/cloud/bigtable/table/restore_job.rb,
lib/google/cloud/bigtable/mutation_operations.rb,
lib/google/cloud/bigtable/table/cluster_state.rb,
lib/google/cloud/bigtable/instance/cluster_map.rb,
lib/google/cloud/bigtable/read_modify_write_rule.rb,
lib/google/cloud/bigtable/row_filter/chain_filter.rb,
lib/google/cloud/bigtable/row_filter/simple_filter.rb,
lib/google/cloud/bigtable/row_filter/condition_filter.rb,
lib/google/cloud/bigtable/row_filter/interleave_filter.rb

Overview

Cloud Bigtable

See Bigtable Overview.

Defined Under Namespace

Modules: MutationOperations, ReadOperations, RowFilter Classes: AppProfile, Backup, Cluster, ColumnFamily, ColumnFamilyMap, ColumnRange, Credentials, EncryptionInfo, GcRule, Instance, InvalidRowStateError, LongrunningJob, MultiClusterRoutingUseAny, MutationEntry, Policy, Project, ReadModifyWriteRule, RoutingPolicy, Row, RowFilterError, RowRange, SampleRowKey, SingleClusterRouting, Status, Table, ValueRange

Constant Summary collapse

VERSION =
"2.11.0".freeze

Class Method Summary collapse

Class Method Details

.configure {|Google::Cloud.configure.bigtable| ... } ⇒ Google::Cloud::Config

Configure the Google Cloud Bigtable library.

The following Bigtable configuration parameters are supported:

  • project_id - (String) Identifier for a Bigtable project. (The parameter project is considered deprecated, but may also be used.)
  • credentials - (String, Hash, Google::Auth::Credentials, GRPC::Core::Channel, GRPC::Core::ChannelCredentials) The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Credentials) (The parameter keyfile is considered deprecated, but may also be used.)
  • scope - (String, Array) The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access.
  • quota_project - (String) The project ID for a project that can be used by client libraries for quota and billing purposes.
  • timeout - (Integer) Default timeout to use in requests.
  • endpoint - (String) Override of the endpoint host name, or nil to use the default endpoint.
  • endpoint_admin - (String) Override of the admin service endpoint host name, or nil to use the default admin endpoint.
  • channel_selection - (Symbol) The algorithm for selecting a channel from the pool of available channels. This parameter can have the following symbols: :least_loaded selects the channel having least number of concurrent streams.
  • channel_count - (Integer) The number of channels in the pool.

Yields:

Returns:

  • (Google::Cloud::Config)

    The configuration object the Google::Cloud::Bigtable library uses.



142
143
144
145
146
# File 'lib/google/cloud/bigtable.rb', line 142

def self.configure
  yield Google::Cloud.configure.bigtable if block_given?

  Google::Cloud.configure.bigtable
end

.new(project_id: nil, credentials: nil, emulator_host: nil, scope: nil, endpoint: nil, endpoint_admin: nil, timeout: nil, channel_selection: nil, channel_count: nil) ⇒ Google::Cloud::Bigtable::Project

Service for managing Cloud Bigtable instances and tables and for reading from and writing to Bigtable tables.

rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/AbcSize

Examples:

require "google/cloud/bigtable"

client = Google::Cloud::Bigtable.new

Parameters:

  • project_id (String) (defaults to: nil)

    Project identifier for the Bigtable service you are connecting to. If not present, the default project for the credentials is used.

  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc) (defaults to: nil)

    Provides the means for authenticating requests made by the client. This parameter can be one of the following types: Google::Auth::Credentials uses the properties of its represented keyfile for authenticating requests made by this client. String will be treated as the path to the keyfile to use to construct credentials for this client. Hash will be treated as the contents of a keyfile to use to construct credentials for this client. GRPC::Core::Channel will be used to make calls through. GRPC::Core::ChannelCredentials for the setting up the gRPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. Proc will be used as an updater_proc for the gRPC channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.

  • endpoint (String) (defaults to: nil)

    Override of the endpoint host name. Optional. If the param is nil, uses the default endpoint.

  • endpoint_admin (String) (defaults to: nil)

    Override of the admin service endpoint host name. Optional. If the param is nil, uses the default admin endpoint.

  • emulator_host (String) (defaults to: nil)

    Bigtable emulator host. Optional. If the parameter is nil, uses the value of the emulator_host config.

  • scope (Array<String>) (defaults to: nil)

    The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See Using OAuth 2.0 to Access Google APIs. The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.

  • timeout (Integer) (defaults to: nil)

    The default timeout, in seconds, for calls made through this client. Optional.

  • channel_selection (Symbol) (defaults to: nil)

    The algorithm for selecting a channel from the pool of available channels. This parameter can have the following symbols:

    • :least_loaded selects the channel having least number of concurrent streams.
  • channel_count (Integer) (defaults to: nil)

    The number of channels in the pool.

Returns:

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/google/cloud/bigtable.rb', line 79

def self.new project_id: nil,
             credentials: nil,
             emulator_host: nil,
             scope: nil,
             endpoint: nil,
             endpoint_admin: nil,
             timeout: nil,
             channel_selection: nil,
             channel_count: nil
  project_id ||= default_project_id
  scope ||= configure.scope
  timeout ||= configure.timeout
  emulator_host ||= configure.emulator_host
  endpoint ||= configure.endpoint
  endpoint_admin ||= configure.endpoint_admin
  channel_selection ||= configure.channel_selection
  channel_count ||= configure.channel_count

  return new_with_emulator project_id, emulator_host, timeout if emulator_host

  credentials = resolve_credentials credentials, scope
  project_id = resolve_project_id project_id, credentials
  raise ArgumentError, "project_id is missing" if project_id.empty?

  service = Bigtable::Service.new project_id, credentials, host: endpoint,
                                  host_admin: endpoint_admin, timeout: timeout,
                                  channel_selection: channel_selection,
                                  channel_count: channel_count
  Bigtable::Project.new service
end