Class: OMQ::Routing::Gather
- Inherits:
-
Object
- Object
- OMQ::Routing::Gather
- Includes:
- FairRecv
- Defined in:
- lib/omq/routing/gather.rb
Overview
GATHER socket routing: fair-queue receive from SCATTER peers.
Instance Attribute Summary collapse
- #recv_queue ⇒ FairQueue readonly
Instance Method Summary collapse
- #connection_added(connection) ⇒ Object
- #connection_removed(connection) ⇒ Object
-
#enqueue(_parts) ⇒ Object
GATHER is read-only.
-
#initialize(engine) ⇒ Gather
constructor
A new instance of Gather.
-
#stop ⇒ Object
Stops all background tasks.
Constructor Details
#initialize(engine) ⇒ Gather
Returns a new instance of Gather.
12 13 14 15 16 |
# File 'lib/omq/routing/gather.rb', line 12 def initialize(engine) @engine = engine @recv_queue = FairQueue.new @tasks = [] end |
Instance Attribute Details
#recv_queue ⇒ FairQueue (readonly)
21 22 23 |
# File 'lib/omq/routing/gather.rb', line 21 def recv_queue @recv_queue end |
Instance Method Details
#connection_added(connection) ⇒ Object
25 26 27 |
# File 'lib/omq/routing/gather.rb', line 25 def connection_added(connection) add_fair_recv_connection(connection) end |
#connection_removed(connection) ⇒ Object
32 33 34 |
# File 'lib/omq/routing/gather.rb', line 32 def connection_removed(connection) @recv_queue.remove_queue(connection) end |
#enqueue(_parts) ⇒ Object
GATHER is read-only.
39 40 41 |
# File 'lib/omq/routing/gather.rb', line 39 def enqueue(_parts) raise "GATHER sockets cannot send" end |
#stop ⇒ Object
Stops all background tasks.
45 46 47 48 |
# File 'lib/omq/routing/gather.rb', line 45 def stop @tasks.each(&:stop) @tasks.clear end |