Class Thrift::EventMachineTransport
In: lib/thrift_client/event_machine.rb
lib/thrift_client/event_machine.rb
Parent: BaseTransport

Methods

close   close   new   new   open   open   open?   open?   read   read   write   write  

Public Class methods

[Source]

    # File lib/thrift_client/event_machine.rb, line 10
10:     def initialize(host, port=9090, timeout=5)
11:       @host, @port, @timeout = host, port, timeout
12:       @connection = nil
13:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 10
10:     def initialize(host, port=9090, timeout=5)
11:       @host, @port, @timeout = host, port, timeout
12:       @connection = nil
13:     end

Public Instance methods

[Source]

    # File lib/thrift_client/event_machine.rb, line 34
34:     def close
35:       @connection.close
36:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 34
34:     def close
35:       @connection.close
36:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 19
19:     def open
20:       fiber = Fiber.current
21:       @connection = EventMachineConnection.connect(@host, @port, @timeout)
22:       @connection.callback do
23:         fiber.resume
24:       end
25:       @connection.errback do
26:         fiber.resume
27:       end
28:       Fiber.yield
29: 
30:       raise Thrift::TransportException, "Unable to connect to #{@host}:#{@port}" unless @connection.connected?
31:       @connection
32:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 19
19:     def open
20:       fiber = Fiber.current
21:       @connection = EventMachineConnection.connect(@host, @port, @timeout)
22:       @connection.callback do
23:         fiber.resume
24:       end
25:       @connection.errback do
26:         fiber.resume
27:       end
28:       Fiber.yield
29: 
30:       raise Thrift::TransportException, "Unable to connect to #{@host}:#{@port}" unless @connection.connected?
31:       @connection
32:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 15
15:     def open?
16:       @connection && @connection.connected?
17:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 15
15:     def open?
16:       @connection && @connection.connected?
17:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 38
38:     def read(sz)
39:       @connection.blocking_read(sz)
40:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 38
38:     def read(sz)
39:       @connection.blocking_read(sz)
40:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 42
42:     def write(buf)
43:       @connection.send_data(buf)
44:     end

[Source]

    # File lib/thrift_client/event_machine.rb, line 42
42:     def write(buf)
43:       @connection.send_data(buf)
44:     end

[Validate]