Class: Miu::Nodes::Sana::Node

Inherits:
Object
  • Object
show all
Includes:
Miu::Node
Defined in:
lib/miu/nodes/sana/node.rb

Constant Summary collapse

DEFAULT_PORT =
Miu.default_port + 37

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Node

Returns a new instance of Node.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/miu/nodes/sana/node.rb', line 20

def initialize(options)
  @options = options

  Miu::Logger.info "Options:"
  @options.each do |k, v|
    Miu::Logger.info "  #{k}: #{v}"
  end

  establish options[:database]

  @server = Server.new options[:bind], options[:port]
  @subscriber = Subscriber.new options['sub-host'], options['sub-port'], options['sub-tag']
  @subscriber.async.run

  [:INT, :TERM].each do |sig|
    trap(sig) { exit }
  end

  sleep
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/miu/nodes/sana/node.rb', line 18

def options
  @options
end

#serverObject (readonly)

Returns the value of attribute server.



17
18
19
# File 'lib/miu/nodes/sana/node.rb', line 17

def server
  @server
end

#subscriberObject (readonly)

Returns the value of attribute subscriber.



17
18
19
# File 'lib/miu/nodes/sana/node.rb', line 17

def subscriber
  @subscriber
end