Class: Raptor::Reactor::TimeoutClient
- Inherits:
-
RedBlackTree::Node
- Object
- RedBlackTree::Node
- Raptor::Reactor::TimeoutClient
- Defined in:
- lib/raptor/reactor.rb
Overview
A client connection node ordered by absolute expiry time so the soonest-to-expire is always at the tree’s minimum.
Instance Attribute Summary collapse
-
#timeout_at ⇒ Object
Returns the value of attribute timeout_at.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Orders nodes by ‘timeout_at` so the tree minimum is the next client to expire.
-
#client_data ⇒ Hash
Semantic alias for the inherited ‘data` slot.
-
#timeout(now) ⇒ Float
Returns seconds until expiry, clamped to 0 so an already-expired client doesn’t push the next selector wait into the future.
Instance Attribute Details
#timeout_at ⇒ Object
Returns the value of attribute timeout_at.
32 33 34 |
# File 'lib/raptor/reactor.rb', line 32 def timeout_at @timeout_at end |
Instance Method Details
#<=>(other) ⇒ Integer
Orders nodes by ‘timeout_at` so the tree minimum is the next client to expire.
61 62 63 |
# File 'lib/raptor/reactor.rb', line 61 def <=>(other) timeout_at <=> other.timeout_at end |
#client_data ⇒ Hash
Semantic alias for the inherited ‘data` slot.
39 40 41 |
# File 'lib/raptor/reactor.rb', line 39 def client_data data end |
#timeout(now) ⇒ Float
Returns seconds until expiry, clamped to 0 so an already-expired client doesn’t push the next selector wait into the future.
50 51 52 |
# File 'lib/raptor/reactor.rb', line 50 def timeout(now) [timeout_at - now, 0].max end |