| 1 |
|
| 2 |
// Copyright 2015 gRPC authors. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
// you may not use this file except in compliance with the License. |
| 6 |
// You may obtain a copy of the License at |
| 7 |
// |
| 8 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
// |
| 10 |
// Unless required by applicable law or agreed to in writing, software |
| 11 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
// See the License for the specific language governing permissions and |
| 14 |
// limitations under the License. |
| 15 |
|
| 16 |
syntax = "proto3"; |
| 17 |
|
| 18 |
package math; |
| 19 |
|
| 20 |
message DivArgs { |
| 21 |
int64 dividend = 1; |
| 22 |
int64 divisor = 2; |
| 23 |
} |
| 24 |
|
| 25 |
message DivReply { |
| 26 |
int64 quotient = 1; |
| 27 |
int64 remainder = 2; |
| 28 |
} |
| 29 |
|
| 30 |
message FibArgs { |
| 31 |
int64 limit = 1; |
| 32 |
} |
| 33 |
|
| 34 |
message Num { |
| 35 |
int64 num = 1; |
| 36 |
} |
| 37 |
|
| 38 |
message FibReply { |
| 39 |
int64 count = 1; |
| 40 |
} |
| 41 |
|
| 42 |
service Math { |
| 43 |
// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient |
| 44 |
// and remainder. |
| 45 |
rpc Div (DivArgs) returns (DivReply) { |
| 46 |
} |
| 47 |
|
| 48 |
// DivMany accepts an arbitrary number of division args from the client stream |
| 49 |
// and sends back the results in the reply stream. The stream continues until |
| 50 |
// the client closes its end; the server does the same after sending all the |
| 51 |
// replies. The stream ends immediately if either end aborts. |
| 52 |
rpc DivMany (stream DivArgs) returns (stream DivReply) { |
| 53 |
} |
| 54 |
|
| 55 |
// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib |
| 56 |
// generates up to limit numbers; otherwise it continues until the call is |
| 57 |
// canceled. Unlike Fib above, Fib has no final FibReply. |
| 58 |
rpc Fib (FibArgs) returns (stream Num) { |
| 59 |
} |
| 60 |
|
| 61 |
// Sum sums a stream of numbers, returning the final result once the stream |
| 62 |
// is closed. |
| 63 |
rpc Sum (stream Num) returns (Num) { |
| 64 |
} |
| 65 |
} |