Class: NNQ::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/nnq/options.rb

Overview

Per-socket configuration. Deliberately tiny — no conflate, no heartbeat command (nng uses TCP keepalive instead). New options should match nng socket option names where they exist (‘recv_max_size`, `reconnect_time`, `send_buf`, etc.).

‘send_hwm` bounds *one shared queue per socket*, not per peer. See DESIGN.md “Per-socket HWM”.

Constant Summary collapse

DEFAULT_HWM =
1000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(linger: Float::INFINITY, send_hwm: DEFAULT_HWM) ⇒ Options

Returns a new instance of Options.

Parameters:

  • linger (Numeric) (defaults to: Float::INFINITY)

    linger period in seconds on close (default Float::INFINITY = wait forever, matching libzmq). Pass 0 for immediate drop-on-close.



27
28
29
30
31
32
33
34
35
# File 'lib/nnq/options.rb', line 27

def initialize(linger: Float::INFINITY, send_hwm: DEFAULT_HWM)
  @linger             = linger
  @read_timeout       = nil
  @write_timeout      = nil
  @reconnect_interval = 0.1
  @max_message_size   = nil
  @send_hwm           = send_hwm
  @survey_time        = 1.0
end

Instance Attribute Details

#lingerObject

Returns the value of attribute linger.



15
16
17
# File 'lib/nnq/options.rb', line 15

def linger
  @linger
end

#max_message_sizeObject

Returns the value of attribute max_message_size.



19
20
21
# File 'lib/nnq/options.rb', line 19

def max_message_size
  @max_message_size
end

#read_timeoutObject

Returns the value of attribute read_timeout.



16
17
18
# File 'lib/nnq/options.rb', line 16

def read_timeout
  @read_timeout
end

#reconnect_intervalObject

Returns the value of attribute reconnect_interval.



18
19
20
# File 'lib/nnq/options.rb', line 18

def reconnect_interval
  @reconnect_interval
end

#send_hwmObject

Returns the value of attribute send_hwm.



20
21
22
# File 'lib/nnq/options.rb', line 20

def send_hwm
  @send_hwm
end

#survey_timeObject

Returns the value of attribute survey_time.



21
22
23
# File 'lib/nnq/options.rb', line 21

def survey_time
  @survey_time
end

#write_timeoutObject

Returns the value of attribute write_timeout.



17
18
19
# File 'lib/nnq/options.rb', line 17

def write_timeout
  @write_timeout
end