Class: Raptor::Reactor::TimeoutClient
- Inherits:
-
RedBlackTree::Node
- Object
- RedBlackTree::Node
- Raptor::Reactor::TimeoutClient
- Defined in:
- lib/raptor/reactor.rb
Overview
Red-black tree node representing a client connection with timeout tracking.
TimeoutClient extends RedBlackTree::Node to enable efficient timeout management using the tree’s ordering properties.
Instance Attribute Summary collapse
-
#timeout_at ⇒ Object
Returns the value of attribute timeout_at.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compares timeout nodes by their timeout_at values for tree ordering.
-
#client_data ⇒ Hash
Returns the client data stored in this timeout node.
-
#timeout(now) ⇒ Float
Calculates remaining timeout duration from the current time.
Instance Attribute Details
#timeout_at ⇒ Object
Returns the value of attribute timeout_at.
34 35 36 |
# File 'lib/raptor/reactor.rb', line 34 def timeout_at @timeout_at end |
Instance Method Details
#<=>(other) ⇒ Integer
Compares timeout nodes by their timeout_at values for tree ordering.
61 62 63 |
# File 'lib/raptor/reactor.rb', line 61 def <=>(other) timeout_at <=> other.timeout_at end |
#client_data ⇒ Hash
Returns the client data stored in this timeout node.
41 42 43 |
# File 'lib/raptor/reactor.rb', line 41 def client_data data end |
#timeout(now) ⇒ Float
Calculates remaining timeout duration from the current time.
51 52 53 |
# File 'lib/raptor/reactor.rb', line 51 def timeout(now) [timeout_at - now, 0].max end |