avro 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/avro.gemspec +3 -3
- data/lib/avro/io.rb +1 -1
- data/lib/avro/ipc.rb +17 -3
- data/test/test_datafile.rb +14 -0
- metadata +5 -5
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ Echoe.new('avro', VERSION) do |p|
|
|
21
21
|
p.author = "Apache Software Foundation"
|
22
22
|
p.email = "avro-dev@hadoop.apache.org"
|
23
23
|
p.summary = "Apache Avro for Ruby"
|
24
|
-
p.description = "
|
24
|
+
p.description = "Avro is a data serialization and RPC format"
|
25
25
|
p.url = "http://hadoop.apache.org/avro/"
|
26
26
|
p.runtime_dependencies = %w[yajl-ruby]
|
27
27
|
end
|
data/avro.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "avro"
|
5
|
-
s.version = "1.7.
|
5
|
+
s.version = "1.7.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Apache Software Foundation"]
|
9
|
-
s.date = "2012-
|
10
|
-
s.description = "
|
9
|
+
s.date = "2012-12-03"
|
10
|
+
s.description = "Avro is a data serialization and RPC format"
|
11
11
|
s.email = "avro-dev@hadoop.apache.org"
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/avro.rb", "lib/avro/collect_hash.rb", "lib/avro/data_file.rb", "lib/avro/io.rb", "lib/avro/ipc.rb", "lib/avro/protocol.rb", "lib/avro/schema.rb"]
|
13
13
|
s.files = ["CHANGELOG", "Manifest", "Rakefile", "avro.gemspec", "interop/test_interop.rb", "lib/avro.rb", "lib/avro/collect_hash.rb", "lib/avro/data_file.rb", "lib/avro/io.rb", "lib/avro/ipc.rb", "lib/avro/protocol.rb", "lib/avro/schema.rb", "test/random_data.rb", "test/sample_ipc_client.rb", "test/sample_ipc_http_client.rb", "test/sample_ipc_http_server.rb", "test/sample_ipc_server.rb", "test/test_datafile.rb", "test/test_help.rb", "test/test_io.rb", "test/test_protocol.rb", "test/test_socket_transport.rb", "test/tool.rb"]
|
data/lib/avro/io.rb
CHANGED
data/lib/avro/ipc.rb
CHANGED
@@ -242,7 +242,7 @@ module Avro::IPC
|
|
242
242
|
|
243
243
|
# Called by a server to deserialize a request, compute and serialize
|
244
244
|
# a response or error. Compare to 'handle()' in Thrift.
|
245
|
-
def respond(call_request)
|
245
|
+
def respond(call_request, transport=nil)
|
246
246
|
buffer_decoder = Avro::IO::BinaryDecoder.new(StringIO.new(call_request))
|
247
247
|
buffer_writer = StringIO.new('', 'w+')
|
248
248
|
buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer)
|
@@ -250,7 +250,7 @@ module Avro::IPC
|
|
250
250
|
response_metadata = {}
|
251
251
|
|
252
252
|
begin
|
253
|
-
remote_protocol = process_handshake(buffer_decoder, buffer_encoder)
|
253
|
+
remote_protocol = process_handshake(buffer_decoder, buffer_encoder, transport)
|
254
254
|
# handshake failure
|
255
255
|
unless remote_protocol
|
256
256
|
return buffer_writer.string
|
@@ -302,7 +302,10 @@ module Avro::IPC
|
|
302
302
|
buffer_writer.string
|
303
303
|
end
|
304
304
|
|
305
|
-
def process_handshake(decoder, encoder)
|
305
|
+
def process_handshake(decoder, encoder, connection=nil)
|
306
|
+
if connection && connection.is_connected?
|
307
|
+
return connection.protocol
|
308
|
+
end
|
306
309
|
handshake_request = HANDSHAKE_RESPONDER_READER.read(decoder)
|
307
310
|
handshake_response = {}
|
308
311
|
|
@@ -338,6 +341,11 @@ module Avro::IPC
|
|
338
341
|
end
|
339
342
|
|
340
343
|
HANDSHAKE_RESPONDER_WRITER.write(handshake_response, encoder)
|
344
|
+
|
345
|
+
if connection && handshake_response['match'] != 'NONE'
|
346
|
+
connection.protocol = remote_protocol
|
347
|
+
end
|
348
|
+
|
341
349
|
remote_protocol
|
342
350
|
end
|
343
351
|
|
@@ -366,9 +374,15 @@ module Avro::IPC
|
|
366
374
|
# A simple socket-based Transport implementation.
|
367
375
|
|
368
376
|
attr_reader :sock, :remote_name
|
377
|
+
attr_accessor :protocol
|
369
378
|
|
370
379
|
def initialize(sock)
|
371
380
|
@sock = sock
|
381
|
+
@protocol = nil
|
382
|
+
end
|
383
|
+
|
384
|
+
def is_connected?()
|
385
|
+
!!@protocol
|
372
386
|
end
|
373
387
|
|
374
388
|
def transceive(request)
|
data/test/test_datafile.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# Licensed to the Apache Software Foundation (ASF) under one
|
2
3
|
# or more contributor license agreements. See the NOTICE file
|
3
4
|
# distributed with this work for additional information
|
@@ -140,4 +141,17 @@ JSON
|
|
140
141
|
assert_equal(block_count+1, dw.block_count)
|
141
142
|
end
|
142
143
|
end
|
144
|
+
|
145
|
+
def test_utf8
|
146
|
+
datafile = Avro::DataFile::open('data.avr', 'w', '"string"')
|
147
|
+
datafile << "家"
|
148
|
+
datafile.close
|
149
|
+
|
150
|
+
datafile = Avro::DataFile.open('data.avr')
|
151
|
+
datafile.each do |s|
|
152
|
+
assert_equal "家", s
|
153
|
+
end
|
154
|
+
datafile.close
|
155
|
+
end
|
156
|
+
|
143
157
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 1.7.
|
9
|
+
- 3
|
10
|
+
version: 1.7.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Apache Software Foundation
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-12-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: yajl-ruby
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: "0"
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
|
-
description:
|
34
|
+
description: Avro is a data serialization and RPC format
|
35
35
|
email: avro-dev@hadoop.apache.org
|
36
36
|
executables: []
|
37
37
|
|