class RedisClient::RubyConnection::BufferedIO

def fill_buffer(strict, size = @chunk_size)

Experimental RBS support (using type sampling data from the type_fusion project).

def fill_buffer: (true strict, ?Integer size) -> untyped

This signature was generated using 1 sample from 1 application.

def fill_buffer(strict, size = @chunk_size)
  remaining = size
  empty_buffer = @offset >= @buffer.bytesize
  loop do
    bytes = if empty_buffer
      @io.read_nonblock([remaining, @chunk_size].max, @buffer, exception: false)
    else
      @io.read_nonblock([remaining, @chunk_size].max, exception: false)
    end
    case bytes
    when String
      if empty_buffer
        @offset = 0
        empty_buffer = false
      else
        @buffer << bytes
      end
      remaining -= bytes.bytesize
      return if !strict || remaining <= 0
    when :wait_readable
      unless @io.to_io.wait_readable(@read_timeout)
        raise ReadTimeoutError, "Waited #{@read_timeout} seconds" unless @blocking_reads
      end
    when :wait_writable
      @io.to_io.wait_writable(@write_timeout) or raise(WriteTimeoutError, "Waited #{@write_timeout} seconds")
    when nil
      raise EOFError
    else
      raise "Unexpected `read_nonblock` return: #{bytes.inspect}"
    end
  end
end