math_grpc_pb.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // GENERATED CODE -- DO NOT EDIT!
  2. // Original file comments:
  3. // Copyright 2015 gRPC authors.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // 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, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. 'use strict';
  18. var grpc = require('grpc');
  19. var math_math_pb = require('../math/math_pb.js');
  20. function serialize_DivArgs(arg) {
  21. if (!(arg instanceof math_math_pb.DivArgs)) {
  22. throw new Error('Expected argument of type DivArgs');
  23. }
  24. return new Buffer(arg.serializeBinary());
  25. }
  26. function deserialize_DivArgs(buffer_arg) {
  27. return math_math_pb.DivArgs.deserializeBinary(new Uint8Array(buffer_arg));
  28. }
  29. function serialize_DivReply(arg) {
  30. if (!(arg instanceof math_math_pb.DivReply)) {
  31. throw new Error('Expected argument of type DivReply');
  32. }
  33. return new Buffer(arg.serializeBinary());
  34. }
  35. function deserialize_DivReply(buffer_arg) {
  36. return math_math_pb.DivReply.deserializeBinary(new Uint8Array(buffer_arg));
  37. }
  38. function serialize_FibArgs(arg) {
  39. if (!(arg instanceof math_math_pb.FibArgs)) {
  40. throw new Error('Expected argument of type FibArgs');
  41. }
  42. return new Buffer(arg.serializeBinary());
  43. }
  44. function deserialize_FibArgs(buffer_arg) {
  45. return math_math_pb.FibArgs.deserializeBinary(new Uint8Array(buffer_arg));
  46. }
  47. function serialize_Num(arg) {
  48. if (!(arg instanceof math_math_pb.Num)) {
  49. throw new Error('Expected argument of type Num');
  50. }
  51. return new Buffer(arg.serializeBinary());
  52. }
  53. function deserialize_Num(buffer_arg) {
  54. return math_math_pb.Num.deserializeBinary(new Uint8Array(buffer_arg));
  55. }
  56. var MathService = exports.MathService = {
  57. // Div divides args.dividend by args.divisor and returns the quotient and
  58. // remainder.
  59. div: {
  60. path: '/math.Math/Div',
  61. requestStream: false,
  62. responseStream: false,
  63. requestType: math_math_pb.DivArgs,
  64. responseType: math_math_pb.DivReply,
  65. requestSerialize: serialize_DivArgs,
  66. requestDeserialize: deserialize_DivArgs,
  67. responseSerialize: serialize_DivReply,
  68. responseDeserialize: deserialize_DivReply,
  69. },
  70. // DivMany accepts an arbitrary number of division args from the client stream
  71. // and sends back the results in the reply stream. The stream continues until
  72. // the client closes its end; the server does the same after sending all the
  73. // replies. The stream ends immediately if either end aborts.
  74. divMany: {
  75. path: '/math.Math/DivMany',
  76. requestStream: true,
  77. responseStream: true,
  78. requestType: math_math_pb.DivArgs,
  79. responseType: math_math_pb.DivReply,
  80. requestSerialize: serialize_DivArgs,
  81. requestDeserialize: deserialize_DivArgs,
  82. responseSerialize: serialize_DivReply,
  83. responseDeserialize: deserialize_DivReply,
  84. },
  85. // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
  86. // generates up to limit numbers; otherwise it continues until the call is
  87. // canceled. Unlike Fib above, Fib has no final FibReply.
  88. fib: {
  89. path: '/math.Math/Fib',
  90. requestStream: false,
  91. responseStream: true,
  92. requestType: math_math_pb.FibArgs,
  93. responseType: math_math_pb.Num,
  94. requestSerialize: serialize_FibArgs,
  95. requestDeserialize: deserialize_FibArgs,
  96. responseSerialize: serialize_Num,
  97. responseDeserialize: deserialize_Num,
  98. },
  99. // Sum sums a stream of numbers, returning the final result once the stream
  100. // is closed.
  101. sum: {
  102. path: '/math.Math/Sum',
  103. requestStream: true,
  104. responseStream: false,
  105. requestType: math_math_pb.Num,
  106. responseType: math_math_pb.Num,
  107. requestSerialize: serialize_Num,
  108. requestDeserialize: deserialize_Num,
  109. responseSerialize: serialize_Num,
  110. responseDeserialize: deserialize_Num,
  111. },
  112. };
  113. exports.MathClient = grpc.makeGenericClientConstructor(MathService);