Sha256: b3d105c5c57a19a0a2828fe74617d7ed0489cbfa08b243b7d7039c269e6771ae

Contents?: true

Size: 871 Bytes

Versions: 6

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

require 'grpc_kit/rpcs'
require 'grpc_kit/calls/server_server_streamer'

module GrpcKit
  module Rpcs::Server
    class ServerStreamer < GrpcKit::Rpcs::ServerRpc
      # @param stream [GrpcKit::Stream::ServerStream]
      # @param metadata [Hash<String, String>]
      # @return [void]
      def invoke(stream, metadata: {})
        call = GrpcKit::Calls::Server::ServerStreamer.new(metadata: metadata, config: @config, stream: stream)

        if @config.interceptor
          @config.interceptor.intercept(call) do |c|
            request = c.recv(last: true)
            @handler.send(@config.ruby_style_method_name, request, c)
          end
        else
          request = call.recv(last: true)
          @handler.send(@config.ruby_style_method_name, request, call)
        end

        stream.send_status
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grpc_kit-0.1.14 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.13 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.12 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.11 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.10 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.9 lib/grpc_kit/rpcs/server_server_streamer.rb