Class: Google::Cloud::Spanner::RequestIdInterceptor

Inherits:
GRPC::ClientInterceptor
  • Object
show all
Defined in:
lib/google/cloud/spanner/request_id_interceptor.rb

Overview

RequestIdInterceptor is a GRPC interceptor class that captures all the rpc calls made by the GRPC layer inserting a new Header with a specific ID for debugging purposes.

Instance Method Summary collapse

Constructor Details

#initialize(process_id: nil) ⇒ Google::Cloud::Spanner::RequestIdInterceptor

Initializes a request_id_interceptor instance.

Parameters:

  • process_id (String, int) (defaults to: nil)

    A 64 bit value in Hex or Integer format



89
90
91
92
93
94
95
96
97
# File 'lib/google/cloud/spanner/request_id_interceptor.rb', line 89

def initialize process_id: nil
  super
  @version = 1
  @process_id = self.class.send :get_process_id, process_id
  @client_id = self.class.send :next_client_id
  @channel_id = self.class.send :next_channel_id
  @request_id_counter = 0
  @request_mutex = Mutex.new
end

Instance Method Details

#bidi_streamer(method:, request:, call:, metadata:, &block) ⇒ void

This method returns an undefined value.

Intercepts a bidi_streamer rpc call

Parameters:

  • method (String)

    The RPC method name

  • request (Google::Protobuf::MessageExts)

    The request to be sent to the RPC call

  • call (GRPC::ActiveCall::InterceptableView)

    An interceptable view object for the call class

  • metadata (Hash)

    The metadata to be sent to the RPC call



151
152
153
154
155
156
157
# File 'lib/google/cloud/spanner/request_id_interceptor.rb', line 151

def bidi_streamer method:, request:, call:, metadata:, &block
  # Unused. This is to avoid Rubocop's Lint/UnusedMethodArgument
  _method = method
  _request = request
  _call = call
   , &block
end

#client_streamer(method:, request:, call:, metadata:, &block) ⇒ void

This method returns an undefined value.

Intercepts a client_streamer rpc call

Parameters:

  • method (String)

    The RPC method name

  • request (Google::Protobuf::MessageExts)

    The request to be sent to the RPC call

  • call (GRPC::ActiveCall::InterceptableView)

    An interceptable view object for the call class

  • metadata (Hash)

    All the metadata to be sent to the RPC call



121
122
123
124
125
126
127
# File 'lib/google/cloud/spanner/request_id_interceptor.rb', line 121

def client_streamer method:, request:, call:, metadata:, &block
  # Unused. This is to avoid Rubocop's Lint/UnusedMethodArgument
  _method = method
  _request = request
  _call = call
   , &block
end

#request_response(method:, request:, call:, metadata:, &block) ⇒ void

This method returns an undefined value.

Intercepts a request_response rpc call

Parameters:

  • method (String)

    The RPC method name

  • request (Google::Protobuf::MessageExts)

    The request to be sent to the RPC call

  • call (GRPC::ActiveCall::InterceptableView)

    An interceptable view object for the call class

  • metadata (Hash)

    All the metadata to be sent to the RPC call



106
107
108
109
110
111
112
# File 'lib/google/cloud/spanner/request_id_interceptor.rb', line 106

def request_response method:, request:, call:, metadata:, &block
  # Unused. This is to avoid Rubocop's Lint/UnusedMethodArgument
  _method = method
  _request = request
  _call = call
   , &block
end

#server_streamer(method:, request:, call:, metadata:, &block) ⇒ void

This method returns an undefined value.

Intercepts a server_streamer rpc call

Parameters:

  • method (String)

    The RPC method name

  • request (Google::Protobuf::MessageExts)

    The request to be sent to the RPC call

  • call (GRPC::ActiveCall::InterceptableView)

    An interceptable view object for the call class

  • metadata (Hash)

    All the metadata to be sent to the RPC call



136
137
138
139
140
141
142
# File 'lib/google/cloud/spanner/request_id_interceptor.rb', line 136

def server_streamer method:, request:, call:, metadata:, &block
  # Unused. This is to avoid Rubocop's Lint/UnusedMethodArgument
  _method = method
  _request = request
  _call = call
   , &block
end