grpc 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +10 -0
  5. data/.rubocop_todo.yml +52 -0
  6. data/Gemfile +4 -0
  7. data/README.md +82 -0
  8. data/Rakefile +54 -0
  9. data/bin/apis/google/protobuf/empty.rb +44 -0
  10. data/bin/apis/pubsub_demo.rb +267 -0
  11. data/bin/apis/tech/pubsub/proto/pubsub.rb +174 -0
  12. data/bin/apis/tech/pubsub/proto/pubsub_services.rb +103 -0
  13. data/bin/interop/README.md +8 -0
  14. data/bin/interop/interop_client.rb +334 -0
  15. data/bin/interop/interop_server.rb +192 -0
  16. data/bin/interop/test/cpp/interop/empty.rb +44 -0
  17. data/bin/interop/test/cpp/interop/messages.rb +89 -0
  18. data/bin/interop/test/cpp/interop/test.rb +43 -0
  19. data/bin/interop/test/cpp/interop/test_services.rb +60 -0
  20. data/bin/math.proto +80 -0
  21. data/bin/math.rb +61 -0
  22. data/bin/math_client.rb +147 -0
  23. data/bin/math_server.rb +190 -0
  24. data/bin/math_services.rb +56 -0
  25. data/bin/noproto_client.rb +108 -0
  26. data/bin/noproto_server.rb +112 -0
  27. data/ext/grpc/extconf.rb +76 -0
  28. data/ext/grpc/rb_byte_buffer.c +241 -0
  29. data/ext/grpc/rb_byte_buffer.h +54 -0
  30. data/ext/grpc/rb_call.c +569 -0
  31. data/ext/grpc/rb_call.h +59 -0
  32. data/ext/grpc/rb_channel.c +264 -0
  33. data/ext/grpc/rb_channel.h +49 -0
  34. data/ext/grpc/rb_channel_args.c +154 -0
  35. data/ext/grpc/rb_channel_args.h +52 -0
  36. data/ext/grpc/rb_completion_queue.c +185 -0
  37. data/ext/grpc/rb_completion_queue.h +50 -0
  38. data/ext/grpc/rb_credentials.c +281 -0
  39. data/ext/grpc/rb_credentials.h +50 -0
  40. data/ext/grpc/rb_event.c +361 -0
  41. data/ext/grpc/rb_event.h +53 -0
  42. data/ext/grpc/rb_grpc.c +274 -0
  43. data/ext/grpc/rb_grpc.h +74 -0
  44. data/ext/grpc/rb_metadata.c +215 -0
  45. data/ext/grpc/rb_metadata.h +53 -0
  46. data/ext/grpc/rb_server.c +278 -0
  47. data/ext/grpc/rb_server.h +50 -0
  48. data/ext/grpc/rb_server_credentials.c +210 -0
  49. data/ext/grpc/rb_server_credentials.h +50 -0
  50. data/grpc.gemspec +41 -0
  51. data/lib/grpc.rb +39 -0
  52. data/lib/grpc/core/event.rb +44 -0
  53. data/lib/grpc/core/time_consts.rb +71 -0
  54. data/lib/grpc/errors.rb +61 -0
  55. data/lib/grpc/generic/active_call.rb +536 -0
  56. data/lib/grpc/generic/bidi_call.rb +221 -0
  57. data/lib/grpc/generic/client_stub.rb +413 -0
  58. data/lib/grpc/generic/rpc_desc.rb +150 -0
  59. data/lib/grpc/generic/rpc_server.rb +404 -0
  60. data/lib/grpc/generic/service.rb +235 -0
  61. data/lib/grpc/logconfig.rb +40 -0
  62. data/lib/grpc/version.rb +33 -0
  63. data/spec/alloc_spec.rb +44 -0
  64. data/spec/byte_buffer_spec.rb +67 -0
  65. data/spec/call_spec.rb +163 -0
  66. data/spec/channel_spec.rb +181 -0
  67. data/spec/client_server_spec.rb +372 -0
  68. data/spec/completion_queue_spec.rb +74 -0
  69. data/spec/credentials_spec.rb +71 -0
  70. data/spec/event_spec.rb +53 -0
  71. data/spec/generic/active_call_spec.rb +373 -0
  72. data/spec/generic/client_stub_spec.rb +519 -0
  73. data/spec/generic/rpc_desc_spec.rb +357 -0
  74. data/spec/generic/rpc_server_pool_spec.rb +139 -0
  75. data/spec/generic/rpc_server_spec.rb +404 -0
  76. data/spec/generic/service_spec.rb +342 -0
  77. data/spec/metadata_spec.rb +64 -0
  78. data/spec/server_credentials_spec.rb +69 -0
  79. data/spec/server_spec.rb +212 -0
  80. data/spec/spec_helper.rb +51 -0
  81. data/spec/testdata/README +1 -0
  82. data/spec/testdata/ca.pem +15 -0
  83. data/spec/testdata/server1.key +16 -0
  84. data/spec/testdata/server1.pem +16 -0
  85. data/spec/time_consts_spec.rb +89 -0
  86. metadata +353 -0
@@ -0,0 +1,61 @@
1
+ # Copyright 2015, Google Inc.
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are
6
+ # met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above
11
+ # copyright notice, this list of conditions and the following disclaimer
12
+ # in the documentation and/or other materials provided with the
13
+ # distribution.
14
+ # * Neither the name of Google Inc. nor the names of its
15
+ # contributors may be used to endorse or promote products derived from
16
+ # this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
31
+ # source: math.proto
32
+
33
+ require 'google/protobuf'
34
+
35
+ Google::Protobuf::DescriptorPool.generated_pool.build do
36
+ add_message "math.DivArgs" do
37
+ optional :dividend, :int64, 1
38
+ optional :divisor, :int64, 2
39
+ end
40
+ add_message "math.DivReply" do
41
+ optional :quotient, :int64, 1
42
+ optional :remainder, :int64, 2
43
+ end
44
+ add_message "math.FibArgs" do
45
+ optional :limit, :int64, 1
46
+ end
47
+ add_message "math.Num" do
48
+ optional :num, :int64, 1
49
+ end
50
+ add_message "math.FibReply" do
51
+ optional :count, :int64, 1
52
+ end
53
+ end
54
+
55
+ module Math
56
+ DivArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.DivArgs").msgclass
57
+ DivReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.DivReply").msgclass
58
+ FibArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibArgs").msgclass
59
+ Num = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.Num").msgclass
60
+ FibReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibReply").msgclass
61
+ end
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2015, Google Inc.
4
+ # All rights reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are
8
+ # met:
9
+ #
10
+ # * Redistributions of source code must retain the above copyright
11
+ # notice, this list of conditions and the following disclaimer.
12
+ # * Redistributions in binary form must reproduce the above
13
+ # copyright notice, this list of conditions and the following disclaimer
14
+ # in the documentation and/or other materials provided with the
15
+ # distribution.
16
+ # * Neither the name of Google Inc. nor the names of its
17
+ # contributors may be used to endorse or promote products derived from
18
+ # this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ # Sample app that accesses a Calc service running on a Ruby gRPC server and
33
+ # helps validate RpcServer as a gRPC server using proto2 serialization.
34
+ #
35
+ # Usage: $ path/to/math_client.rb
36
+
37
+ this_dir = File.expand_path(File.dirname(__FILE__))
38
+ lib_dir = File.join(File.dirname(this_dir), 'lib')
39
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
40
+ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
41
+
42
+ require 'grpc'
43
+ require 'math_services'
44
+ require 'optparse'
45
+
46
+ include GRPC::Core::TimeConsts
47
+
48
+ def do_div(stub)
49
+ logger.info('request_response')
50
+ logger.info('----------------')
51
+ req = Math::DivArgs.new(dividend: 7, divisor: 3)
52
+ logger.info("div(7/3): req=#{req.inspect}")
53
+ resp = stub.div(req, INFINITE_FUTURE)
54
+ logger.info("Answer: #{resp.inspect}")
55
+ logger.info('----------------')
56
+ end
57
+
58
+ def do_sum(stub)
59
+ # to make client streaming requests, pass an enumerable of the inputs
60
+ logger.info('client_streamer')
61
+ logger.info('---------------')
62
+ reqs = [1, 2, 3, 4, 5].map { |x| Math::Num.new(num: x) }
63
+ logger.info("sum(1, 2, 3, 4, 5): reqs=#{reqs.inspect}")
64
+ resp = stub.sum(reqs) # reqs.is_a?(Enumerable)
65
+ logger.info("Answer: #{resp.inspect}")
66
+ logger.info('---------------')
67
+ end
68
+
69
+ def do_fib(stub)
70
+ logger.info('server_streamer')
71
+ logger.info('----------------')
72
+ req = Math::FibArgs.new(limit: 11)
73
+ logger.info("fib(11): req=#{req.inspect}")
74
+ resp = stub.fib(req, INFINITE_FUTURE)
75
+ resp.each do |r|
76
+ logger.info("Answer: #{r.inspect}")
77
+ end
78
+ logger.info('----------------')
79
+ end
80
+
81
+ def do_div_many(stub)
82
+ logger.info('bidi_streamer')
83
+ logger.info('-------------')
84
+ reqs = []
85
+ reqs << Math::DivArgs.new(dividend: 7, divisor: 3)
86
+ reqs << Math::DivArgs.new(dividend: 5, divisor: 2)
87
+ reqs << Math::DivArgs.new(dividend: 7, divisor: 2)
88
+ logger.info("div(7/3), div(5/2), div(7/2): reqs=#{reqs.inspect}")
89
+ resp = stub.div_many(reqs, 10)
90
+ resp.each do |r|
91
+ logger.info("Answer: #{r.inspect}")
92
+ end
93
+ logger.info('----------------')
94
+ end
95
+
96
+ def load_test_certs
97
+ this_dir = File.expand_path(File.dirname(__FILE__))
98
+ data_dir = File.join(File.dirname(this_dir), 'spec/testdata')
99
+ files = ['ca.pem', 'server1.key', 'server1.pem']
100
+ files.map { |f| File.open(File.join(data_dir, f)).read }
101
+ end
102
+
103
+ def test_creds
104
+ certs = load_test_certs
105
+ GRPC::Core::Credentials.new(certs[0])
106
+ end
107
+
108
+ def main
109
+ options = {
110
+ 'host' => 'localhost:7071',
111
+ 'secure' => false
112
+ }
113
+ OptionParser.new do |opts|
114
+ opts.banner = 'Usage: [--host <hostname>:<port>] [--secure|-s]'
115
+ opts.on('--host HOST', '<hostname>:<port>') do |v|
116
+ options['host'] = v
117
+ end
118
+ opts.on('-s', '--secure', 'access using test creds') do |v|
119
+ options['secure'] = v
120
+ end
121
+ end.parse!
122
+
123
+ # The Math::Math:: module occurs because the service has the same name as its
124
+ # package. That practice should be avoided by defining real services.
125
+
126
+ p options
127
+ if options['secure']
128
+ stub_opts = {
129
+ :creds => test_creds,
130
+ GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr'
131
+ }
132
+ p stub_opts
133
+ p options['host']
134
+ stub = Math::Math::Stub.new(options['host'], **stub_opts)
135
+ logger.info("... connecting securely on #{options['host']}")
136
+ else
137
+ stub = Math::Math::Stub.new(options['host'])
138
+ logger.info("... connecting insecurely on #{options['host']}")
139
+ end
140
+
141
+ do_div(stub)
142
+ do_sum(stub)
143
+ do_fib(stub)
144
+ do_div_many(stub)
145
+ end
146
+
147
+ main
@@ -0,0 +1,190 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2015, Google Inc.
4
+ # All rights reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are
8
+ # met:
9
+ #
10
+ # * Redistributions of source code must retain the above copyright
11
+ # notice, this list of conditions and the following disclaimer.
12
+ # * Redistributions in binary form must reproduce the above
13
+ # copyright notice, this list of conditions and the following disclaimer
14
+ # in the documentation and/or other materials provided with the
15
+ # distribution.
16
+ # * Neither the name of Google Inc. nor the names of its
17
+ # contributors may be used to endorse or promote products derived from
18
+ # this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ # Sample gRPC Ruby server that implements the Math::Calc service and helps
33
+ # validate GRPC::RpcServer as GRPC implementation using proto2 serialization.
34
+ #
35
+ # Usage: $ path/to/math_server.rb
36
+
37
+ this_dir = File.expand_path(File.dirname(__FILE__))
38
+ lib_dir = File.join(File.dirname(this_dir), 'lib')
39
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
40
+ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
41
+
42
+ require 'forwardable'
43
+ require 'grpc'
44
+ require 'math_services'
45
+ require 'optparse'
46
+
47
+ # Holds state for a fibonacci series
48
+ class Fibber
49
+ def initialize(limit)
50
+ fail "bad limit: got #{limit}, want limit > 0" if limit < 1
51
+ @limit = limit
52
+ end
53
+
54
+ def generator
55
+ return enum_for(:generator) unless block_given?
56
+ idx, current, previous = 0, 1, 1
57
+ until idx == @limit
58
+ if idx == 0 || idx == 1
59
+ yield Math::Num.new(num: 1)
60
+ idx += 1
61
+ next
62
+ end
63
+ tmp = current
64
+ current = previous + current
65
+ previous = tmp
66
+ yield Math::Num.new(num: current)
67
+ idx += 1
68
+ end
69
+ end
70
+ end
71
+
72
+ # A EnumeratorQueue wraps a Queue to yield the items added to it.
73
+ class EnumeratorQueue
74
+ extend Forwardable
75
+ def_delegators :@q, :push
76
+
77
+ def initialize(sentinel)
78
+ @q = Queue.new
79
+ @sentinel = sentinel
80
+ end
81
+
82
+ def each_item
83
+ return enum_for(:each_item) unless block_given?
84
+ loop do
85
+ r = @q.pop
86
+ break if r.equal?(@sentinel)
87
+ fail r if r.is_a? Exception
88
+ yield r
89
+ end
90
+ end
91
+ end
92
+
93
+ # The Math::Math:: module occurs because the service has the same name as its
94
+ # package. That practice should be avoided by defining real services.
95
+ class Calculator < Math::Math::Service
96
+ def div(div_args, _call)
97
+ if div_args.divisor == 0
98
+ # To send non-OK status handlers raise a StatusError with the code and
99
+ # and detail they want sent as a Status.
100
+ fail GRPC::StatusError.new(GRPC::Status::INVALID_ARGUMENT,
101
+ 'divisor cannot be 0')
102
+ end
103
+
104
+ Math::DivReply.new(quotient: div_args.dividend / div_args.divisor,
105
+ remainder: div_args.dividend % div_args.divisor)
106
+ end
107
+
108
+ def sum(call)
109
+ # the requests are accesible as the Enumerator call#each_request
110
+ nums = call.each_remote_read.collect(&:num)
111
+ sum = nums.inject { |s, x| s + x }
112
+ Math::Num.new(num: sum)
113
+ end
114
+
115
+ def fib(fib_args, _call)
116
+ if fib_args.limit < 1
117
+ fail StatusError.new(Status::INVALID_ARGUMENT, 'limit must be >= 0')
118
+ end
119
+
120
+ # return an Enumerator of Nums
121
+ Fibber.new(fib_args.limit).generator
122
+ # just return the generator, GRPC::GenericServer sends each actual response
123
+ end
124
+
125
+ def div_many(requests)
126
+ # requests is an lazy Enumerator of the requests sent by the client.
127
+ q = EnumeratorQueue.new(self)
128
+ t = Thread.new do
129
+ begin
130
+ requests.each do |req|
131
+ logger.info("read #{req.inspect}")
132
+ resp = Math::DivReply.new(quotient: req.dividend / req.divisor,
133
+ remainder: req.dividend % req.divisor)
134
+ q.push(resp)
135
+ Thread.pass # let the internal Bidi threads run
136
+ end
137
+ logger.info('finished reads')
138
+ q.push(self)
139
+ rescue StandardError => e
140
+ q.push(e) # share the exception with the enumerator
141
+ raise e
142
+ end
143
+ end
144
+ t.priority = -2 # hint that the div_many thread should not be favoured
145
+ q.each_item
146
+ end
147
+ end
148
+
149
+ def load_test_certs
150
+ this_dir = File.expand_path(File.dirname(__FILE__))
151
+ data_dir = File.join(File.dirname(this_dir), 'spec/testdata')
152
+ files = ['ca.pem', 'server1.key', 'server1.pem']
153
+ files.map { |f| File.open(File.join(data_dir, f)).read }
154
+ end
155
+
156
+ def test_server_creds
157
+ certs = load_test_certs
158
+ GRPC::Core::ServerCredentials.new(nil, certs[1], certs[2])
159
+ end
160
+
161
+ def main
162
+ options = {
163
+ 'host' => 'localhost:7071',
164
+ 'secure' => false
165
+ }
166
+ OptionParser.new do |opts|
167
+ opts.banner = 'Usage: [--host <hostname>:<port>] [--secure|-s]'
168
+ opts.on('--host HOST', '<hostname>:<port>') do |v|
169
+ options['host'] = v
170
+ end
171
+ opts.on('-s', '--secure', 'access using test creds') do |v|
172
+ options['secure'] = v
173
+ end
174
+ end.parse!
175
+
176
+ if options['secure']
177
+ s = GRPC::RpcServer.new(creds: test_server_creds)
178
+ s.add_http2_port(options['host'], true)
179
+ logger.info("... running securely on #{options['host']}")
180
+ else
181
+ s = GRPC::RpcServer.new
182
+ s.add_http2_port(options['host'])
183
+ logger.info("... running insecurely on #{options['host']}")
184
+ end
185
+
186
+ s.handle(Calculator)
187
+ s.run
188
+ end
189
+
190
+ main
@@ -0,0 +1,56 @@
1
+ # Copyright 2015, Google Inc.
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are
6
+ # met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above
11
+ # copyright notice, this list of conditions and the following disclaimer
12
+ # in the documentation and/or other materials provided with the
13
+ # distribution.
14
+ # * Neither the name of Google Inc. nor the names of its
15
+ # contributors may be used to endorse or promote products derived from
16
+ # this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
31
+ # Source: math.proto for package 'math'
32
+
33
+ require 'grpc'
34
+ require 'math'
35
+
36
+ module Math
37
+ module Math
38
+
39
+ # TODO: add proto service documentation here
40
+ class Service
41
+
42
+ include GRPC::GenericService
43
+
44
+ self.marshal_class_method = :encode
45
+ self.unmarshal_class_method = :decode
46
+ self.service_name = 'math.Math'
47
+
48
+ rpc :Div, DivArgs, DivReply
49
+ rpc :DivMany, stream(DivArgs), stream(DivReply)
50
+ rpc :Fib, FibArgs, stream(Num)
51
+ rpc :Sum, stream(Num), Num
52
+ end
53
+
54
+ Stub = Service.rpc_stub_class
55
+ end
56
+ end