Class: OMQ::Routing::Scatter

Inherits:
Object
  • Object
show all
Includes:
RoundRobin
Defined in:
lib/omq/routing/scatter.rb

Overview

SCATTER socket routing: round-robin send to GATHER peers.

Constant Summary

Constants included from RoundRobin

RoundRobin::BATCH_BYTE_CAP, RoundRobin::BATCH_MSG_CAP

Instance Method Summary collapse

Methods included from RoundRobin

#send_queues_drained?

Constructor Details

#initialize(engine) ⇒ Scatter

Returns a new instance of Scatter.

Parameters:



12
13
14
15
# File 'lib/omq/routing/scatter.rb', line 12

def initialize(engine)
  @engine = engine
  init_round_robin(engine)
end

Instance Method Details

#connection_added(connection) ⇒ Object

Parameters:

  • connection (Protocol::ZMTP::Connection)


38
39
40
41
# File 'lib/omq/routing/scatter.rb', line 38

def connection_added(connection)
  add_round_robin_send_connection(connection)
  start_reaper(connection)
end

#connection_removed(connection) ⇒ Object

Parameters:

  • connection (Protocol::ZMTP::Connection)


46
47
48
49
# File 'lib/omq/routing/scatter.rb', line 46

def connection_removed(connection)
  @connections.delete(connection)
  remove_round_robin_send_connection(connection)
end

#dequeue_recvObject



25
26
27
# File 'lib/omq/routing/scatter.rb', line 25

def dequeue_recv
  raise "SCATTER sockets cannot receive"
end

#enqueue(parts) ⇒ Object

Parameters:

  • parts (Array<String>)


54
55
56
# File 'lib/omq/routing/scatter.rb', line 54

def enqueue(parts)
  enqueue_round_robin(parts)
end

#recv_queueObject

SCATTER is write-only.



20
21
22
# File 'lib/omq/routing/scatter.rb', line 20

def recv_queue
  raise "SCATTER sockets cannot receive"
end

#unblock_recvObject

No-op; SCATTER has no recv queue to unblock.



32
33
# File 'lib/omq/routing/scatter.rb', line 32

def unblock_recv
end