Sha256: aed8befe551768d5bb7abb82014c72b38fb9336bb8a2aeeccd593415b9bd5b26

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 ClientStreamer < 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_client_streamer.rb
grpc_kit-0.1.13 lib/grpc_kit/calls/server_client_streamer.rb
grpc_kit-0.1.12 lib/grpc_kit/calls/server_client_streamer.rb
grpc_kit-0.1.11 lib/grpc_kit/calls/server_client_streamer.rb
grpc_kit-0.1.10 lib/grpc_kit/calls/server_client_streamer.rb
grpc_kit-0.1.9 lib/grpc_kit/calls/server_client_streamer.rb