upfluence-thrift 2.3.0 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/benchmark/gen-rb/benchmark_constants.rb +11 -0
  3. data/benchmark/gen-rb/benchmark_service.rb +106 -0
  4. data/benchmark/gen-rb/benchmark_types.rb +10 -0
  5. data/ext/extconf.rb +1 -4
  6. data/lib/thrift/protocol/json_protocol.rb +65 -1
  7. data/spec/gen-rb/base/base_service.rb +106 -0
  8. data/spec/gen-rb/base/base_service_constants.rb +11 -0
  9. data/spec/gen-rb/base/base_service_types.rb +33 -0
  10. data/spec/gen-rb/extended/extended_service.rb +103 -0
  11. data/spec/gen-rb/extended/extended_service_constants.rb +11 -0
  12. data/spec/gen-rb/extended/extended_service_types.rb +12 -0
  13. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +343 -0
  14. data/spec/gen-rb/flat/referenced_constants.rb +11 -0
  15. data/spec/gen-rb/flat/referenced_types.rb +17 -0
  16. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +11 -0
  17. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +35 -0
  18. data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +343 -0
  19. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +11 -0
  20. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +35 -0
  21. data/spec/gen-rb/nonblocking_service.rb +343 -0
  22. data/spec/gen-rb/other_namespace/referenced_constants.rb +11 -0
  23. data/spec/gen-rb/other_namespace/referenced_types.rb +17 -0
  24. data/spec/gen-rb/thrift_spec_constants.rb +11 -0
  25. data/spec/gen-rb/thrift_spec_types.rb +699 -0
  26. data/spec/json_protocol_spec.rb +17 -0
  27. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +274 -0
  28. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +936 -0
  29. data/test/debug_proto/gen-rb/empty_service.rb +39 -0
  30. data/test/debug_proto/gen-rb/inherited.rb +105 -0
  31. data/test/debug_proto/gen-rb/reverse_order_service.rb +107 -0
  32. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +106 -0
  33. data/test/debug_proto/gen-rb/srv.rb +410 -0
  34. metadata +150 -92
@@ -0,0 +1,39 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (2.4.0-upfluence)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'debug_proto_test_types'
9
+
10
+ module EmptyService
11
+ SERVICE = 'EmptyService'.freeze
12
+ NAMESPACE = ''.freeze
13
+
14
+ class Client
15
+ def initialize(client)
16
+ @client = ::Thrift.build_client(client)
17
+ end
18
+
19
+ def self.from_provider(provider)
20
+ Client.new(provider.build(NAMESPACE, SERVICE))
21
+ end
22
+
23
+ end
24
+
25
+ class Processor
26
+ include ::Thrift::Processor
27
+
28
+ def self.from_provider(handler, provider)
29
+ provider.build(NAMESPACE, SERVICE, Processor, handler)
30
+ end
31
+
32
+ end
33
+
34
+ # HELPER FUNCTIONS AND STRUCTURES
35
+
36
+ ::Thrift.register_service_type(self)
37
+
38
+ end
39
+
@@ -0,0 +1,105 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (2.4.0-upfluence)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'srv'
9
+ require 'debug_proto_test_types'
10
+
11
+ module Inherited
12
+ SERVICE = 'Inherited'.freeze
13
+ NAMESPACE = ''.freeze
14
+
15
+ class Client < ::Srv::Client
16
+ def initialize(client)
17
+ @client = ::Thrift.build_client(client)
18
+ end
19
+
20
+ def self.from_provider(provider)
21
+ Client.new(provider.build(NAMESPACE, SERVICE))
22
+ end
23
+
24
+ def identity(arg)
25
+ result = @client.call_binary(
26
+ 'identity',
27
+ Identity_args.new(arg: arg),
28
+ Identity_result
29
+ )
30
+
31
+ return result.success unless result.success.nil?
32
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'identity failed: unknown result')
33
+ result
34
+ end
35
+
36
+ end
37
+
38
+ class Processor < ::Srv::Processor
39
+ include ::Thrift::Processor
40
+
41
+ def self.from_provider(handler, provider)
42
+ provider.build(NAMESPACE, SERVICE, Processor, handler)
43
+ end
44
+
45
+ def process_identity(seqid, iprot, oprot)
46
+ args = read_args(iprot, Identity_args)
47
+ result = @middleware.handle_binary('identity', args) do |args|
48
+ result = Identity_result.new()
49
+ result.success = @handler.identity(args.arg)
50
+ result
51
+ end
52
+
53
+ write_result(result, oprot, 'identity', seqid)
54
+ end
55
+
56
+ end
57
+
58
+ # HELPER FUNCTIONS AND STRUCTURES
59
+
60
+ class Identity_args
61
+ include ::Thrift::Struct, ::Thrift::Struct_Union
62
+
63
+ NAME = 'identity_args'.freeze
64
+ NAMESPACE = ''.freeze
65
+
66
+ THRIFT_FIELD_INDEX_ARG = 1
67
+
68
+ FIELDS = {
69
+ THRIFT_FIELD_INDEX_ARG => {type: ::Thrift::Types::I32, name: 'arg'}
70
+ }
71
+
72
+ def struct_fields; FIELDS; end
73
+
74
+ def validate
75
+ end
76
+
77
+ ::Thrift::Struct.generate_accessors self
78
+ ::Thrift.register_struct_type self
79
+ end
80
+
81
+ class Identity_result
82
+ include ::Thrift::Struct, ::Thrift::Struct_Union
83
+
84
+ NAME = 'identity_result'.freeze
85
+ NAMESPACE = ''.freeze
86
+
87
+ THRIFT_FIELD_INDEX_SUCCESS = 0
88
+
89
+ FIELDS = {
90
+ THRIFT_FIELD_INDEX_SUCCESS => {type: ::Thrift::Types::I32, name: 'success'}
91
+ }
92
+
93
+ def struct_fields; FIELDS; end
94
+
95
+ def validate
96
+ end
97
+
98
+ ::Thrift::Struct.generate_accessors self
99
+ ::Thrift.register_struct_type self
100
+ end
101
+
102
+ ::Thrift.register_service_type(self)
103
+
104
+ end
105
+
@@ -0,0 +1,107 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (2.4.0-upfluence)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'debug_proto_test_types'
9
+
10
+ module ReverseOrderService
11
+ SERVICE = 'ReverseOrderService'.freeze
12
+ NAMESPACE = ''.freeze
13
+
14
+ class Client
15
+ def initialize(client)
16
+ @client = ::Thrift.build_client(client)
17
+ end
18
+
19
+ def self.from_provider(provider)
20
+ Client.new(provider.build(NAMESPACE, SERVICE))
21
+ end
22
+
23
+ def myMethod(first, second, third, fourth)
24
+ result = @client.call_binary(
25
+ 'myMethod',
26
+ MyMethod_args.new(first: first, second: second, third: third, fourth: fourth),
27
+ MyMethod_result
28
+ )
29
+
30
+ nil
31
+ end
32
+
33
+ end
34
+
35
+ class Processor
36
+ include ::Thrift::Processor
37
+
38
+ def self.from_provider(handler, provider)
39
+ provider.build(NAMESPACE, SERVICE, Processor, handler)
40
+ end
41
+
42
+ def process_myMethod(seqid, iprot, oprot)
43
+ args = read_args(iprot, MyMethod_args)
44
+ result = @middleware.handle_binary('myMethod', args) do |args|
45
+ result = MyMethod_result.new()
46
+ @handler.myMethod(args.first, args.second, args.third, args.fourth)
47
+ result
48
+ end
49
+
50
+ write_result(result, oprot, 'myMethod', seqid)
51
+ end
52
+
53
+ end
54
+
55
+ # HELPER FUNCTIONS AND STRUCTURES
56
+
57
+ class MyMethod_args
58
+ include ::Thrift::Struct, ::Thrift::Struct_Union
59
+
60
+ NAME = 'myMethod_args'.freeze
61
+ NAMESPACE = ''.freeze
62
+
63
+ THRIFT_FIELD_INDEX_FIRST = 4
64
+ THRIFT_FIELD_INDEX_SECOND = 3
65
+ THRIFT_FIELD_INDEX_THIRD = 2
66
+ THRIFT_FIELD_INDEX_FOURTH = 1
67
+
68
+ FIELDS = {
69
+ THRIFT_FIELD_INDEX_FIRST => {type: ::Thrift::Types::STRING, name: 'first'},
70
+ THRIFT_FIELD_INDEX_SECOND => {type: ::Thrift::Types::I16, name: 'second'},
71
+ THRIFT_FIELD_INDEX_THIRD => {type: ::Thrift::Types::I32, name: 'third'},
72
+ THRIFT_FIELD_INDEX_FOURTH => {type: ::Thrift::Types::I64, name: 'fourth'}
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ end
79
+
80
+ ::Thrift::Struct.generate_accessors self
81
+ ::Thrift.register_struct_type self
82
+ end
83
+
84
+ class MyMethod_result
85
+ include ::Thrift::Struct, ::Thrift::Struct_Union
86
+
87
+ NAME = 'myMethod_result'.freeze
88
+ NAMESPACE = ''.freeze
89
+
90
+
91
+ FIELDS = {
92
+
93
+ }
94
+
95
+ def struct_fields; FIELDS; end
96
+
97
+ def validate
98
+ end
99
+
100
+ ::Thrift::Struct.generate_accessors self
101
+ ::Thrift.register_struct_type self
102
+ end
103
+
104
+ ::Thrift.register_service_type(self)
105
+
106
+ end
107
+
@@ -0,0 +1,106 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (2.4.0-upfluence)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'debug_proto_test_types'
9
+
10
+ module ServiceForExceptionWithAMap
11
+ SERVICE = 'ServiceForExceptionWithAMap'.freeze
12
+ NAMESPACE = ''.freeze
13
+
14
+ class Client
15
+ def initialize(client)
16
+ @client = ::Thrift.build_client(client)
17
+ end
18
+
19
+ def self.from_provider(provider)
20
+ Client.new(provider.build(NAMESPACE, SERVICE))
21
+ end
22
+
23
+ def methodThatThrowsAnException()
24
+ result = @client.call_binary(
25
+ 'methodThatThrowsAnException',
26
+ MethodThatThrowsAnException_args.new(),
27
+ MethodThatThrowsAnException_result
28
+ )
29
+
30
+ raise result.xwamap unless result.xwamap.nil?
31
+ nil
32
+ end
33
+
34
+ end
35
+
36
+ class Processor
37
+ include ::Thrift::Processor
38
+
39
+ def self.from_provider(handler, provider)
40
+ provider.build(NAMESPACE, SERVICE, Processor, handler)
41
+ end
42
+
43
+ def process_methodThatThrowsAnException(seqid, iprot, oprot)
44
+ args = read_args(iprot, MethodThatThrowsAnException_args)
45
+ result = @middleware.handle_binary('methodThatThrowsAnException', args) do |args|
46
+ result = MethodThatThrowsAnException_result.new()
47
+ begin
48
+ @handler.methodThatThrowsAnException()
49
+ rescue ::ExceptionWithAMap => xwamap
50
+ result.xwamap = xwamap
51
+ end
52
+ result
53
+ end
54
+
55
+ write_result(result, oprot, 'methodThatThrowsAnException', seqid)
56
+ end
57
+
58
+ end
59
+
60
+ # HELPER FUNCTIONS AND STRUCTURES
61
+
62
+ class MethodThatThrowsAnException_args
63
+ include ::Thrift::Struct, ::Thrift::Struct_Union
64
+
65
+ NAME = 'methodThatThrowsAnException_args'.freeze
66
+ NAMESPACE = ''.freeze
67
+
68
+
69
+ FIELDS = {
70
+
71
+ }
72
+
73
+ def struct_fields; FIELDS; end
74
+
75
+ def validate
76
+ end
77
+
78
+ ::Thrift::Struct.generate_accessors self
79
+ ::Thrift.register_struct_type self
80
+ end
81
+
82
+ class MethodThatThrowsAnException_result
83
+ include ::Thrift::Struct, ::Thrift::Struct_Union
84
+
85
+ NAME = 'methodThatThrowsAnException_result'.freeze
86
+ NAMESPACE = ''.freeze
87
+
88
+ THRIFT_FIELD_INDEX_XWAMAP = 1
89
+
90
+ FIELDS = {
91
+ THRIFT_FIELD_INDEX_XWAMAP => {type: ::Thrift::Types::STRUCT, name: 'xwamap', class: ::ExceptionWithAMap}
92
+ }
93
+
94
+ def struct_fields; FIELDS; end
95
+
96
+ def validate
97
+ end
98
+
99
+ ::Thrift::Struct.generate_accessors self
100
+ ::Thrift.register_struct_type self
101
+ end
102
+
103
+ ::Thrift.register_service_type(self)
104
+
105
+ end
106
+