Class: TestServerInterceptor

Inherits:
GRPC::ServerInterceptor show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/support/services.rb

Overview

For testing server interceptors

Instance Method Summary collapse

Methods inherited from GRPC::Interceptor

#initialize

Constructor Details

This class inherits a constructor from GRPC::Interceptor

Instance Method Details

#bidi_streamer(requests:, call:, method:) ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/support/services.rb', line 110

def bidi_streamer(requests:, call:, method:)
  requests.each do |r|
    GRPC.logger.info("Bidi request: #{r}")
  end
  GRPC.logger.info("Received bidi streamer call at method #{method} with requests" \
    " #{requests} for call #{call}")
  call.[:interc] = 'from_bidi_streamer'
  yield
end

#client_streamer(call:, method:) ⇒ Object



92
93
94
95
96
97
98
99
100
101
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/support/services.rb', line 92

def client_streamer(call:, method:)
  call.[:interc] = 'from_client_streamer'
  call.each_remote_read.each do |r|
    GRPC.logger.info("In interceptor: #{r}")
  end
  GRPC.logger.info(
    "Received client streamer call at method #{method} for call #{call}"
  )
  yield
end

#request_response(request:, call:, method:) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/support/services.rb', line 84

def request_response(request:, call:, method:)
  GRPC.logger.info("Received request/response call at method #{method}" \
    " with request #{request} for call #{call}")
  call.[:interc] = 'from_request_response'
  GRPC.logger.info("[GRPC::Ok] (#{method.owner.name}.#{method.name})")
  yield
end

#server_streamer(request:, call:, method:) ⇒ Object



103
104
105
106
107
108
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/support/services.rb', line 103

def server_streamer(request:, call:, method:)
  GRPC.logger.info("Received server streamer call at method #{method} with request" \
    " #{request} for call #{call}")
  call.[:interc] = 'from_server_streamer'
  yield
end