Class: Protocol::HTTP2::Priority
- Inherits:
-
Struct
- Object
- Struct
- Protocol::HTTP2::Priority
- Defined in:
- lib/protocol/http2/priority_frame.rb
Overview
Stream Dependency: A 31-bit stream identifier for the stream that this stream depends on (see Section 5.3). This field is only present if the PRIORITY flag is set.
Constant Summary collapse
- FORMAT =
"NC".freeze
- EXCLUSIVE =
1 << 31
Instance Attribute Summary collapse
-
#exclusive ⇒ Object
Returns the value of attribute exclusive.
-
#stream_dependency ⇒ Object
Returns the value of attribute stream_dependency.
-
#weight ⇒ Object
Returns the value of attribute weight.
Class Method Summary collapse
-
.default(stream_dependency = 0, weight = 16) ⇒ Object
All streams are initially assigned a non-exclusive dependency on stream 0x0.
- .unpack(data) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#exclusive ⇒ Object
Returns the value of attribute exclusive
30 31 32 |
# File 'lib/protocol/http2/priority_frame.rb', line 30 def exclusive @exclusive end |
#stream_dependency ⇒ Object
Returns the value of attribute stream_dependency
30 31 32 |
# File 'lib/protocol/http2/priority_frame.rb', line 30 def stream_dependency @stream_dependency end |
#weight ⇒ Object
Returns the value of attribute weight
30 31 32 |
# File 'lib/protocol/http2/priority_frame.rb', line 30 def weight @weight end |
Class Method Details
.default(stream_dependency = 0, weight = 16) ⇒ Object
All streams are initially assigned a non-exclusive dependency on stream 0x0. Pushed streams (Section 8.2) initially depend on their associated stream. In both cases, streams are assigned a default weight of 16.
35 36 37 |
# File 'lib/protocol/http2/priority_frame.rb', line 35 def self.default(stream_dependency = 0, weight = 16) self.new(false, stream_dependency, weight) end |
.unpack(data) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/protocol/http2/priority_frame.rb', line 39 def self.unpack(data) stream_dependency, weight = data.unpack(FORMAT) # Weight: An unsigned 8-bit integer representing a priority weight for the stream (see Section 5.3). Add one to the value to obtain a weight between 1 and 256. This field is only present if the PRIORITY flag is set. return self.new(stream_dependency & EXCLUSIVE != 0, stream_dependency & ~EXCLUSIVE, weight + 1) end |