Class: Raptor::Reactor::Http1IO

Inherits:
ConnectionIO show all
Defined in:
lib/raptor/reactor.rb,
sig/generated/raptor/reactor.rbs

Overview

Tracks reactor-owned I/O state for an HTTP/1.x detached response.

Instance Attribute Summary collapse

Attributes inherited from ConnectionIO

#closing, #monitor, #offset, #output, #reading, #timeout, #wait

Instance Method Summary collapse

Constructor Details

#initialize(body, state) ⇒ Http1IO

Creates I/O state for an HTTP/1.x detached response.

Parameters:

  • body (DetachedBody) —

    the response body

  • state (Hash) —

    connection state restored after the response finishes



138
139
140
141
142
143
144
145
146
# File 'lib/raptor/reactor.rb', line 138

def initialize(body, state)
  super()
  @body = body
  @state = state
  @budget = DetachedBody::Budget.new(DETACHED_CONNECTION_BUFFER_SIZE)
  @input = String.new(encoding: Encoding::ASCII_8BIT)
  @reading = true
  @finishing = false
end

Instance Attribute Details

#body ⇒ Object

Returns the value of attribute body.

Returns:

  • (Object)


117
118
119
# File 'lib/raptor/reactor.rb', line 117

def body
  @body
end

#budget ⇒ Object (readonly)

Returns the value of attribute budget.

Returns:

  • (Object)


123
124
125
# File 'lib/raptor/reactor.rb', line 123

def budget
  @budget
end

#finishing ⇒ Object

Returns the value of attribute finishing.

Returns:

  • (Object)


120
121
122
# File 'lib/raptor/reactor.rb', line 120

def finishing
  @finishing
end

#input ⇒ Object (readonly)

Returns the value of attribute input.

Returns:

  • (Object)


126
127
128
# File 'lib/raptor/reactor.rb', line 126

def input
  @input
end

#state ⇒ Object (readonly)

Returns the value of attribute state.

Returns:

  • (Object)


129
130
131
# File 'lib/raptor/reactor.rb', line 129

def state
  @state
end

Instance Method Details

#empty? ⇒ Boolean

Returns whether the connection has no output or detached body remaining.

Returns:

  • (Boolean)


153
154
155
# File 'lib/raptor/reactor.rb', line 153

def empty?
  super && !body
end