ServicesGrpc.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: src/proto/grpc/testing/services.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. // An integration test service that covers all the method signature permutations
  34. // of unary/streaming requests/responses.
  35. #region Designer generated code
  36. using System;
  37. using System.Threading;
  38. using System.Threading.Tasks;
  39. using Grpc.Core;
  40. namespace Grpc.Testing {
  41. public static class BenchmarkService
  42. {
  43. static readonly string __ServiceName = "grpc.testing.BenchmarkService";
  44. static readonly Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_SimpleRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleRequest.Parser.ParseFrom);
  45. static readonly Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_SimpleResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleResponse.Parser.ParseFrom);
  46. static readonly Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_UnaryCall = new Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>(
  47. MethodType.Unary,
  48. __ServiceName,
  49. "UnaryCall",
  50. __Marshaller_SimpleRequest,
  51. __Marshaller_SimpleResponse);
  52. static readonly Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_StreamingCall = new Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>(
  53. MethodType.DuplexStreaming,
  54. __ServiceName,
  55. "StreamingCall",
  56. __Marshaller_SimpleRequest,
  57. __Marshaller_SimpleResponse);
  58. /// <summary>Service descriptor</summary>
  59. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  60. {
  61. get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; }
  62. }
  63. /// <summary>Base class for server-side implementations of BenchmarkService</summary>
  64. public abstract class BenchmarkServiceBase
  65. {
  66. /// <summary>
  67. /// One request followed by one response.
  68. /// The server returns the client payload as-is.
  69. /// </summary>
  70. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
  71. {
  72. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  73. }
  74. /// <summary>
  75. /// One request followed by one response.
  76. /// The server returns the client payload as-is.
  77. /// </summary>
  78. public virtual global::System.Threading.Tasks.Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context)
  79. {
  80. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  81. }
  82. }
  83. /// <summary>Client for BenchmarkService</summary>
  84. public class BenchmarkServiceClient : ClientBase<BenchmarkServiceClient>
  85. {
  86. public BenchmarkServiceClient(Channel channel) : base(channel)
  87. {
  88. }
  89. public BenchmarkServiceClient(CallInvoker callInvoker) : base(callInvoker)
  90. {
  91. }
  92. ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  93. protected BenchmarkServiceClient() : base()
  94. {
  95. }
  96. ///<summary>Protected constructor to allow creation of configured clients.</summary>
  97. protected BenchmarkServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  98. {
  99. }
  100. /// <summary>
  101. /// One request followed by one response.
  102. /// The server returns the client payload as-is.
  103. /// </summary>
  104. public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  105. {
  106. return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
  107. }
  108. /// <summary>
  109. /// One request followed by one response.
  110. /// The server returns the client payload as-is.
  111. /// </summary>
  112. public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
  113. {
  114. return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
  115. }
  116. /// <summary>
  117. /// One request followed by one response.
  118. /// The server returns the client payload as-is.
  119. /// </summary>
  120. public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  121. {
  122. return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
  123. }
  124. /// <summary>
  125. /// One request followed by one response.
  126. /// The server returns the client payload as-is.
  127. /// </summary>
  128. public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
  129. {
  130. return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
  131. }
  132. /// <summary>
  133. /// One request followed by one response.
  134. /// The server returns the client payload as-is.
  135. /// </summary>
  136. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  137. {
  138. return StreamingCall(new CallOptions(headers, deadline, cancellationToken));
  139. }
  140. /// <summary>
  141. /// One request followed by one response.
  142. /// The server returns the client payload as-is.
  143. /// </summary>
  144. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options)
  145. {
  146. return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options);
  147. }
  148. protected override BenchmarkServiceClient NewInstance(ClientBaseConfiguration configuration)
  149. {
  150. return new BenchmarkServiceClient(configuration);
  151. }
  152. }
  153. /// <summary>Creates a new client for BenchmarkService</summary>
  154. public static BenchmarkServiceClient NewClient(Channel channel)
  155. {
  156. return new BenchmarkServiceClient(channel);
  157. }
  158. /// <summary>Creates service definition that can be registered with a server</summary>
  159. public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl)
  160. {
  161. return ServerServiceDefinition.CreateBuilder()
  162. .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
  163. .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build();
  164. }
  165. }
  166. public static class WorkerService
  167. {
  168. static readonly string __ServiceName = "grpc.testing.WorkerService";
  169. static readonly Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_ServerArgs = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerArgs.Parser.ParseFrom);
  170. static readonly Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_ServerStatus = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerStatus.Parser.ParseFrom);
  171. static readonly Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_ClientArgs = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientArgs.Parser.ParseFrom);
  172. static readonly Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_ClientStatus = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientStatus.Parser.ParseFrom);
  173. static readonly Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_CoreRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreRequest.Parser.ParseFrom);
  174. static readonly Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_CoreResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreResponse.Parser.ParseFrom);
  175. static readonly Marshaller<global::Grpc.Testing.Void> __Marshaller_Void = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom);
  176. static readonly Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> __Method_RunServer = new Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(
  177. MethodType.DuplexStreaming,
  178. __ServiceName,
  179. "RunServer",
  180. __Marshaller_ServerArgs,
  181. __Marshaller_ServerStatus);
  182. static readonly Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> __Method_RunClient = new Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus>(
  183. MethodType.DuplexStreaming,
  184. __ServiceName,
  185. "RunClient",
  186. __Marshaller_ClientArgs,
  187. __Marshaller_ClientStatus);
  188. static readonly Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse> __Method_CoreCount = new Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse>(
  189. MethodType.Unary,
  190. __ServiceName,
  191. "CoreCount",
  192. __Marshaller_CoreRequest,
  193. __Marshaller_CoreResponse);
  194. static readonly Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void> __Method_QuitWorker = new Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void>(
  195. MethodType.Unary,
  196. __ServiceName,
  197. "QuitWorker",
  198. __Marshaller_Void,
  199. __Marshaller_Void);
  200. /// <summary>Service descriptor</summary>
  201. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  202. {
  203. get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; }
  204. }
  205. /// <summary>Base class for server-side implementations of WorkerService</summary>
  206. public abstract class WorkerServiceBase
  207. {
  208. /// <summary>
  209. /// Start server with specified workload.
  210. /// First request sent specifies the ServerConfig followed by ServerStatus
  211. /// response. After that, a "Mark" can be sent anytime to request the latest
  212. /// stats. Closing the stream will initiate shutdown of the test server
  213. /// and once the shutdown has finished, the OK status is sent to terminate
  214. /// this RPC.
  215. /// </summary>
  216. public virtual global::System.Threading.Tasks.Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context)
  217. {
  218. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  219. }
  220. /// <summary>
  221. /// Start client with specified workload.
  222. /// First request sent specifies the ClientConfig followed by ClientStatus
  223. /// response. After that, a "Mark" can be sent anytime to request the latest
  224. /// stats. Closing the stream will initiate shutdown of the test client
  225. /// and once the shutdown has finished, the OK status is sent to terminate
  226. /// this RPC.
  227. /// </summary>
  228. public virtual global::System.Threading.Tasks.Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context)
  229. {
  230. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  231. }
  232. /// <summary>
  233. /// Just return the core count - unary call
  234. /// </summary>
  235. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context)
  236. {
  237. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  238. }
  239. /// <summary>
  240. /// Quit this worker
  241. /// </summary>
  242. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context)
  243. {
  244. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  245. }
  246. }
  247. /// <summary>Client for WorkerService</summary>
  248. public class WorkerServiceClient : ClientBase<WorkerServiceClient>
  249. {
  250. public WorkerServiceClient(Channel channel) : base(channel)
  251. {
  252. }
  253. public WorkerServiceClient(CallInvoker callInvoker) : base(callInvoker)
  254. {
  255. }
  256. ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  257. protected WorkerServiceClient() : base()
  258. {
  259. }
  260. ///<summary>Protected constructor to allow creation of configured clients.</summary>
  261. protected WorkerServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  262. {
  263. }
  264. /// <summary>
  265. /// Start server with specified workload.
  266. /// First request sent specifies the ServerConfig followed by ServerStatus
  267. /// response. After that, a "Mark" can be sent anytime to request the latest
  268. /// stats. Closing the stream will initiate shutdown of the test server
  269. /// and once the shutdown has finished, the OK status is sent to terminate
  270. /// this RPC.
  271. /// </summary>
  272. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  273. {
  274. return RunServer(new CallOptions(headers, deadline, cancellationToken));
  275. }
  276. /// <summary>
  277. /// Start server with specified workload.
  278. /// First request sent specifies the ServerConfig followed by ServerStatus
  279. /// response. After that, a "Mark" can be sent anytime to request the latest
  280. /// stats. Closing the stream will initiate shutdown of the test server
  281. /// and once the shutdown has finished, the OK status is sent to terminate
  282. /// this RPC.
  283. /// </summary>
  284. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options)
  285. {
  286. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
  287. }
  288. /// <summary>
  289. /// Start client with specified workload.
  290. /// First request sent specifies the ClientConfig followed by ClientStatus
  291. /// response. After that, a "Mark" can be sent anytime to request the latest
  292. /// stats. Closing the stream will initiate shutdown of the test client
  293. /// and once the shutdown has finished, the OK status is sent to terminate
  294. /// this RPC.
  295. /// </summary>
  296. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  297. {
  298. return RunClient(new CallOptions(headers, deadline, cancellationToken));
  299. }
  300. /// <summary>
  301. /// Start client with specified workload.
  302. /// First request sent specifies the ClientConfig followed by ClientStatus
  303. /// response. After that, a "Mark" can be sent anytime to request the latest
  304. /// stats. Closing the stream will initiate shutdown of the test client
  305. /// and once the shutdown has finished, the OK status is sent to terminate
  306. /// this RPC.
  307. /// </summary>
  308. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options)
  309. {
  310. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
  311. }
  312. /// <summary>
  313. /// Just return the core count - unary call
  314. /// </summary>
  315. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  316. {
  317. return CoreCount(request, new CallOptions(headers, deadline, cancellationToken));
  318. }
  319. /// <summary>
  320. /// Just return the core count - unary call
  321. /// </summary>
  322. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options)
  323. {
  324. return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
  325. }
  326. /// <summary>
  327. /// Just return the core count - unary call
  328. /// </summary>
  329. public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  330. {
  331. return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken));
  332. }
  333. /// <summary>
  334. /// Just return the core count - unary call
  335. /// </summary>
  336. public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options)
  337. {
  338. return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
  339. }
  340. /// <summary>
  341. /// Quit this worker
  342. /// </summary>
  343. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  344. {
  345. return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken));
  346. }
  347. /// <summary>
  348. /// Quit this worker
  349. /// </summary>
  350. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options)
  351. {
  352. return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
  353. }
  354. /// <summary>
  355. /// Quit this worker
  356. /// </summary>
  357. public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  358. {
  359. return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken));
  360. }
  361. /// <summary>
  362. /// Quit this worker
  363. /// </summary>
  364. public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options)
  365. {
  366. return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
  367. }
  368. protected override WorkerServiceClient NewInstance(ClientBaseConfiguration configuration)
  369. {
  370. return new WorkerServiceClient(configuration);
  371. }
  372. }
  373. /// <summary>Creates a new client for WorkerService</summary>
  374. public static WorkerServiceClient NewClient(Channel channel)
  375. {
  376. return new WorkerServiceClient(channel);
  377. }
  378. /// <summary>Creates service definition that can be registered with a server</summary>
  379. public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
  380. {
  381. return ServerServiceDefinition.CreateBuilder()
  382. .AddMethod(__Method_RunServer, serviceImpl.RunServer)
  383. .AddMethod(__Method_RunClient, serviceImpl.RunClient)
  384. .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
  385. .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
  386. }
  387. }
  388. }
  389. #endregion