upfluence-thrift 2.3.0 → 2.4.4
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.
- checksums.yaml +4 -4
- data/benchmark/gen-rb/benchmark_constants.rb +11 -0
- data/benchmark/gen-rb/benchmark_service.rb +106 -0
- data/benchmark/gen-rb/benchmark_types.rb +10 -0
- data/ext/extconf.rb +1 -4
- data/lib/thrift/protocol/json_protocol.rb +65 -1
- data/spec/gen-rb/base/base_service.rb +106 -0
- data/spec/gen-rb/base/base_service_constants.rb +11 -0
- data/spec/gen-rb/base/base_service_types.rb +33 -0
- data/spec/gen-rb/extended/extended_service.rb +103 -0
- data/spec/gen-rb/extended/extended_service_constants.rb +11 -0
- data/spec/gen-rb/extended/extended_service_types.rb +12 -0
- data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +343 -0
- data/spec/gen-rb/flat/referenced_constants.rb +11 -0
- data/spec/gen-rb/flat/referenced_types.rb +17 -0
- data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +11 -0
- data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +35 -0
- data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +343 -0
- data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +11 -0
- data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +35 -0
- data/spec/gen-rb/nonblocking_service.rb +343 -0
- data/spec/gen-rb/other_namespace/referenced_constants.rb +11 -0
- data/spec/gen-rb/other_namespace/referenced_types.rb +17 -0
- data/spec/gen-rb/thrift_spec_constants.rb +11 -0
- data/spec/gen-rb/thrift_spec_types.rb +699 -0
- data/spec/json_protocol_spec.rb +17 -0
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +274 -0
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +936 -0
- data/test/debug_proto/gen-rb/empty_service.rb +39 -0
- data/test/debug_proto/gen-rb/inherited.rb +105 -0
- data/test/debug_proto/gen-rb/reverse_order_service.rb +107 -0
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +106 -0
- data/test/debug_proto/gen-rb/srv.rb +410 -0
- metadata +150 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a5d582754f7ba1078d44e62f4230d522de92b033172de5546f4b224d4f59f9
|
4
|
+
data.tar.gz: d2c0359abdd5dd5885930a854bb58a0280c28d4a8cfcd04885d6058d069b672f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 802f5da057755d933d88fce3e065f5af8dd172b775ba53f3f512736333ff5c9ca2db2547c269c0156c42c901576119290a43e94fa66db6aa8935fd968571619b
|
7
|
+
data.tar.gz: cb47abbb20ed8078060d11e572358913a2807a4b5c0723a53f526446425505672d179a8ea9c1e0c832e631ce49e972794b2a4c9cd61bfaf46b9a42ff0cd6f47b
|
@@ -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 'benchmark_types'
|
9
|
+
|
10
|
+
module ThriftBenchmark
|
11
|
+
module BenchmarkService
|
12
|
+
SERVICE = 'BenchmarkService'.freeze
|
13
|
+
NAMESPACE = ''.freeze
|
14
|
+
|
15
|
+
class 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 fibonacci(n)
|
25
|
+
result = @client.call_binary(
|
26
|
+
'fibonacci',
|
27
|
+
Fibonacci_args.new(n: n),
|
28
|
+
Fibonacci_result
|
29
|
+
)
|
30
|
+
|
31
|
+
return result.success unless result.success.nil?
|
32
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fibonacci failed: unknown result')
|
33
|
+
result
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class 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_fibonacci(seqid, iprot, oprot)
|
46
|
+
args = read_args(iprot, Fibonacci_args)
|
47
|
+
result = @middleware.handle_binary('fibonacci', args) do |args|
|
48
|
+
result = Fibonacci_result.new()
|
49
|
+
result.success = @handler.fibonacci(args.n)
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
write_result(result, oprot, 'fibonacci', seqid)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
59
|
+
|
60
|
+
class Fibonacci_args
|
61
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
62
|
+
|
63
|
+
NAME = 'fibonacci_args'.freeze
|
64
|
+
NAMESPACE = ''.freeze
|
65
|
+
|
66
|
+
THRIFT_FIELD_INDEX_N = 1
|
67
|
+
|
68
|
+
FIELDS = {
|
69
|
+
THRIFT_FIELD_INDEX_N => {type: ::Thrift::Types::BYTE, name: 'n'}
|
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 Fibonacci_result
|
82
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
83
|
+
|
84
|
+
NAME = 'fibonacci_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
|
+
|
106
|
+
end
|
data/ext/extconf.rb
CHANGED
@@ -23,10 +23,7 @@ else
|
|
23
23
|
require 'mkmf'
|
24
24
|
require 'rbconfig'
|
25
25
|
|
26
|
-
$
|
27
|
-
|
28
|
-
|
29
|
-
$CFLAGS = "-fsigned-char -g -O2 -Wall -Werror " + $ARCH_FLAGS
|
26
|
+
$CFLAGS += " -fsigned-char"
|
30
27
|
|
31
28
|
have_func("strlcpy", "string.h")
|
32
29
|
|
@@ -761,9 +761,73 @@ module Thrift
|
|
761
761
|
end
|
762
762
|
end
|
763
763
|
|
764
|
+
class SimpleJsonProtocol < JsonProtocol
|
765
|
+
READ_EXCEPTION = ProtocolException.new(
|
766
|
+
ProtocolException::NOT_IMPLEMENTED,
|
767
|
+
'op not implemented'
|
768
|
+
)
|
769
|
+
|
770
|
+
def write_message_begin(name, _type, _seqid)
|
771
|
+
write_json_object_start
|
772
|
+
write_json_string(name)
|
773
|
+
end
|
774
|
+
|
775
|
+
def read_message_begin
|
776
|
+
raise READ_EXCEPTION
|
777
|
+
end
|
778
|
+
|
779
|
+
def write_message_end
|
780
|
+
write_json_object_end
|
781
|
+
end
|
782
|
+
|
783
|
+
def write_field_begin(name, _type, _id)
|
784
|
+
write_json_string(name)
|
785
|
+
end
|
786
|
+
|
787
|
+
def read_field_begin
|
788
|
+
raise READ_EXCEPTION
|
789
|
+
end
|
790
|
+
|
791
|
+
def write_field_end; end
|
792
|
+
|
793
|
+
def write_map_begin(_ktype, _vtype, _size)
|
794
|
+
write_json_object_start
|
795
|
+
end
|
796
|
+
|
797
|
+
def read_map_begin
|
798
|
+
raise READ_EXCEPTION
|
799
|
+
end
|
800
|
+
|
801
|
+
def write_map_end
|
802
|
+
write_json_object_end
|
803
|
+
end
|
804
|
+
|
805
|
+
def write_list_begin(_etype, _size)
|
806
|
+
write_json_array_start
|
807
|
+
end
|
808
|
+
|
809
|
+
def read_list_begin
|
810
|
+
raise READ_EXCEPTION
|
811
|
+
end
|
812
|
+
|
813
|
+
def write_set_begin(_etype, _size)
|
814
|
+
write_json_array_start
|
815
|
+
end
|
816
|
+
|
817
|
+
def read_set_begin
|
818
|
+
raise READ_EXCEPTION
|
819
|
+
end
|
820
|
+
end
|
821
|
+
|
822
|
+
class SimpleJsonProtocolFactory < BaseProtocolFactory
|
823
|
+
def get_protocol(trans)
|
824
|
+
Thrift::SimpleJsonProtocol.new(trans)
|
825
|
+
end
|
826
|
+
end
|
827
|
+
|
764
828
|
class JsonProtocolFactory < BaseProtocolFactory
|
765
829
|
def get_protocol(trans)
|
766
|
-
|
830
|
+
Thrift::JsonProtocol.new(trans)
|
767
831
|
end
|
768
832
|
end
|
769
833
|
end
|
@@ -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 'base/base_service_types'
|
9
|
+
|
10
|
+
module Base
|
11
|
+
module BaseService
|
12
|
+
SERVICE = 'BaseService'.freeze
|
13
|
+
NAMESPACE = ''.freeze
|
14
|
+
|
15
|
+
class 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 greeting(english)
|
25
|
+
result = @client.call_binary(
|
26
|
+
'greeting',
|
27
|
+
Greeting_args.new(english: english),
|
28
|
+
Greeting_result
|
29
|
+
)
|
30
|
+
|
31
|
+
return result.success unless result.success.nil?
|
32
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
|
33
|
+
result
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class 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_greeting(seqid, iprot, oprot)
|
46
|
+
args = read_args(iprot, Greeting_args)
|
47
|
+
result = @middleware.handle_binary('greeting', args) do |args|
|
48
|
+
result = Greeting_result.new()
|
49
|
+
result.success = @handler.greeting(args.english)
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
write_result(result, oprot, 'greeting', seqid)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
59
|
+
|
60
|
+
class Greeting_args
|
61
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
62
|
+
|
63
|
+
NAME = 'greeting_args'.freeze
|
64
|
+
NAMESPACE = ''.freeze
|
65
|
+
|
66
|
+
THRIFT_FIELD_INDEX_ENGLISH = 1
|
67
|
+
|
68
|
+
FIELDS = {
|
69
|
+
THRIFT_FIELD_INDEX_ENGLISH => {type: ::Thrift::Types::BOOL, name: 'english'}
|
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 Greeting_result
|
82
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
83
|
+
|
84
|
+
NAME = 'greeting_result'.freeze
|
85
|
+
NAMESPACE = ''.freeze
|
86
|
+
|
87
|
+
THRIFT_FIELD_INDEX_SUCCESS = 0
|
88
|
+
|
89
|
+
FIELDS = {
|
90
|
+
THRIFT_FIELD_INDEX_SUCCESS => {type: ::Thrift::Types::STRUCT, name: 'success', class: ::Base::Hello}
|
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
|
+
|
106
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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
|
+
|
9
|
+
module Base
|
10
|
+
class Hello; end
|
11
|
+
|
12
|
+
class Hello
|
13
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
14
|
+
|
15
|
+
NAME = 'Hello'.freeze
|
16
|
+
NAMESPACE = ''.freeze
|
17
|
+
|
18
|
+
THRIFT_FIELD_INDEX_GREETING = 1
|
19
|
+
|
20
|
+
FIELDS = {
|
21
|
+
THRIFT_FIELD_INDEX_GREETING => {type: ::Thrift::Types::STRING, name: 'greeting', default: %q"hello world"}
|
22
|
+
}
|
23
|
+
|
24
|
+
def struct_fields; FIELDS; end
|
25
|
+
|
26
|
+
def validate
|
27
|
+
end
|
28
|
+
|
29
|
+
::Thrift::Struct.generate_accessors self
|
30
|
+
::Thrift.register_struct_type self
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,103 @@
|
|
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 'base/base_service'
|
9
|
+
require 'extended/extended_service_types'
|
10
|
+
|
11
|
+
module Extended
|
12
|
+
module ExtendedService
|
13
|
+
SERVICE = 'ExtendedService'.freeze
|
14
|
+
NAMESPACE = ''.freeze
|
15
|
+
|
16
|
+
class Client < ::Base::BaseService::Client
|
17
|
+
def initialize(client)
|
18
|
+
@client = ::Thrift.build_client(client)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.from_provider(provider)
|
22
|
+
Client.new(provider.build(NAMESPACE, SERVICE))
|
23
|
+
end
|
24
|
+
|
25
|
+
def ping()
|
26
|
+
result = @client.call_binary(
|
27
|
+
'ping',
|
28
|
+
Ping_args.new(),
|
29
|
+
Ping_result
|
30
|
+
)
|
31
|
+
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
class Processor < ::Base::BaseService::Processor
|
38
|
+
include ::Thrift::Processor
|
39
|
+
|
40
|
+
def self.from_provider(handler, provider)
|
41
|
+
provider.build(NAMESPACE, SERVICE, Processor, handler)
|
42
|
+
end
|
43
|
+
|
44
|
+
def process_ping(seqid, iprot, oprot)
|
45
|
+
args = read_args(iprot, Ping_args)
|
46
|
+
result = @middleware.handle_binary('ping', args) do |args|
|
47
|
+
result = Ping_result.new()
|
48
|
+
@handler.ping()
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
write_result(result, oprot, 'ping', seqid)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
58
|
+
|
59
|
+
class Ping_args
|
60
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
61
|
+
|
62
|
+
NAME = 'ping_args'.freeze
|
63
|
+
NAMESPACE = ''.freeze
|
64
|
+
|
65
|
+
|
66
|
+
FIELDS = {
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
def struct_fields; FIELDS; end
|
71
|
+
|
72
|
+
def validate
|
73
|
+
end
|
74
|
+
|
75
|
+
::Thrift::Struct.generate_accessors self
|
76
|
+
::Thrift.register_struct_type self
|
77
|
+
end
|
78
|
+
|
79
|
+
class Ping_result
|
80
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
81
|
+
|
82
|
+
NAME = 'ping_result'.freeze
|
83
|
+
NAMESPACE = ''.freeze
|
84
|
+
|
85
|
+
|
86
|
+
FIELDS = {
|
87
|
+
|
88
|
+
}
|
89
|
+
|
90
|
+
def struct_fields; FIELDS; end
|
91
|
+
|
92
|
+
def validate
|
93
|
+
end
|
94
|
+
|
95
|
+
::Thrift::Struct.generate_accessors self
|
96
|
+
::Thrift.register_struct_type self
|
97
|
+
end
|
98
|
+
|
99
|
+
::Thrift.register_service_type(self)
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|