math_with_protoc_options.proto 1.8 KB

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