lib/google/cloud/spanner/v1/spanner_client.rb in google-cloud-spanner-1.6.1 vs lib/google/cloud/spanner/v1/spanner_client.rb in google-cloud-spanner-1.6.2
- old
+ new
@@ -17,10 +17,11 @@
# https://github.com/googleapis/googleapis/blob/master/google/spanner/v1/spanner.proto,
# and updates to that file get reflected here through a refresh process.
# For the short term, the refresh process will only be runnable by Google
# engineers.
+
require "json"
require "pathname"
require "google/gax"
@@ -37,10 +38,11 @@
# transactions on data stored in Cloud Spanner databases.
#
# @!attribute [r] spanner_stub
# @return [Google::Spanner::V1::Spanner::Stub]
class SpannerClient
+ # @private
attr_reader :spanner_stub
# The default address of the service.
SERVICE_ADDRESS = "spanner.googleapis.com".freeze
@@ -314,13 +316,13 @@
# @yieldparam result [Google::Spanner::V1::Session]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::Session]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_database = Google::Cloud::Spanner::V1::SpannerClient.database_path("[PROJECT]", "[INSTANCE]", "[DATABASE]")
# response = spanner_client.create_session(formatted_database)
def create_session \
database,
@@ -348,13 +350,13 @@
# @yieldparam result [Google::Spanner::V1::Session]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::Session]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_name = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
# response = spanner_client.get_session(formatted_name)
def get_session \
name,
@@ -399,13 +401,13 @@
# See Google::Gax::PagedEnumerable documentation for other
# operations such as per-page iteration or access to the response
# object.
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_database = Google::Cloud::Spanner::V1::SpannerClient.database_path("[PROJECT]", "[INSTANCE]", "[DATABASE]")
#
# # Iterate over all results.
# spanner_client.list_sessions(formatted_database).each do |element|
# # Process element.
@@ -444,13 +446,13 @@
# @yield [result, operation] Access the result along with the RPC operation
# @yieldparam result []
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_name = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
# spanner_client.delete_session(formatted_name)
def delete_session \
name,
@@ -536,13 +538,13 @@
# @yieldparam result [Google::Spanner::V1::ResultSet]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::ResultSet]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +sql+:
# sql = ''
# response = spanner_client.execute_sql(formatted_session, sql)
@@ -637,13 +639,13 @@
# @return [Enumerable<Google::Spanner::V1::PartialResultSet>]
# An enumerable of Google::Spanner::V1::PartialResultSet instances.
#
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +sql+:
# sql = ''
# spanner_client.execute_streaming_sql(formatted_session, sql).each do |element|
@@ -742,13 +744,13 @@
# @yieldparam result [Google::Spanner::V1::ResultSet]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::ResultSet]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +table+:
# table = ''
#
@@ -845,13 +847,13 @@
# @return [Enumerable<Google::Spanner::V1::PartialResultSet>]
# An enumerable of Google::Spanner::V1::PartialResultSet instances.
#
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +table+:
# table = ''
#
@@ -908,13 +910,13 @@
# @yieldparam result [Google::Spanner::V1::Transaction]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::Transaction]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +options_+:
# options_ = {}
# response = spanner_client.begin_transaction(formatted_session, options_)
@@ -970,13 +972,13 @@
# @yieldparam result [Google::Spanner::V1::CommitResponse]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::CommitResponse]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +mutations+:
# mutations = []
# response = spanner_client.commit(formatted_session, mutations)
@@ -1017,13 +1019,13 @@
# @yield [result, operation] Access the result along with the RPC operation
# @yieldparam result []
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +transaction_id+:
# transaction_id = ''
# spanner_client.rollback(formatted_session, transaction_id)
@@ -1104,13 +1106,13 @@
# @yieldparam result [Google::Spanner::V1::PartitionResponse]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::PartitionResponse]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +sql+:
# sql = ''
# response = spanner_client.partition_query(formatted_session, sql)
@@ -1182,12 +1184,12 @@
# @yieldparam result [Google::Spanner::V1::PartitionResponse]
# @yieldparam operation [GRPC::ActiveCall::Operation]
# @return [Google::Spanner::V1::PartitionResponse]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
- # require "google/cloud/spanner"
+ # require "google/cloud/spanner/v1"
#
- # spanner_client = Google::Cloud::Spanner.new(version: :v1)
+ # spanner_client = Google::Cloud::Spanner::V1::SpannerClient.new
# formatted_session = Google::Cloud::Spanner::V1::SpannerClient.session_path("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]")
#
# # TODO: Initialize +table+:
# table = ''
#