You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by jm...@apache.org on 2010/04/12 11:17:18 UTC

svn commit: r933158 - in /hadoop/avro/trunk: CHANGES.txt lang/ruby/lib/avro/ipc.rb lang/ruby/test/sample_ipc_client.rb lang/ruby/test/sample_ipc_server.rb

Author: jmhodges
Date: Mon Apr 12 09:16:56 2010
New Revision: 933158

URL: http://svn.apache.org/viewvc?rev=933158&view=rev
Log:
AVRO-516. Removing unnecessary ruby StringIO calls.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb
    hadoop/avro/trunk/lang/ruby/test/sample_ipc_client.rb
    hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=933158&r1=933157&r2=933158&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Mon Apr 12 09:16:56 2010
@@ -20,7 +20,10 @@ Avro 1.4.0 (unreleased)
 
     AVRO-450. HTTP IPC for ruby. (jmhodges)
 
-    AVRO-508. Use page-backed buffers for C++ serialization input or output. (sbanacho)
+    AVRO-508. Use page-backed buffers for C++ serialization input or
+    output. (sbanacho)
+
+    AVRO-516. Removing unnecessary ruby StringIO calls. (jmhodges)
 
   BUG FIXES
     AVRO-461. Skipping primitives in the ruby side (jmhodges)

Modified: hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb?rev=933158&r1=933157&r2=933158&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb (original)
+++ hadoop/avro/trunk/lang/ruby/lib/avro/ipc.rb Mon Apr 12 09:16:56 2010
@@ -239,8 +239,7 @@ module Avro::IPC
     # Called by a server to deserialize a request, compute and serialize
     # a response or error. Compare to 'handle()' in Thrift.
     def respond(call_request)
-      buffer_reader = StringIO.new(call_request)
-      buffer_decoder = Avro::IO::BinaryDecoder.new(StringIO.new(call_request))
+      buffer_decoder = Avro::IO::BinaryDecoder.new(call_request)
       buffer_writer = StringIO.new('', 'w+')
       buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer)
       error = nil

Modified: hadoop/avro/trunk/lang/ruby/test/sample_ipc_client.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/test/sample_ipc_client.rb?rev=933158&r1=933157&r2=933158&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/test/sample_ipc_client.rb (original)
+++ hadoop/avro/trunk/lang/ruby/test/sample_ipc_client.rb Mon Apr 12 09:16:56 2010
@@ -66,8 +66,7 @@ if $0 == __FILE__
     'body' => ARGV[2]
   }
 
-  num_messages = ARGV[3].to_i
-  num_message = 1 if num_messages == 0
+  num_messages = (ARGV[3] || 1).to_i
 
   # build the parameters for the request
   params = {'message' => message}
@@ -83,4 +82,4 @@ if $0 == __FILE__
   requestor = make_requestor('localhost', 9090, MAIL_PROTOCOL)
   result = requestor.request('replay', {})
   puts("Replay Result: " + result)
-end
\ No newline at end of file
+end

Modified: hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb?rev=933158&r1=933157&r2=933158&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb (original)
+++ hadoop/avro/trunk/lang/ruby/test/sample_ipc_server.rb Mon Apr 12 09:16:56 2010
@@ -81,11 +81,12 @@ class MailHandler < RequestHandler
   def handle(request)
     responder = MailResponder.new()
     transport = Avro::IPC::SocketTransport.new(request)
-    transport.write_framed_message(responder.respond(transport))
+    str = StringIO.new(transport.read_framed_message)
+    transport.write_framed_message(responder.respond(str))
   end
 end
 
 if $0 == __FILE__
   handler = MailHandler.new('localhost', 9090)
   handler.run
-end
\ No newline at end of file
+end