Sha256: e700d4d718b6896d405966ba4b77cd61c28cc6dbb8f958a4f5ab316505b597d1

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'grpc_kit/calls'

module GrpcKit
  module Calls::Server
    class BidiStreamer < GrpcKit::Calls::Call
      attr_reader :outgoing_initial_metadata, :outgoing_trailing_metadata
      alias incoming_metadata metadata

      def initialize(*)
        super

        @outgoing_initial_metadata = {}
        @outgoing_trailing_metadata = {}
      end

      # @param data [Object] request message
      # @param last [Boolean]
      # @return [void]
      def send_msg(data, last: false)
        raise 'No method error' if @restrict

        @stream.send_msg(
          data,
          @protobuf,
          last: last,
          initial_metadata: @outgoing_initial_metadata,
          trailing_metadata: @outgoing_trailing_metadata,
          limit_size: @config.max_send_message_size,
        )
      end

      # @param last [Boolean]
      # @return [Object] response object
      def recv(last: false)
        raise 'No method error' if @restrict

        @stream.recv_msg(@protobuf, last: last, limit_size: @config.max_receive_message_size)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grpc_kit-0.1.14 lib/grpc_kit/calls/server_bidi_streamer.rb
grpc_kit-0.1.13 lib/grpc_kit/calls/server_bidi_streamer.rb
grpc_kit-0.1.12 lib/grpc_kit/calls/server_bidi_streamer.rb
grpc_kit-0.1.11 lib/grpc_kit/calls/server_bidi_streamer.rb
grpc_kit-0.1.10 lib/grpc_kit/calls/server_bidi_streamer.rb
grpc_kit-0.1.9 lib/grpc_kit/calls/server_bidi_streamer.rb