Class: IdService::Server

Inherits:
Thrift::SimpleServer
  • Object
show all
Defined in:
lib/id_service/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/id_service/server.rb', line 15

def initialize(options = {})
  options.symbolize_keys!
                                          \

  unless options[:config].nil?
    options = parse_config(options[:config]).merge(options)
  end

  options = default_options.merge(options)

  options.each { |key, value| instance_variable_set('@' + key.to_s, value) }

  @handler = IdGenerator.new(options)
  @processor = IdService::Processor.new(@handler)
  @server_transport = Thrift::ServerSocket.new(options[:hostname], options[:port].to_s)
  @transport_factory = Thrift::BufferedTransportFactory.new()
  @protocol_factory = Thrift::BinaryProtocolFactory.new
end

Instance Attribute Details

#debugObject (readonly)

Returns the value of attribute debug.



13
14
15
# File 'lib/id_service/server.rb', line 13

def debug
  @debug
end

#hostObject (readonly)

Returns the value of attribute host.



13
14
15
# File 'lib/id_service/server.rb', line 13

def host
  @host
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



13
14
15
# File 'lib/id_service/server.rb', line 13

def hostname
  @hostname
end

#portObject (readonly)

Returns the value of attribute port.



13
14
15
# File 'lib/id_service/server.rb', line 13

def port
  @port
end

#workerObject (readonly)

Returns the value of attribute worker.



13
14
15
# File 'lib/id_service/server.rb', line 13

def worker
  @worker
end