upfluence-thrift 1.0.12 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/benchmark/gen-rb/benchmark_constants.rb +1 -1
  3. data/benchmark/gen-rb/benchmark_service.rb +21 -10
  4. data/benchmark/gen-rb/benchmark_types.rb +1 -1
  5. data/lib/thrift/server/rack_application.rb +30 -19
  6. data/spec/gen-rb/base/base_service.rb +21 -10
  7. data/spec/gen-rb/base/base_service_constants.rb +1 -1
  8. data/spec/gen-rb/base/base_service_types.rb +1 -1
  9. data/spec/gen-rb/extended/extended_service.rb +21 -10
  10. data/spec/gen-rb/extended/extended_service_constants.rb +1 -1
  11. data/spec/gen-rb/extended/extended_service_types.rb +1 -1
  12. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +67 -40
  13. data/spec/gen-rb/flat/referenced_constants.rb +1 -1
  14. data/spec/gen-rb/flat/referenced_types.rb +1 -1
  15. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +1 -1
  16. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +1 -1
  17. data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +67 -40
  18. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +1 -1
  19. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +1 -1
  20. data/spec/gen-rb/nonblocking_service.rb +67 -40
  21. data/spec/gen-rb/other_namespace/referenced_constants.rb +1 -1
  22. data/spec/gen-rb/other_namespace/referenced_types.rb +1 -1
  23. data/spec/gen-rb/thrift_spec_constants.rb +1 -1
  24. data/spec/gen-rb/thrift_spec_types.rb +1 -1
  25. data/spec/rack_application_spec.rb +1 -1
  26. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +44 -44
  27. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +1 -1
  28. data/test/debug_proto/gen-rb/empty_service.rb +8 -1
  29. data/test/debug_proto/gen-rb/inherited.rb +21 -10
  30. data/test/debug_proto/gen-rb/reverse_order_service.rb +21 -10
  31. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +24 -13
  32. data/test/debug_proto/gen-rb/srv.rb +83 -52
  33. metadata +11 -12
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -9,63 +9,80 @@ require 'namespaced_spec_namespace/thrift_namespaced_spec_types'
9
9
 
10
10
  module NamespacedSpecNamespace
11
11
  module NamespacedNonblockingService
12
+ SERVICE_NAME = "NamespacedNonblockingService"
13
+ PROGRAM_NAME = ""
14
+
12
15
  class Client
13
16
  include ::Thrift::Client
14
17
 
15
- def greeting(english)
16
- send_greeting(english)
17
- return recv_greeting()
18
+ def self.from_provider(provider)
19
+ Client.new(*provider.build(", NamespacedNonblockingService"))
20
+ end
21
+
22
+ def greeting(ctx, english)
23
+ @middleware.handle_binary(ctx, 'greeting', Greeting_args.new(:english => english)) do |ctx, args|
24
+ send_greeting(ctx, args.english)
25
+ return recv_greeting(ctx)
26
+ end
18
27
  end
19
28
 
20
- def send_greeting(english)
29
+ def send_greeting(ctx, english)
21
30
  send_message('greeting', Greeting_args, :english => english)
22
31
  end
23
32
 
24
- def recv_greeting()
33
+ def recv_greeting(ctx)
25
34
  result = receive_message(Greeting_result)
26
35
  return result.success unless result.success.nil?
27
36
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
28
37
  end
29
38
 
30
- def block()
31
- send_block()
32
- return recv_block()
39
+ def block(ctx)
40
+ @middleware.handle_binary(ctx, 'block', Block_args.new()) do |ctx, args|
41
+ send_block(ctx, )
42
+ return recv_block(ctx)
43
+ end
33
44
  end
34
45
 
35
- def send_block()
46
+ def send_block(ctx)
36
47
  send_message('block', Block_args)
37
48
  end
38
49
 
39
- def recv_block()
50
+ def recv_block(ctx)
40
51
  result = receive_message(Block_result)
41
52
  return result.success unless result.success.nil?
42
53
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
43
54
  end
44
55
 
45
- def unblock(n)
46
- send_unblock(n)
56
+ def unblock(ctx, n)
57
+ @middleware.handle_unary(ctx, 'unblock', Unblock_args.new(:n => n)) do |ctx, args|
58
+ send_unblock(ctx, args.n)
59
+ end
47
60
  end
48
61
 
49
- def send_unblock(n)
62
+ def send_unblock(ctx, n)
50
63
  send_oneway_message('unblock', Unblock_args, :n => n)
51
64
  end
52
- def shutdown()
53
- send_shutdown()
65
+ def shutdown(ctx)
66
+ @middleware.handle_unary(ctx, 'shutdown', Shutdown_args.new()) do |ctx, args|
67
+ send_shutdown(ctx, )
68
+ end
54
69
  end
55
70
 
56
- def send_shutdown()
71
+ def send_shutdown(ctx)
57
72
  send_oneway_message('shutdown', Shutdown_args)
58
73
  end
59
- def sleep(seconds)
60
- send_sleep(seconds)
61
- recv_sleep()
74
+ def sleep(ctx, seconds)
75
+ @middleware.handle_binary(ctx, 'sleep', Sleep_args.new(:seconds => seconds)) do |ctx, args|
76
+ send_sleep(ctx, args.seconds)
77
+ recv_sleep(ctx)
78
+ end
62
79
  end
63
80
 
64
- def send_sleep(seconds)
81
+ def send_sleep(ctx, seconds)
65
82
  send_message('sleep', Sleep_args, :seconds => seconds)
66
83
  end
67
84
 
68
- def recv_sleep()
85
+ def recv_sleep(ctx)
69
86
  result = receive_message(Sleep_result)
70
87
  return
71
88
  end
@@ -75,37 +92,47 @@ module NamespacedSpecNamespace
75
92
  class Processor
76
93
  include ::Thrift::Processor
77
94
 
78
- def process_greeting(seqid, iprot, oprot)
95
+ def process_greeting(ctx, seqid, iprot, oprot)
79
96
  args = read_args(iprot, Greeting_args)
80
- result = Greeting_result.new()
81
- result.success = @handler.greeting(args.english)
82
- write_result(result, oprot, 'greeting', seqid)
97
+ @middleware.handle_binary(ctx, 'greeting', args) do |ctx, args|
98
+ result = Greeting_result.new()
99
+ result.success = @handler.greeting(ctx, args.english)
100
+ write_result(result, oprot, 'greeting', seqid)
101
+ end
83
102
  end
84
103
 
85
- def process_block(seqid, iprot, oprot)
104
+ def process_block(ctx, seqid, iprot, oprot)
86
105
  args = read_args(iprot, Block_args)
87
- result = Block_result.new()
88
- result.success = @handler.block()
89
- write_result(result, oprot, 'block', seqid)
106
+ @middleware.handle_binary(ctx, 'block', args) do |ctx, args|
107
+ result = Block_result.new()
108
+ result.success = @handler.block(ctx, )
109
+ write_result(result, oprot, 'block', seqid)
110
+ end
90
111
  end
91
112
 
92
- def process_unblock(seqid, iprot, oprot)
113
+ def process_unblock(ctx, seqid, iprot, oprot)
93
114
  args = read_args(iprot, Unblock_args)
94
- @handler.unblock(args.n)
95
- return
115
+ @middleware.handle_unary(ctx, 'unblock', args) do |ctx, args|
116
+ @handler.unblock(ctx, args.n)
117
+ return
118
+ end
96
119
  end
97
120
 
98
- def process_shutdown(seqid, iprot, oprot)
121
+ def process_shutdown(ctx, seqid, iprot, oprot)
99
122
  args = read_args(iprot, Shutdown_args)
100
- @handler.shutdown()
101
- return
123
+ @middleware.handle_unary(ctx, 'shutdown', args) do |ctx, args|
124
+ @handler.shutdown(ctx, )
125
+ return
126
+ end
102
127
  end
103
128
 
104
- def process_sleep(seqid, iprot, oprot)
129
+ def process_sleep(ctx, seqid, iprot, oprot)
105
130
  args = read_args(iprot, Sleep_args)
106
- result = Sleep_result.new()
107
- @handler.sleep(args.seconds)
108
- write_result(result, oprot, 'sleep', seqid)
131
+ @middleware.handle_binary(ctx, 'sleep', args) do |ctx, args|
132
+ result = Sleep_result.new()
133
+ @handler.sleep(ctx, args.seconds)
134
+ write_result(result, oprot, 'sleep', seqid)
135
+ end
109
136
  end
110
137
 
111
138
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -9,63 +9,80 @@ require 'thrift_spec_types'
9
9
 
10
10
  module SpecNamespace
11
11
  module NonblockingService
12
+ SERVICE_NAME = "NonblockingService"
13
+ PROGRAM_NAME = ""
14
+
12
15
  class Client
13
16
  include ::Thrift::Client
14
17
 
15
- def greeting(english)
16
- send_greeting(english)
17
- return recv_greeting()
18
+ def self.from_provider(provider)
19
+ Client.new(*provider.build(", NonblockingService"))
20
+ end
21
+
22
+ def greeting(ctx, english)
23
+ @middleware.handle_binary(ctx, 'greeting', Greeting_args.new(:english => english)) do |ctx, args|
24
+ send_greeting(ctx, args.english)
25
+ return recv_greeting(ctx)
26
+ end
18
27
  end
19
28
 
20
- def send_greeting(english)
29
+ def send_greeting(ctx, english)
21
30
  send_message('greeting', Greeting_args, :english => english)
22
31
  end
23
32
 
24
- def recv_greeting()
33
+ def recv_greeting(ctx)
25
34
  result = receive_message(Greeting_result)
26
35
  return result.success unless result.success.nil?
27
36
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
28
37
  end
29
38
 
30
- def block()
31
- send_block()
32
- return recv_block()
39
+ def block(ctx)
40
+ @middleware.handle_binary(ctx, 'block', Block_args.new()) do |ctx, args|
41
+ send_block(ctx, )
42
+ return recv_block(ctx)
43
+ end
33
44
  end
34
45
 
35
- def send_block()
46
+ def send_block(ctx)
36
47
  send_message('block', Block_args)
37
48
  end
38
49
 
39
- def recv_block()
50
+ def recv_block(ctx)
40
51
  result = receive_message(Block_result)
41
52
  return result.success unless result.success.nil?
42
53
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
43
54
  end
44
55
 
45
- def unblock(n)
46
- send_unblock(n)
56
+ def unblock(ctx, n)
57
+ @middleware.handle_unary(ctx, 'unblock', Unblock_args.new(:n => n)) do |ctx, args|
58
+ send_unblock(ctx, args.n)
59
+ end
47
60
  end
48
61
 
49
- def send_unblock(n)
62
+ def send_unblock(ctx, n)
50
63
  send_oneway_message('unblock', Unblock_args, :n => n)
51
64
  end
52
- def shutdown()
53
- send_shutdown()
65
+ def shutdown(ctx)
66
+ @middleware.handle_unary(ctx, 'shutdown', Shutdown_args.new()) do |ctx, args|
67
+ send_shutdown(ctx, )
68
+ end
54
69
  end
55
70
 
56
- def send_shutdown()
71
+ def send_shutdown(ctx)
57
72
  send_oneway_message('shutdown', Shutdown_args)
58
73
  end
59
- def sleep(seconds)
60
- send_sleep(seconds)
61
- recv_sleep()
74
+ def sleep(ctx, seconds)
75
+ @middleware.handle_binary(ctx, 'sleep', Sleep_args.new(:seconds => seconds)) do |ctx, args|
76
+ send_sleep(ctx, args.seconds)
77
+ recv_sleep(ctx)
78
+ end
62
79
  end
63
80
 
64
- def send_sleep(seconds)
81
+ def send_sleep(ctx, seconds)
65
82
  send_message('sleep', Sleep_args, :seconds => seconds)
66
83
  end
67
84
 
68
- def recv_sleep()
85
+ def recv_sleep(ctx)
69
86
  result = receive_message(Sleep_result)
70
87
  return
71
88
  end
@@ -75,37 +92,47 @@ module SpecNamespace
75
92
  class Processor
76
93
  include ::Thrift::Processor
77
94
 
78
- def process_greeting(seqid, iprot, oprot)
95
+ def process_greeting(ctx, seqid, iprot, oprot)
79
96
  args = read_args(iprot, Greeting_args)
80
- result = Greeting_result.new()
81
- result.success = @handler.greeting(args.english)
82
- write_result(result, oprot, 'greeting', seqid)
97
+ @middleware.handle_binary(ctx, 'greeting', args) do |ctx, args|
98
+ result = Greeting_result.new()
99
+ result.success = @handler.greeting(ctx, args.english)
100
+ write_result(result, oprot, 'greeting', seqid)
101
+ end
83
102
  end
84
103
 
85
- def process_block(seqid, iprot, oprot)
104
+ def process_block(ctx, seqid, iprot, oprot)
86
105
  args = read_args(iprot, Block_args)
87
- result = Block_result.new()
88
- result.success = @handler.block()
89
- write_result(result, oprot, 'block', seqid)
106
+ @middleware.handle_binary(ctx, 'block', args) do |ctx, args|
107
+ result = Block_result.new()
108
+ result.success = @handler.block(ctx, )
109
+ write_result(result, oprot, 'block', seqid)
110
+ end
90
111
  end
91
112
 
92
- def process_unblock(seqid, iprot, oprot)
113
+ def process_unblock(ctx, seqid, iprot, oprot)
93
114
  args = read_args(iprot, Unblock_args)
94
- @handler.unblock(args.n)
95
- return
115
+ @middleware.handle_unary(ctx, 'unblock', args) do |ctx, args|
116
+ @handler.unblock(ctx, args.n)
117
+ return
118
+ end
96
119
  end
97
120
 
98
- def process_shutdown(seqid, iprot, oprot)
121
+ def process_shutdown(ctx, seqid, iprot, oprot)
99
122
  args = read_args(iprot, Shutdown_args)
100
- @handler.shutdown()
101
- return
123
+ @middleware.handle_unary(ctx, 'shutdown', args) do |ctx, args|
124
+ @handler.shutdown(ctx, )
125
+ return
126
+ end
102
127
  end
103
128
 
104
- def process_sleep(seqid, iprot, oprot)
129
+ def process_sleep(ctx, seqid, iprot, oprot)
105
130
  args = read_args(iprot, Sleep_args)
106
- result = Sleep_result.new()
107
- @handler.sleep(args.seconds)
108
- write_result(result, oprot, 'sleep', seqid)
131
+ @middleware.handle_binary(ctx, 'sleep', args) do |ctx, args|
132
+ result = Sleep_result.new()
133
+ @handler.sleep(ctx, args.seconds)
134
+ write_result(result, oprot, 'sleep', seqid)
135
+ end
109
136
  end
110
137
 
111
138
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -57,7 +57,7 @@ describe Thrift::RackApplication do
57
57
 
58
58
  it 'creates an IOStreamTransport' do
59
59
  header('Content-Type', "application/x-thrift")
60
- Thrift::IOStreamTransport.should_receive(:new).with(an_instance_of(Rack::Lint::InputWrapper), an_instance_of(Rack::Response))
60
+ Thrift::IOStreamTransport.should_receive(:new).with(an_instance_of(StringIO), an_instance_of(Rack::Response))
61
61
  post "/"
62
62
  end
63
63
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-upfluence)
2
+ # Autogenerated by Thrift Compiler (2.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -8,49 +8,6 @@ require 'thrift'
8
8
  require 'debug_proto_test_types'
9
9
 
10
10
  COMPACT_TEST = ::CompactProtoTestStruct.new({
11
- %q"a_byte" => 127,
12
- %q"a_i16" => 32000,
13
- %q"a_i32" => 1000000000,
14
- %q"a_i64" => 1099511627775,
15
- %q"a_double" => 5.6789,
16
- %q"a_string" => %q"my string",
17
- %q"true_field" => true,
18
- %q"false_field" => false,
19
- %q"empty_struct_field" => ::Empty.new({
20
- }),
21
- %q"byte_list" => [
22
- -127,
23
- -1,
24
- 0,
25
- 1,
26
- 127,
27
- ],
28
- %q"i16_list" => [
29
- -1,
30
- 0,
31
- 1,
32
- 32767,
33
- ],
34
- %q"i32_list" => [
35
- -1,
36
- 0,
37
- 255,
38
- 65535,
39
- 16777215,
40
- 2147483647,
41
- ],
42
- %q"i64_list" => [
43
- -1,
44
- 0,
45
- 255,
46
- 65535,
47
- 16777215,
48
- 4294967295,
49
- 1099511627775,
50
- 281474976710655,
51
- 72057594037927935,
52
- 9223372036854775807,
53
- ],
54
11
  %q"double_list" => [
55
12
  0.1,
56
13
  0.2,
@@ -254,6 +211,49 @@ COMPACT_TEST = ::CompactProtoTestStruct.new({
254
211
  2,
255
212
  ],
256
213
  },
214
+ %q"a_byte" => 127,
215
+ %q"a_i16" => 32000,
216
+ %q"a_i32" => 1000000000,
217
+ %q"a_i64" => 1099511627775,
218
+ %q"a_double" => 5.6789,
219
+ %q"a_string" => %q"my string",
220
+ %q"true_field" => true,
221
+ %q"false_field" => false,
222
+ %q"empty_struct_field" => ::Empty.new({
223
+ }),
224
+ %q"byte_list" => [
225
+ -127,
226
+ -1,
227
+ 0,
228
+ 1,
229
+ 127,
230
+ ],
231
+ %q"i16_list" => [
232
+ -1,
233
+ 0,
234
+ 1,
235
+ 32767,
236
+ ],
237
+ %q"i32_list" => [
238
+ -1,
239
+ 0,
240
+ 255,
241
+ 65535,
242
+ 16777215,
243
+ 2147483647,
244
+ ],
245
+ %q"i64_list" => [
246
+ -1,
247
+ 0,
248
+ 255,
249
+ 65535,
250
+ 16777215,
251
+ 4294967295,
252
+ 1099511627775,
253
+ 281474976710655,
254
+ 72057594037927935,
255
+ 9223372036854775807,
256
+ ],
257
257
  })
258
258
 
259
259
  MYCONST = 2