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.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/id_service/server.rb', line 14

def initialize(options = {})
  options.symbolize_keys!
  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.



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

def debug
  @debug
end

#hostObject (readonly)

Returns the value of attribute host.



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

def host
  @host
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

#workerObject (readonly)

Returns the value of attribute worker.



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

def worker
  @worker
end