Author: jmhodges
Date: Fri Jun 4 05:33:46 2010
New Revision: 951276
URL: http://svn.apache.org/viewvc?rev=951276&view=rev
Log:
AVRO-516. Ruby socket RPC should use big endian buffer lengths. merge from trunk
Added:
avro/branches/branch-1.3/lang/ruby/test/test_socket_transport.rb
- copied unchanged from r933180,
hadoop/avro/trunk/lang/ruby/test/test_socket_transport.rb
Modified:
avro/branches/branch-1.3/ (props changed)
avro/branches/branch-1.3/CHANGES.txt
avro/branches/branch-1.3/lang/ruby/lib/avro/ipc.rb
avro/branches/branch-1.3/lang/ruby/test/sample_ipc_client.rb
avro/branches/branch-1.3/lang/ruby/test/sample_ipc_server.rb
Propchange: avro/branches/branch-1.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 4 05:33:46 2010
@@ -1,2 +1,2 @@
/avro/trunk:944035,944049
-/hadoop/avro/trunk:930458-930459,930461-930462,930599,931026-931027,931437,935526,938347
+/hadoop/avro/trunk:930458-930459,930461-930462,930599,931026-931027,931437,933158,933180,935526,938347
Modified: avro/branches/branch-1.3/CHANGES.txt
URL:
http://svn.apache.org/viewvc/avro/branches/branch-1.3/CHANGES.txt?rev=951276&r1=951275&r2=951276&view=diff
==============================================================================
--- avro/branches/branch-1.3/CHANGES.txt (original)
+++ avro/branches/branch-1.3/CHANGES.txt Fri Jun 4 05:33:46 2010
@@ -19,6 +19,14 @@ Avro 1.3.3 (Unreleased)
AVRO-450. HTTP IPC for ruby. (jmhodges)
+ AVRO-508. Use page-backed buffers for C++ serialization input or
+ output. (sbanacho)
+
+ AVRO-516. Removing unnecessary ruby StringIO calls. (jmhodges)
+
+ AVRO-516. Ruby socket RPC should use big endian buffer lengths.
+ (jmhodges)
+
BUG FIXES
AVRO-461. Skipping primitives in the ruby side (jmhodges)
Modified: avro/branches/branch-1.3/lang/ruby/lib/avro/ipc.rb
URL:
http://svn.apache.org/viewvc/avro/branches/branch-1.3/lang/ruby/lib/avro/ipc.rb?rev=951276&r1=951275&r2=951276&view=diff
==============================================================================
--- avro/branches/branch-1.3/lang/ruby/lib/avro/ipc.rb (original)
+++ avro/branches/branch-1.3/lang/ruby/lib/avro/ipc.rb Fri Jun 4 05:33:46 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
@@ -422,7 +421,7 @@ module Avro::IPC
end
def write_buffer_length(n)
- bytes_sent = sock.write([n].pack('I'))
+ bytes_sent = sock.write([n].pack('N'))
if bytes_sent == 0
raise ConnectionClosedException.new("socket sent 0 bytes")
end
@@ -433,7 +432,7 @@ module Avro::IPC
if read == '' || read == nil
raise ConnectionClosedException.new("Socket read 0 bytes.")
end
- read.unpack('I')[0]
+ read.unpack('N')[0]
end
def close
Modified: avro/branches/branch-1.3/lang/ruby/test/sample_ipc_client.rb
URL:
http://svn.apache.org/viewvc/avro/branches/branch-1.3/lang/ruby/test/sample_ipc_client.rb?rev=951276&r1=951275&r2=951276&view=diff
==============================================================================
--- avro/branches/branch-1.3/lang/ruby/test/sample_ipc_client.rb (original)
+++ avro/branches/branch-1.3/lang/ruby/test/sample_ipc_client.rb Fri Jun 4
05:33:46 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: avro/branches/branch-1.3/lang/ruby/test/sample_ipc_server.rb
URL:
http://svn.apache.org/viewvc/avro/branches/branch-1.3/lang/ruby/test/sample_ipc_server.rb?rev=951276&r1=951275&r2=951276&view=diff
==============================================================================
--- avro/branches/branch-1.3/lang/ruby/test/sample_ipc_server.rb (original)
+++ avro/branches/branch-1.3/lang/ruby/test/sample_ipc_server.rb Fri Jun 4
05:33:46 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