MathGrpc.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: math/math.proto
  3. // Original file comments:
  4. // Copyright 2015, Google Inc.
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are
  9. // met:
  10. //
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Google Inc. nor the names of its
  18. // contributors may be used to endorse or promote products derived from
  19. // this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. //
  33. #region Designer generated code
  34. using System;
  35. using System.Threading;
  36. using System.Threading.Tasks;
  37. using grpc = global::Grpc.Core;
  38. namespace Math {
  39. public static partial class Math
  40. {
  41. static readonly string __ServiceName = "math.Math";
  42. static readonly grpc::Marshaller<global::Math.DivArgs> __Marshaller_DivArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivArgs.Parser.ParseFrom);
  43. static readonly grpc::Marshaller<global::Math.DivReply> __Marshaller_DivReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivReply.Parser.ParseFrom);
  44. static readonly grpc::Marshaller<global::Math.FibArgs> __Marshaller_FibArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.FibArgs.Parser.ParseFrom);
  45. static readonly grpc::Marshaller<global::Math.Num> __Marshaller_Num = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.Num.Parser.ParseFrom);
  46. static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_Div = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>(
  47. grpc::MethodType.Unary,
  48. __ServiceName,
  49. "Div",
  50. __Marshaller_DivArgs,
  51. __Marshaller_DivReply);
  52. static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_DivMany = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>(
  53. grpc::MethodType.DuplexStreaming,
  54. __ServiceName,
  55. "DivMany",
  56. __Marshaller_DivArgs,
  57. __Marshaller_DivReply);
  58. static readonly grpc::Method<global::Math.FibArgs, global::Math.Num> __Method_Fib = new grpc::Method<global::Math.FibArgs, global::Math.Num>(
  59. grpc::MethodType.ServerStreaming,
  60. __ServiceName,
  61. "Fib",
  62. __Marshaller_FibArgs,
  63. __Marshaller_Num);
  64. static readonly grpc::Method<global::Math.Num, global::Math.Num> __Method_Sum = new grpc::Method<global::Math.Num, global::Math.Num>(
  65. grpc::MethodType.ClientStreaming,
  66. __ServiceName,
  67. "Sum",
  68. __Marshaller_Num,
  69. __Marshaller_Num);
  70. /// <summary>Service descriptor</summary>
  71. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  72. {
  73. get { return global::Math.MathReflection.Descriptor.Services[0]; }
  74. }
  75. /// <summary>Base class for server-side implementations of Math</summary>
  76. public abstract partial class MathBase
  77. {
  78. /// <summary>
  79. /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
  80. /// and remainder.
  81. /// </summary>
  82. /// <param name="request">The request received from the client.</param>
  83. /// <param name="context">The context of the server-side call handler being invoked.</param>
  84. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  85. public virtual global::System.Threading.Tasks.Task<global::Math.DivReply> Div(global::Math.DivArgs request, grpc::ServerCallContext context)
  86. {
  87. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  88. }
  89. /// <summary>
  90. /// DivMany accepts an arbitrary number of division args from the client stream
  91. /// and sends back the results in the reply stream. The stream continues until
  92. /// the client closes its end; the server does the same after sending all the
  93. /// replies. The stream ends immediately if either end aborts.
  94. /// </summary>
  95. /// <param name="requestStream">Used for reading requests from the client.</param>
  96. /// <param name="responseStream">Used for sending responses back to the client.</param>
  97. /// <param name="context">The context of the server-side call handler being invoked.</param>
  98. /// <returns>A task indicating completion of the handler.</returns>
  99. public virtual global::System.Threading.Tasks.Task DivMany(grpc::IAsyncStreamReader<global::Math.DivArgs> requestStream, grpc::IServerStreamWriter<global::Math.DivReply> responseStream, grpc::ServerCallContext context)
  100. {
  101. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  102. }
  103. /// <summary>
  104. /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
  105. /// generates up to limit numbers; otherwise it continues until the call is
  106. /// canceled. Unlike Fib above, Fib has no final FibReply.
  107. /// </summary>
  108. /// <param name="request">The request received from the client.</param>
  109. /// <param name="responseStream">Used for sending responses back to the client.</param>
  110. /// <param name="context">The context of the server-side call handler being invoked.</param>
  111. /// <returns>A task indicating completion of the handler.</returns>
  112. public virtual global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, grpc::IServerStreamWriter<global::Math.Num> responseStream, grpc::ServerCallContext context)
  113. {
  114. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  115. }
  116. /// <summary>
  117. /// Sum sums a stream of numbers, returning the final result once the stream
  118. /// is closed.
  119. /// </summary>
  120. /// <param name="requestStream">Used for reading requests from the client.</param>
  121. /// <param name="context">The context of the server-side call handler being invoked.</param>
  122. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  123. public virtual global::System.Threading.Tasks.Task<global::Math.Num> Sum(grpc::IAsyncStreamReader<global::Math.Num> requestStream, grpc::ServerCallContext context)
  124. {
  125. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  126. }
  127. }
  128. /// <summary>Client for Math</summary>
  129. public partial class MathClient : grpc::ClientBase<MathClient>
  130. {
  131. /// <summary>Creates a new client for Math</summary>
  132. /// <param name="channel">The channel to use to make remote calls.</param>
  133. public MathClient(grpc::Channel channel) : base(channel)
  134. {
  135. }
  136. /// <summary>Creates a new client for Math that uses a custom <c>CallInvoker</c>.</summary>
  137. /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
  138. public MathClient(grpc::CallInvoker callInvoker) : base(callInvoker)
  139. {
  140. }
  141. /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  142. protected MathClient() : base()
  143. {
  144. }
  145. /// <summary>Protected constructor to allow creation of configured clients.</summary>
  146. /// <param name="configuration">The client configuration.</param>
  147. protected MathClient(ClientBaseConfiguration configuration) : base(configuration)
  148. {
  149. }
  150. /// <summary>
  151. /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
  152. /// and remainder.
  153. /// </summary>
  154. /// <param name="request">The request to send to the server.</param>
  155. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  156. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  157. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  158. /// <returns>The response received from the server.</returns>
  159. public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  160. {
  161. return Div(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  162. }
  163. /// <summary>
  164. /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
  165. /// and remainder.
  166. /// </summary>
  167. /// <param name="request">The request to send to the server.</param>
  168. /// <param name="options">The options for the call.</param>
  169. /// <returns>The response received from the server.</returns>
  170. public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::CallOptions options)
  171. {
  172. return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request);
  173. }
  174. /// <summary>
  175. /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
  176. /// and remainder.
  177. /// </summary>
  178. /// <param name="request">The request to send to the server.</param>
  179. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  180. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  181. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  182. /// <returns>The call object.</returns>
  183. public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  184. {
  185. return DivAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  186. }
  187. /// <summary>
  188. /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
  189. /// and remainder.
  190. /// </summary>
  191. /// <param name="request">The request to send to the server.</param>
  192. /// <param name="options">The options for the call.</param>
  193. /// <returns>The call object.</returns>
  194. public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::CallOptions options)
  195. {
  196. return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request);
  197. }
  198. /// <summary>
  199. /// DivMany accepts an arbitrary number of division args from the client stream
  200. /// and sends back the results in the reply stream. The stream continues until
  201. /// the client closes its end; the server does the same after sending all the
  202. /// replies. The stream ends immediately if either end aborts.
  203. /// </summary>
  204. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  205. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  206. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  207. /// <returns>The call object.</returns>
  208. public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  209. {
  210. return DivMany(new grpc::CallOptions(headers, deadline, cancellationToken));
  211. }
  212. /// <summary>
  213. /// DivMany accepts an arbitrary number of division args from the client stream
  214. /// and sends back the results in the reply stream. The stream continues until
  215. /// the client closes its end; the server does the same after sending all the
  216. /// replies. The stream ends immediately if either end aborts.
  217. /// </summary>
  218. /// <param name="options">The options for the call.</param>
  219. /// <returns>The call object.</returns>
  220. public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::CallOptions options)
  221. {
  222. return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options);
  223. }
  224. /// <summary>
  225. /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
  226. /// generates up to limit numbers; otherwise it continues until the call is
  227. /// canceled. Unlike Fib above, Fib has no final FibReply.
  228. /// </summary>
  229. /// <param name="request">The request to send to the server.</param>
  230. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  231. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  232. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  233. /// <returns>The call object.</returns>
  234. public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  235. {
  236. return Fib(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  237. }
  238. /// <summary>
  239. /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
  240. /// generates up to limit numbers; otherwise it continues until the call is
  241. /// canceled. Unlike Fib above, Fib has no final FibReply.
  242. /// </summary>
  243. /// <param name="request">The request to send to the server.</param>
  244. /// <param name="options">The options for the call.</param>
  245. /// <returns>The call object.</returns>
  246. public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::CallOptions options)
  247. {
  248. return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request);
  249. }
  250. /// <summary>
  251. /// Sum sums a stream of numbers, returning the final result once the stream
  252. /// is closed.
  253. /// </summary>
  254. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  255. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  256. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  257. /// <returns>The call object.</returns>
  258. public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  259. {
  260. return Sum(new grpc::CallOptions(headers, deadline, cancellationToken));
  261. }
  262. /// <summary>
  263. /// Sum sums a stream of numbers, returning the final result once the stream
  264. /// is closed.
  265. /// </summary>
  266. /// <param name="options">The options for the call.</param>
  267. /// <returns>The call object.</returns>
  268. public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::CallOptions options)
  269. {
  270. return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options);
  271. }
  272. /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
  273. protected override MathClient NewInstance(ClientBaseConfiguration configuration)
  274. {
  275. return new MathClient(configuration);
  276. }
  277. }
  278. /// <summary>Creates service definition that can be registered with a server</summary>
  279. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  280. public static grpc::ServerServiceDefinition BindService(MathBase serviceImpl)
  281. {
  282. return grpc::ServerServiceDefinition.CreateBuilder()
  283. .AddMethod(__Method_Div, serviceImpl.Div)
  284. .AddMethod(__Method_DivMany, serviceImpl.DivMany)
  285. .AddMethod(__Method_Fib, serviceImpl.Fib)
  286. .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
  287. }
  288. }
  289. }
  290. #endregion