thrift 0.24.0 → 0.25.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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +107 -4
  3. data/ext/binary_protocol_accelerated.c +52 -17
  4. data/ext/compact_protocol.c +135 -70
  5. data/ext/constants.h +3 -0
  6. data/ext/extconf.rb +4 -4
  7. data/ext/macros.h +11 -0
  8. data/ext/memory_buffer.c +35 -17
  9. data/ext/struct.c +185 -64
  10. data/ext/thrift_native.c +6 -0
  11. data/lib/thrift/bytes.rb +2 -2
  12. data/lib/thrift/client.rb +31 -22
  13. data/lib/thrift/exceptions.rb +10 -8
  14. data/lib/thrift/multiplexed_processor.rb +5 -6
  15. data/lib/thrift/processor.rb +24 -3
  16. data/lib/thrift/protocol/base_protocol.rb +53 -27
  17. data/lib/thrift/protocol/binary_protocol.rb +54 -40
  18. data/lib/thrift/protocol/binary_protocol_accelerated.rb +6 -2
  19. data/lib/thrift/protocol/compact_protocol.rb +193 -88
  20. data/lib/thrift/protocol/header_protocol.rb +14 -3
  21. data/lib/thrift/protocol/json_protocol.rb +146 -104
  22. data/lib/thrift/protocol/multiplexed_protocol.rb +2 -3
  23. data/lib/thrift/protocol/protocol_decorator.rb +5 -2
  24. data/lib/thrift/serializer/serializer.rb +6 -0
  25. data/lib/thrift/server/base_server.rb +10 -2
  26. data/lib/thrift/server/nonblocking_server.rb +49 -26
  27. data/lib/thrift/server/rack_application.rb +69 -0
  28. data/lib/thrift/server/simple_server.rb +27 -23
  29. data/lib/thrift/server/thin_http_server.rb +20 -44
  30. data/lib/thrift/server/thread_pool_server.rb +20 -17
  31. data/lib/thrift/server/threaded_server.rb +22 -26
  32. data/lib/thrift/struct.rb +33 -18
  33. data/lib/thrift/struct_union.rb +36 -30
  34. data/lib/thrift/transport/base_transport.rb +23 -5
  35. data/lib/thrift/transport/buffered_transport.rb +4 -4
  36. data/lib/thrift/transport/framed_transport.rb +32 -7
  37. data/lib/thrift/transport/header_transport.rb +130 -50
  38. data/lib/thrift/transport/http_client_transport.rb +27 -14
  39. data/lib/thrift/transport/io_stream_transport.rb +2 -1
  40. data/lib/thrift/transport/memory_buffer_transport.rb +8 -10
  41. data/lib/thrift/transport/server_socket.rb +4 -5
  42. data/lib/thrift/transport/socket.rb +20 -22
  43. data/lib/thrift/transport/ssl_server_socket.rb +64 -4
  44. data/lib/thrift/transport/ssl_socket.rb +32 -5
  45. data/lib/thrift/transport/unix_server_socket.rb +1 -1
  46. data/lib/thrift/transport/unix_socket.rb +4 -6
  47. data/lib/thrift/types.rb +22 -22
  48. data/lib/thrift/union.rb +20 -11
  49. data/lib/thrift/uuid.rb +8 -8
  50. data/lib/thrift.rb +39 -39
  51. metadata +5 -230
  52. data/benchmark/Benchmark.thrift +0 -24
  53. data/benchmark/benchmark.rb +0 -286
  54. data/benchmark/client.rb +0 -118
  55. data/benchmark/server.rb +0 -121
  56. data/benchmark/thin_server.rb +0 -46
  57. data/lib/thrift/server/mongrel_http_server.rb +0 -61
  58. data/spec/BaseService.thrift +0 -27
  59. data/spec/ExtendedService.thrift +0 -25
  60. data/spec/Referenced.thrift +0 -44
  61. data/spec/ThriftNamespacedSpec.thrift +0 -53
  62. data/spec/ThriftSpec.thrift +0 -203
  63. data/spec/base_protocol_spec.rb +0 -244
  64. data/spec/base_transport_spec.rb +0 -428
  65. data/spec/binary_protocol_accelerated_spec.rb +0 -47
  66. data/spec/binary_protocol_spec.rb +0 -73
  67. data/spec/binary_protocol_spec_shared.rb +0 -509
  68. data/spec/bytes_spec.rb +0 -117
  69. data/spec/client_spec.rb +0 -167
  70. data/spec/compact_protocol_spec.rb +0 -295
  71. data/spec/constants_demo_spec.rb +0 -102
  72. data/spec/exception_spec.rb +0 -141
  73. data/spec/flat_spec.rb +0 -63
  74. data/spec/header_protocol_spec.rb +0 -476
  75. data/spec/header_transport_spec.rb +0 -431
  76. data/spec/http_client_spec.rb +0 -160
  77. data/spec/json_protocol_spec.rb +0 -574
  78. data/spec/multiplexed_processor_spec.rb +0 -75
  79. data/spec/namespaced_spec.rb +0 -67
  80. data/spec/nonblocking_server_spec.rb +0 -429
  81. data/spec/processor_spec.rb +0 -80
  82. data/spec/recursion_depth_spec.rb +0 -223
  83. data/spec/serializer_spec.rb +0 -67
  84. data/spec/server_socket_spec.rb +0 -121
  85. data/spec/server_spec.rb +0 -238
  86. data/spec/socket_spec.rb +0 -174
  87. data/spec/socket_spec_shared.rb +0 -168
  88. data/spec/spec_helper.rb +0 -70
  89. data/spec/ssl_server_socket_spec.rb +0 -85
  90. data/spec/ssl_socket_spec.rb +0 -248
  91. data/spec/struct_nested_containers_spec.rb +0 -191
  92. data/spec/struct_spec.rb +0 -398
  93. data/spec/support/header_protocol_helper.rb +0 -55
  94. data/spec/thin_http_server_spec.rb +0 -127
  95. data/spec/types_spec.rb +0 -118
  96. data/spec/union_spec.rb +0 -273
  97. data/spec/unix_socket_spec.rb +0 -131
  98. data/spec/uuid_validation_spec.rb +0 -239
  99. data/test/fuzz/Makefile +0 -779
  100. data/test/fuzz/Makefile.am +0 -173
  101. data/test/fuzz/Makefile.in +0 -775
  102. data/test/fuzz/README.md +0 -149
  103. data/test/fuzz/fuzz_common.rb +0 -96
  104. data/test/fuzz/fuzz_parse_binary_protocol.rb +0 -23
  105. data/test/fuzz/fuzz_parse_binary_protocol_accelerated.rb +0 -23
  106. data/test/fuzz/fuzz_parse_binary_protocol_accelerated_harness.rb +0 -23
  107. data/test/fuzz/fuzz_parse_binary_protocol_harness.rb +0 -23
  108. data/test/fuzz/fuzz_parse_compact_protocol.rb +0 -23
  109. data/test/fuzz/fuzz_parse_compact_protocol_harness.rb +0 -23
  110. data/test/fuzz/fuzz_parse_json_protocol.rb +0 -23
  111. data/test/fuzz/fuzz_parse_json_protocol_harness.rb +0 -23
  112. data/test/fuzz/fuzz_roundtrip_binary_protocol.rb +0 -23
  113. data/test/fuzz/fuzz_roundtrip_binary_protocol_accelerated.rb +0 -23
  114. data/test/fuzz/fuzz_roundtrip_binary_protocol_accelerated_harness.rb +0 -23
  115. data/test/fuzz/fuzz_roundtrip_binary_protocol_harness.rb +0 -23
  116. data/test/fuzz/fuzz_roundtrip_compact_protocol.rb +0 -23
  117. data/test/fuzz/fuzz_roundtrip_compact_protocol_harness.rb +0 -23
  118. data/test/fuzz/fuzz_roundtrip_json_protocol.rb +0 -23
  119. data/test/fuzz/fuzz_roundtrip_json_protocol_harness.rb +0 -23
  120. data/test/fuzz/fuzz_tracer.rb +0 -29
data/benchmark/client.rb DELETED
@@ -1,118 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Licensed to the Apache Software Foundation (ASF) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The ASF licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
- #
20
-
21
- $:.unshift File.dirname(__FILE__) + '/../lib'
22
- $:.unshift File.dirname(__FILE__) + '/../ext'
23
- require 'thrift'
24
- require 'openssl'
25
- $:.unshift File.dirname(__FILE__) + "/gen-rb"
26
- require 'benchmark_service'
27
-
28
- class Client
29
- def initialize(host, port, clients_per_process, calls_per_client, log_exceptions, tls, protocol_type)
30
- @host = host
31
- @port = port
32
- @clients_per_process = clients_per_process
33
- @calls_per_client = calls_per_client
34
- @log_exceptions = log_exceptions
35
- @tls = tls
36
- @protocol_type = protocol_type || 'binary'
37
- end
38
-
39
- def create_protocol(socket)
40
- case @protocol_type
41
- when 'binary'
42
- transport = Thrift::FramedTransport.new(socket)
43
- Thrift::BinaryProtocol.new(transport)
44
- when 'compact'
45
- transport = Thrift::FramedTransport.new(socket)
46
- Thrift::CompactProtocol.new(transport)
47
- when 'header'
48
- Thrift::HeaderProtocol.new(socket)
49
- when 'header-compact'
50
- Thrift::HeaderProtocol.new(socket, nil, Thrift::HeaderSubprotocolID::COMPACT)
51
- when 'header-zlib'
52
- protocol = Thrift::HeaderProtocol.new(socket)
53
- protocol.add_transform(Thrift::HeaderTransformID::ZLIB)
54
- protocol
55
- else
56
- transport = Thrift::FramedTransport.new(socket)
57
- Thrift::BinaryProtocol.new(transport)
58
- end
59
- end
60
-
61
- def run
62
- @clients_per_process.times do
63
- socket = if @tls
64
- ssl_context = OpenSSL::SSL::SSLContext.new.tap do |ctx|
65
- ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
66
- ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
67
-
68
- keys_dir = File.expand_path("../../../test/keys", __dir__)
69
- ctx.ca_file = File.join(keys_dir, "CA.pem")
70
- ctx.cert = OpenSSL::X509::Certificate.new(File.open(File.join(keys_dir, "client.crt")))
71
- ctx.cert_store = OpenSSL::X509::Store.new
72
- ctx.cert_store.add_file(File.join(keys_dir, 'server.pem'))
73
- ctx.key = OpenSSL::PKey::RSA.new(File.open(File.join(keys_dir, "client.key")))
74
- end
75
-
76
- Thrift::SSLSocket.new(@host, @port, 5, ssl_context)
77
- else
78
- Thrift::Socket.new(@host, @port, 5)
79
- end
80
- protocol = create_protocol(socket)
81
- transport = protocol.trans
82
- client = ThriftBenchmark::BenchmarkService::Client.new(protocol)
83
- begin
84
- start = Time.now
85
- transport.open
86
- Marshal.dump [:start, start], STDOUT
87
- rescue => e
88
- Marshal.dump [:connection_failure, Time.now], STDOUT
89
- print_exception e if @log_exceptions
90
- else
91
- begin
92
- @calls_per_client.times do
93
- Marshal.dump [:call_start, Time.now], STDOUT
94
- client.fibonacci(15)
95
- Marshal.dump [:call_end, Time.now], STDOUT
96
- end
97
- transport.close
98
- Marshal.dump [:end, Time.now], STDOUT
99
- rescue Thrift::TransportException => e
100
- Marshal.dump [:connection_error, Time.now], STDOUT
101
- print_exception e if @log_exceptions
102
- end
103
- end
104
- end
105
- end
106
-
107
- def print_exception(e)
108
- STDERR.puts "ERROR: #{e.message}"
109
- STDERR.puts "\t#{e.backtrace * "\n\t"}"
110
- end
111
- end
112
-
113
- log_exceptions = true if ARGV[0] == '-log-exceptions' and ARGV.shift
114
- tls = true if ARGV[0] == '-tls' and ARGV.shift
115
-
116
- host, port, clients_per_process, calls_per_client, protocol_type = ARGV
117
-
118
- Client.new(host, port.to_i, clients_per_process.to_i, calls_per_client.to_i, log_exceptions, tls, protocol_type).run
data/benchmark/server.rb DELETED
@@ -1,121 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Licensed to the Apache Software Foundation (ASF) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The ASF licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
- #
20
-
21
- $:.unshift File.dirname(__FILE__) + '/../lib'
22
- $:.unshift File.dirname(__FILE__) + '/../ext'
23
- require 'thrift'
24
- require 'openssl'
25
- $:.unshift File.dirname(__FILE__) + "/gen-rb"
26
- require 'benchmark_service'
27
-
28
- module Server
29
- include Thrift
30
-
31
- class BenchmarkHandler
32
- # 1-based index into the fibonacci sequence
33
- def fibonacci(n)
34
- seq = [1, 1]
35
- 3.upto(n) do
36
- seq << seq[-1] + seq[-2]
37
- end
38
- seq[n-1] # n is 1-based
39
- end
40
- end
41
-
42
- def self.create_factories(protocol_type)
43
- case protocol_type
44
- when 'binary'
45
- [FramedTransportFactory.new, BinaryProtocolFactory.new]
46
- when 'compact'
47
- [FramedTransportFactory.new, CompactProtocolFactory.new]
48
- when 'header'
49
- [HeaderTransportFactory.new, HeaderProtocolFactory.new]
50
- when 'header-compact'
51
- [HeaderTransportFactory.new, HeaderProtocolFactory.new(nil, HeaderSubprotocolID::COMPACT)]
52
- when 'header-zlib'
53
- # Note: Server doesn't add transforms - it mirrors client's transforms
54
- [HeaderTransportFactory.new, HeaderProtocolFactory.new]
55
- else
56
- [FramedTransportFactory.new, BinaryProtocolFactory.new]
57
- end
58
- end
59
-
60
- def self.start_server(host, port, serverClass, tls, protocol_type = nil)
61
- handler = BenchmarkHandler.new
62
- processor = ThriftBenchmark::BenchmarkService::Processor.new(handler)
63
- transport = if tls
64
- ssl_context = OpenSSL::SSL::SSLContext.new.tap do |ctx|
65
- ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
66
- ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
67
-
68
- keys_dir = File.expand_path("../../../test/keys", __dir__)
69
- ctx.ca_file = File.join(keys_dir, "CA.pem")
70
- ctx.cert = OpenSSL::X509::Certificate.new(File.open(File.join(keys_dir, "server.crt")))
71
- ctx.cert_store = OpenSSL::X509::Store.new
72
- ctx.cert_store.add_file(File.join(keys_dir, 'client.pem'))
73
- ctx.key = OpenSSL::PKey::RSA.new(File.open(File.join(keys_dir, "server.key")))
74
- end
75
-
76
- Thrift::SSLServerSocket.new(host, port, ssl_context)
77
- else
78
- ServerSocket.new(host, port)
79
- end
80
- transport_factory, protocol_factory = create_factories(protocol_type || 'binary')
81
- args = [processor, transport, transport_factory, protocol_factory, 20]
82
- if serverClass == NonblockingServer
83
- logger = Logger.new(STDERR)
84
- logger.level = Logger::WARN
85
- args << logger
86
- end
87
- server = serverClass.new(*args)
88
- @server_thread = Thread.new do
89
- server.serve
90
- end
91
- @server = server
92
- end
93
-
94
- def self.shutdown
95
- return if @server.nil?
96
- if @server.respond_to? :shutdown
97
- @server.shutdown
98
- else
99
- @server_thread.kill
100
- end
101
- end
102
- end
103
-
104
- def resolve_const(const)
105
- const and const.split('::').inject(Object) { |k, c| k.const_get(c) }
106
- end
107
-
108
- tls = true if ARGV[0] == '-tls' and ARGV.shift
109
-
110
- host, port, serverklass, protocol_type = ARGV
111
-
112
- Server.start_server(host, port.to_i, resolve_const(serverklass), tls, protocol_type)
113
-
114
- # let our host know that the interpreter has started
115
- # ideally we'd wait until the server was serving, but we don't have a hook for that
116
- Marshal.dump(:started, STDOUT)
117
- STDOUT.flush
118
-
119
- Marshal.load(STDIN) # wait until we're instructed to shut down
120
-
121
- Server.shutdown
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Licensed to the Apache Software Foundation (ASF) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The ASF licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
- #
20
-
21
- $:.unshift File.dirname(__FILE__) + '/../lib'
22
- $:.unshift File.dirname(__FILE__) + '/../ext'
23
- require 'thrift'
24
- $:.unshift File.dirname(__FILE__) + "/gen-rb"
25
- require 'benchmark_service'
26
- HOST = 'localhost'
27
- PORT = 42587
28
-
29
- class BenchmarkHandler
30
- # 1-based index into the fibonacci sequence
31
- def fibonacci(n)
32
- seq = [1, 1]
33
- 3.upto(n) do
34
- seq << seq[-1] + seq[-2]
35
- end
36
- seq[n-1] # n is 1-based
37
- end
38
- end
39
-
40
- handler = BenchmarkHandler.new
41
- processor = ThriftBenchmark::BenchmarkService::Processor.new(handler)
42
- transport = Thrift::ServerSocket.new(HOST, PORT)
43
- transport_factory = Thrift::FramedTransportFactory.new
44
- logger = Logger.new(STDERR)
45
- logger.level = Logger::WARN
46
- Thrift::NonblockingServer.new(processor, transport, transport_factory, nil, 20, logger).serve
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Licensed to the Apache Software Foundation (ASF) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The ASF licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
- #
20
-
21
- require 'mongrel'
22
-
23
- ## Sticks a service on a URL, using mongrel to do the HTTP work
24
- # <b>DEPRECATED:</b> Please use <tt>Thrift::ThinHTTPServer</tt> instead.
25
- module Thrift
26
- class MongrelHTTPServer < BaseServer
27
- class Handler < Mongrel::HttpHandler
28
- def initialize(processor, protocol_factory)
29
- @processor = processor
30
- @protocol_factory = protocol_factory
31
- end
32
-
33
- def process(request, response)
34
- if request.params["REQUEST_METHOD"] == "POST"
35
- response.start(200) do |head, out|
36
- head["Content-Type"] = "application/x-thrift"
37
- transport = IOStreamTransport.new request.body, out
38
- protocol = @protocol_factory.get_protocol transport
39
- @processor.process protocol, protocol
40
- end
41
- else
42
- response.start(404) {}
43
- end
44
- end
45
- end
46
-
47
- def initialize(processor, opts = {})
48
- Kernel.warn "[DEPRECATION WARNING] `Thrift::MongrelHTTPServer` is deprecated. Please use `Thrift::ThinHTTPServer` instead."
49
- port = opts[:port] || 80
50
- ip = opts[:ip] || "0.0.0.0"
51
- path = opts[:path] || ""
52
- protocol_factory = opts[:protocol_factory] || BinaryProtocolFactory.new
53
- @server = Mongrel::HttpServer.new ip, port
54
- @server.register "/#{path}", Handler.new(processor, protocol_factory)
55
- end
56
-
57
- def serve
58
- @server.run.join
59
- end
60
- end
61
- end
@@ -1,27 +0,0 @@
1
- # Licensed to the Apache Software Foundation (ASF) under one
2
- # or more contributor license agreements. See the NOTICE file
3
- # distributed with this work for additional information
4
- # regarding copyright ownership. The ASF licenses this file
5
- # to you under the Apache License, Version 2.0 (the
6
- # "License"); you may not use this file except in compliance
7
- # with the License. You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing,
12
- # software distributed under the License is distributed on an
13
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- # KIND, either express or implied. See the License for the
15
- # specific language governing permissions and limitations
16
- # under the License.
17
- #
18
-
19
- namespace rb Base
20
-
21
- struct Hello {
22
- 1: string greeting = "hello world"
23
- }
24
-
25
- service BaseService {
26
- Hello greeting(1:bool english)
27
- }
@@ -1,25 +0,0 @@
1
- # Licensed to the Apache Software Foundation (ASF) under one
2
- # or more contributor license agreements. See the NOTICE file
3
- # distributed with this work for additional information
4
- # regarding copyright ownership. The ASF licenses this file
5
- # to you under the Apache License, Version 2.0 (the
6
- # "License"); you may not use this file except in compliance
7
- # with the License. You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing,
12
- # software distributed under the License is distributed on an
13
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- # KIND, either express or implied. See the License for the
15
- # specific language governing permissions and limitations
16
- # under the License.
17
- #
18
-
19
- namespace rb Extended
20
-
21
- include "BaseService.thrift"
22
-
23
- service ExtendedService extends BaseService.BaseService {
24
- void ping()
25
- }
@@ -1,44 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one
3
- * or more contributor license agreements. See the NOTICE file
4
- * distributed with this work for additional information
5
- * regarding copyright ownership. The ASF licenses this file
6
- * to you under the Apache License, Version 2.0 (the
7
- * "License"); you may not use this file except in compliance
8
- * with the License. You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- #
21
- # Licensed to the Apache Software Foundation (ASF) under one
22
- # or more contributor license agreements. See the NOTICE file
23
- # distributed with this work for additional information
24
- # regarding copyright ownership. The ASF licenses this file
25
- # to you under the Apache License, Version 2.0 (the
26
- # "License"); you may not use this file except in compliance
27
- # with the License. You may obtain a copy of the License at
28
- #
29
- # http://www.apache.org/licenses/LICENSE-2.0
30
- #
31
- # Unless required by applicable law or agreed to in writing,
32
- # software distributed under the License is distributed on an
33
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
34
- # KIND, either express or implied. See the License for the
35
- # specific language governing permissions and limitations
36
- # under the License.
37
- #
38
-
39
- namespace rb OtherNamespace
40
-
41
- enum SomeEnum {
42
- ONE
43
- TWO
44
- }
@@ -1,53 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one
3
- * or more contributor license agreements. See the NOTICE file
4
- * distributed with this work for additional information
5
- * regarding copyright ownership. The ASF licenses this file
6
- * to you under the Apache License, Version 2.0 (the
7
- * "License"); you may not use this file except in compliance
8
- * with the License. You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- #
21
- # Licensed to the Apache Software Foundation (ASF) under one
22
- # or more contributor license agreements. See the NOTICE file
23
- # distributed with this work for additional information
24
- # regarding copyright ownership. The ASF licenses this file
25
- # to you under the Apache License, Version 2.0 (the
26
- # "License"); you may not use this file except in compliance
27
- # with the License. You may obtain a copy of the License at
28
- #
29
- # http://www.apache.org/licenses/LICENSE-2.0
30
- #
31
- # Unless required by applicable law or agreed to in writing,
32
- # software distributed under the License is distributed on an
33
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
34
- # KIND, either express or implied. See the License for the
35
- # specific language governing permissions and limitations
36
- # under the License.
37
- #
38
-
39
- namespace rb NamespacedSpecNamespace
40
-
41
- include "Referenced.thrift"
42
-
43
- struct Hello {
44
- 1: string greeting = "hello world"
45
- }
46
-
47
- service NamespacedNonblockingService {
48
- Hello greeting(1:bool english)
49
- bool block()
50
- oneway void unblock(1:i32 n)
51
- oneway void shutdown()
52
- void sleep(1:double seconds)
53
- }
@@ -1,203 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one
3
- * or more contributor license agreements. See the NOTICE file
4
- * distributed with this work for additional information
5
- * regarding copyright ownership. The ASF licenses this file
6
- * to you under the Apache License, Version 2.0 (the
7
- * "License"); you may not use this file except in compliance
8
- * with the License. You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- #
21
- # Licensed to the Apache Software Foundation (ASF) under one
22
- # or more contributor license agreements. See the NOTICE file
23
- # distributed with this work for additional information
24
- # regarding copyright ownership. The ASF licenses this file
25
- # to you under the Apache License, Version 2.0 (the
26
- # "License"); you may not use this file except in compliance
27
- # with the License. You may obtain a copy of the License at
28
- #
29
- # http://www.apache.org/licenses/LICENSE-2.0
30
- #
31
- # Unless required by applicable law or agreed to in writing,
32
- # software distributed under the License is distributed on an
33
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
34
- # KIND, either express or implied. See the License for the
35
- # specific language governing permissions and limitations
36
- # under the License.
37
- #
38
-
39
- namespace rb SpecNamespace
40
-
41
- struct Hello {
42
- 1: string greeting = "hello world"
43
- }
44
-
45
- enum SomeEnum {
46
- ONE
47
- TWO
48
- }
49
-
50
- struct StructWithSomeEnum {
51
- 1: SomeEnum some_enum;
52
- }
53
-
54
- union TestUnion {
55
- /**
56
- * A doc string
57
- */
58
- 1: string string_field;
59
- 2: i32 i32_field;
60
- 3: i32 other_i32_field;
61
- 4: SomeEnum enum_field;
62
- 5: binary binary_field;
63
- 6: uuid uuid_field;
64
- }
65
-
66
- struct Foo {
67
- 1: i32 simple = 53,
68
- 2: string words = "words",
69
- 3: Hello hello = {'greeting' : "hello, world!"},
70
- 4: list<i32> ints = [1, 2, 2, 3],
71
- 5: map<i32, map<string, double>> complex,
72
- 6: set<i16> shorts = [5, 17, 239],
73
- 7: optional string opt_string
74
- 8: bool my_bool
75
- 9: optional uuid opt_uuid
76
- }
77
-
78
- struct Foo2 {
79
- 1: binary my_binary
80
- }
81
-
82
- struct BoolStruct {
83
- 1: bool yesno = 1
84
- }
85
-
86
- struct SimpleList {
87
- 1: list<bool> bools,
88
- 2: list<byte> bytes,
89
- 3: list<i16> i16s,
90
- 4: list<i32> i32s,
91
- 5: list<i64> i64s,
92
- 6: list<double> doubles,
93
- 7: list<string> strings,
94
- 8: list<map<i16, i16>> maps,
95
- 9: list<list<i16>> lists,
96
- 10: list<set<i16>> sets,
97
- 11: list<Hello> hellos,
98
- 12: list<uuid> uuids
99
- }
100
-
101
- exception Xception {
102
- 1: string message,
103
- 2: i32 code = 1
104
- }
105
-
106
- service NonblockingService {
107
- Hello greeting(1:bool english)
108
- bool block()
109
- oneway void unblock(1:i32 n)
110
- oneway void shutdown()
111
- void sleep(1:double seconds)
112
- }
113
-
114
- union My_union {
115
- 1: bool im_true,
116
- 2: byte a_bite,
117
- 3: i16 integer16,
118
- 4: i32 integer32,
119
- 5: i64 integer64,
120
- 6: double double_precision,
121
- 7: string some_characters,
122
- 8: i32 other_i32
123
- 9: SomeEnum some_enum;
124
- 10: map<SomeEnum, list<SomeEnum>> my_map;
125
- 11: uuid unique_id;
126
- }
127
-
128
- struct Struct_with_union {
129
- 1: My_union fun_union
130
- 2: i32 integer32
131
- 3: string some_characters
132
- }
133
-
134
- struct StructWithEnumMap {
135
- 1: map<SomeEnum, list<SomeEnum>> my_map;
136
- }
137
-
138
- # Nested lists
139
- struct NestedListInList {
140
- 1: list<list<byte>> value
141
- }
142
-
143
- struct NestedListInSet {
144
- 1: set<list<byte>> value
145
- }
146
-
147
- struct NestedListInMapKey {
148
- 1: map<list<byte>, byte> value
149
- }
150
-
151
- struct NestedListInMapValue {
152
- 1: map<byte, list<byte>> value
153
- }
154
-
155
- # Nested sets
156
- struct NestedSetInList {
157
- 1: list<set<byte>> value
158
- }
159
-
160
- struct NestedSetInSet {
161
- 1: set<set<byte>> value
162
- }
163
-
164
- struct NestedSetInMapKey {
165
- 1: map<set<byte>, byte> value
166
- }
167
-
168
- struct NestedSetInMapValue {
169
- 1: map<byte, set<byte>> value
170
- }
171
-
172
- # Nested maps
173
- struct NestedMapInList {
174
- 1: list<map<byte, byte>> value
175
- }
176
-
177
- struct NestedMapInSet {
178
- 1: set<map<byte, byte>> value
179
- }
180
-
181
- struct NestedMapInMapKey {
182
- 2: map<map<byte, byte>, byte> value
183
- }
184
-
185
- struct NestedMapInMapValue {
186
- 2: map<byte, map<byte, byte>> value
187
- }
188
-
189
- # Recursive types for the struct/union/exception recursion-depth limit specs (THRIFT-6045).
190
- struct RecTree {
191
- 1: list<RecTree> children
192
- 2: i16 item
193
- }
194
-
195
- union RecUnion {
196
- 1: list<RecUnion> children
197
- 2: i32 leaf
198
- }
199
-
200
- exception RecError {
201
- 1: list<RecError> children
202
- 2: i32 leaf
203
- }