Sha256: cb0c00129674beea27ee88d90957e44d60861c37039d2279b2a10831fb564026

Contents?: true

Size: 894 Bytes

Versions: 6

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

module ProconBypassMan
  module ExternalInput
    class ParseError < StandardError; end

    # @return [Array<ProconBypassMan::ExternalInput::Channels::Base>]
    def self.channels
      @@channels ||= ProconBypassMan.config.external_input_channels
    end

    def self.shutdown
      channels.each(&:shutdown)
    end

    # @return [NilClass, String]
    # NOTE: 外部入力からのreadがボトルネックになるなら、Concurrent::Futureを使ってプロコンからの読み出しと並列化することを検討する
    def self.read
      value = nil
      channels.each do |channel|
        value = channel.read
        break if value
      end
      value
    end
  end
end

require "procon_bypass_man/external_input/external_data"
require "procon_bypass_man/external_input/channels.rb"
require "procon_bypass_man/external_input/boot_message"

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/external_input.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/external_input.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/external_input.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/external_input.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/external_input.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/external_input.rb