Sha256: be368c9790ee7d1cc50b2631a8292c77b64c46c0262e7093e46adf54845f4c8d

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module GrpcKit
  module Session
    class ControlQueue
      def initialize
        @event_stream = Queue.new
      end

      # Be nonblocking
      def pop
        if @event_stream.empty?
          nil
        else
          @event_stream.pop(true)
        end
      rescue ThreadError => _
        nil
      end

      def submit_response(id, headers)
        @event_stream.push([:submit_response, id, headers])
      end

      def submit_headers(id, headers)
        @event_stream.push([:submit_headers, id, headers])
      end

      def resume_data(id)
        @event_stream.push([:resume_data, id])
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grpc_kit-0.3.9 lib/grpc_kit/session/control_queue.rb
grpc_kit-0.3.8 lib/grpc_kit/session/control_queue.rb
grpc_kit-0.3.7 lib/grpc_kit/session/control_queue.rb
grpc_kit-0.3.6 lib/grpc_kit/session/control_queue.rb
grpc_kit-0.3.5 lib/grpc_kit/session/control_queue.rb
grpc_kit-0.3.4 lib/grpc_kit/session/control_queue.rb