WorkerServiceGrpc.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. // <auto-generated>
  2. // Generated by the protocol buffer compiler. DO NOT EDIT!
  3. // source: src/proto/grpc/testing/worker_service.proto
  4. // </auto-generated>
  5. // Original file comments:
  6. // Copyright 2015 gRPC authors.
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License");
  9. // you may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at
  11. //
  12. // http://www.apache.org/licenses/LICENSE-2.0
  13. //
  14. // Unless required by applicable law or agreed to in writing, software
  15. // distributed under the License is distributed on an "AS IS" BASIS,
  16. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. // See the License for the specific language governing permissions and
  18. // limitations under the License.
  19. //
  20. // An integration test service that covers all the method signature permutations
  21. // of unary/streaming requests/responses.
  22. #pragma warning disable 0414, 1591
  23. #region Designer generated code
  24. using grpc = global::Grpc.Core;
  25. namespace Grpc.Testing {
  26. public static partial class WorkerService
  27. {
  28. static readonly string __ServiceName = "grpc.testing.WorkerService";
  29. static readonly grpc::Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_grpc_testing_ServerArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerArgs.Parser.ParseFrom);
  30. static readonly grpc::Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_grpc_testing_ServerStatus = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerStatus.Parser.ParseFrom);
  31. static readonly grpc::Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_grpc_testing_ClientArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientArgs.Parser.ParseFrom);
  32. static readonly grpc::Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_grpc_testing_ClientStatus = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientStatus.Parser.ParseFrom);
  33. static readonly grpc::Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_grpc_testing_CoreRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreRequest.Parser.ParseFrom);
  34. static readonly grpc::Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_grpc_testing_CoreResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreResponse.Parser.ParseFrom);
  35. static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom);
  36. static readonly grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> __Method_RunServer = new grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(
  37. grpc::MethodType.DuplexStreaming,
  38. __ServiceName,
  39. "RunServer",
  40. __Marshaller_grpc_testing_ServerArgs,
  41. __Marshaller_grpc_testing_ServerStatus);
  42. static readonly grpc::Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> __Method_RunClient = new grpc::Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus>(
  43. grpc::MethodType.DuplexStreaming,
  44. __ServiceName,
  45. "RunClient",
  46. __Marshaller_grpc_testing_ClientArgs,
  47. __Marshaller_grpc_testing_ClientStatus);
  48. static readonly grpc::Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse> __Method_CoreCount = new grpc::Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse>(
  49. grpc::MethodType.Unary,
  50. __ServiceName,
  51. "CoreCount",
  52. __Marshaller_grpc_testing_CoreRequest,
  53. __Marshaller_grpc_testing_CoreResponse);
  54. static readonly grpc::Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void> __Method_QuitWorker = new grpc::Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void>(
  55. grpc::MethodType.Unary,
  56. __ServiceName,
  57. "QuitWorker",
  58. __Marshaller_grpc_testing_Void,
  59. __Marshaller_grpc_testing_Void);
  60. /// <summary>Service descriptor</summary>
  61. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  62. {
  63. get { return global::Grpc.Testing.WorkerServiceReflection.Descriptor.Services[0]; }
  64. }
  65. /// <summary>Base class for server-side implementations of WorkerService</summary>
  66. [grpc::BindServiceMethod(typeof(WorkerService), "BindService")]
  67. public abstract partial class WorkerServiceBase
  68. {
  69. /// <summary>
  70. /// Start server with specified workload.
  71. /// First request sent specifies the ServerConfig followed by ServerStatus
  72. /// response. After that, a "Mark" can be sent anytime to request the latest
  73. /// stats. Closing the stream will initiate shutdown of the test server
  74. /// and once the shutdown has finished, the OK status is sent to terminate
  75. /// this RPC.
  76. /// </summary>
  77. /// <param name="requestStream">Used for reading requests from the client.</param>
  78. /// <param name="responseStream">Used for sending responses back to the client.</param>
  79. /// <param name="context">The context of the server-side call handler being invoked.</param>
  80. /// <returns>A task indicating completion of the handler.</returns>
  81. public virtual global::System.Threading.Tasks.Task RunServer(grpc::IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, grpc::IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, grpc::ServerCallContext context)
  82. {
  83. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  84. }
  85. /// <summary>
  86. /// Start client with specified workload.
  87. /// First request sent specifies the ClientConfig followed by ClientStatus
  88. /// response. After that, a "Mark" can be sent anytime to request the latest
  89. /// stats. Closing the stream will initiate shutdown of the test client
  90. /// and once the shutdown has finished, the OK status is sent to terminate
  91. /// this RPC.
  92. /// </summary>
  93. /// <param name="requestStream">Used for reading requests from the client.</param>
  94. /// <param name="responseStream">Used for sending responses back to the client.</param>
  95. /// <param name="context">The context of the server-side call handler being invoked.</param>
  96. /// <returns>A task indicating completion of the handler.</returns>
  97. public virtual global::System.Threading.Tasks.Task RunClient(grpc::IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, grpc::IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, grpc::ServerCallContext context)
  98. {
  99. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  100. }
  101. /// <summary>
  102. /// Just return the core count - unary call
  103. /// </summary>
  104. /// <param name="request">The request received from the client.</param>
  105. /// <param name="context">The context of the server-side call handler being invoked.</param>
  106. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  107. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, grpc::ServerCallContext context)
  108. {
  109. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  110. }
  111. /// <summary>
  112. /// Quit this worker
  113. /// </summary>
  114. /// <param name="request">The request received from the client.</param>
  115. /// <param name="context">The context of the server-side call handler being invoked.</param>
  116. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  117. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, grpc::ServerCallContext context)
  118. {
  119. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  120. }
  121. }
  122. /// <summary>Client for WorkerService</summary>
  123. public partial class WorkerServiceClient : grpc::ClientBase<WorkerServiceClient>
  124. {
  125. /// <summary>Creates a new client for WorkerService</summary>
  126. /// <param name="channel">The channel to use to make remote calls.</param>
  127. public WorkerServiceClient(grpc::ChannelBase channel) : base(channel)
  128. {
  129. }
  130. /// <summary>Creates a new client for WorkerService that uses a custom <c>CallInvoker</c>.</summary>
  131. /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
  132. public WorkerServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
  133. {
  134. }
  135. /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  136. protected WorkerServiceClient() : base()
  137. {
  138. }
  139. /// <summary>Protected constructor to allow creation of configured clients.</summary>
  140. /// <param name="configuration">The client configuration.</param>
  141. protected WorkerServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  142. {
  143. }
  144. /// <summary>
  145. /// Start server with specified workload.
  146. /// First request sent specifies the ServerConfig followed by ServerStatus
  147. /// response. After that, a "Mark" can be sent anytime to request the latest
  148. /// stats. Closing the stream will initiate shutdown of the test server
  149. /// and once the shutdown has finished, the OK status is sent to terminate
  150. /// this RPC.
  151. /// </summary>
  152. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  153. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  154. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  155. /// <returns>The call object.</returns>
  156. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  157. {
  158. return RunServer(new grpc::CallOptions(headers, deadline, cancellationToken));
  159. }
  160. /// <summary>
  161. /// Start server with specified workload.
  162. /// First request sent specifies the ServerConfig followed by ServerStatus
  163. /// response. After that, a "Mark" can be sent anytime to request the latest
  164. /// stats. Closing the stream will initiate shutdown of the test server
  165. /// and once the shutdown has finished, the OK status is sent to terminate
  166. /// this RPC.
  167. /// </summary>
  168. /// <param name="options">The options for the call.</param>
  169. /// <returns>The call object.</returns>
  170. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(grpc::CallOptions options)
  171. {
  172. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
  173. }
  174. /// <summary>
  175. /// Start client with specified workload.
  176. /// First request sent specifies the ClientConfig followed by ClientStatus
  177. /// response. After that, a "Mark" can be sent anytime to request the latest
  178. /// stats. Closing the stream will initiate shutdown of the test client
  179. /// and once the shutdown has finished, the OK status is sent to terminate
  180. /// this RPC.
  181. /// </summary>
  182. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  183. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  184. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  185. /// <returns>The call object.</returns>
  186. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  187. {
  188. return RunClient(new grpc::CallOptions(headers, deadline, cancellationToken));
  189. }
  190. /// <summary>
  191. /// Start client with specified workload.
  192. /// First request sent specifies the ClientConfig followed by ClientStatus
  193. /// response. After that, a "Mark" can be sent anytime to request the latest
  194. /// stats. Closing the stream will initiate shutdown of the test client
  195. /// and once the shutdown has finished, the OK status is sent to terminate
  196. /// this RPC.
  197. /// </summary>
  198. /// <param name="options">The options for the call.</param>
  199. /// <returns>The call object.</returns>
  200. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(grpc::CallOptions options)
  201. {
  202. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
  203. }
  204. /// <summary>
  205. /// Just return the core count - unary call
  206. /// </summary>
  207. /// <param name="request">The request to send to the server.</param>
  208. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  209. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  210. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  211. /// <returns>The response received from the server.</returns>
  212. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  213. {
  214. return CoreCount(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  215. }
  216. /// <summary>
  217. /// Just return the core count - unary call
  218. /// </summary>
  219. /// <param name="request">The request to send to the server.</param>
  220. /// <param name="options">The options for the call.</param>
  221. /// <returns>The response received from the server.</returns>
  222. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, grpc::CallOptions options)
  223. {
  224. return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
  225. }
  226. /// <summary>
  227. /// Just return the core count - unary call
  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::AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  235. {
  236. return CoreCountAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  237. }
  238. /// <summary>
  239. /// Just return the core count - unary call
  240. /// </summary>
  241. /// <param name="request">The request to send to the server.</param>
  242. /// <param name="options">The options for the call.</param>
  243. /// <returns>The call object.</returns>
  244. public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, grpc::CallOptions options)
  245. {
  246. return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
  247. }
  248. /// <summary>
  249. /// Quit this worker
  250. /// </summary>
  251. /// <param name="request">The request to send to the server.</param>
  252. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  253. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  254. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  255. /// <returns>The response received from the server.</returns>
  256. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  257. {
  258. return QuitWorker(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  259. }
  260. /// <summary>
  261. /// Quit this worker
  262. /// </summary>
  263. /// <param name="request">The request to send to the server.</param>
  264. /// <param name="options">The options for the call.</param>
  265. /// <returns>The response received from the server.</returns>
  266. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, grpc::CallOptions options)
  267. {
  268. return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
  269. }
  270. /// <summary>
  271. /// Quit this worker
  272. /// </summary>
  273. /// <param name="request">The request to send to the server.</param>
  274. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  275. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  276. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  277. /// <returns>The call object.</returns>
  278. public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
  279. {
  280. return QuitWorkerAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  281. }
  282. /// <summary>
  283. /// Quit this worker
  284. /// </summary>
  285. /// <param name="request">The request to send to the server.</param>
  286. /// <param name="options">The options for the call.</param>
  287. /// <returns>The call object.</returns>
  288. public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, grpc::CallOptions options)
  289. {
  290. return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
  291. }
  292. /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
  293. protected override WorkerServiceClient NewInstance(ClientBaseConfiguration configuration)
  294. {
  295. return new WorkerServiceClient(configuration);
  296. }
  297. }
  298. /// <summary>Creates service definition that can be registered with a server</summary>
  299. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  300. public static grpc::ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
  301. {
  302. return grpc::ServerServiceDefinition.CreateBuilder()
  303. .AddMethod(__Method_RunServer, serviceImpl.RunServer)
  304. .AddMethod(__Method_RunClient, serviceImpl.RunClient)
  305. .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
  306. .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
  307. }
  308. /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
  309. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
  310. /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
  311. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  312. public static void BindService(grpc::ServiceBinderBase serviceBinder, WorkerServiceBase serviceImpl)
  313. {
  314. serviceBinder.AddMethod(__Method_RunServer, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(serviceImpl.RunServer));
  315. serviceBinder.AddMethod(__Method_RunClient, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus>(serviceImpl.RunClient));
  316. serviceBinder.AddMethod(__Method_CoreCount, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse>(serviceImpl.CoreCount));
  317. serviceBinder.AddMethod(__Method_QuitWorker, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.Void, global::Grpc.Testing.Void>(serviceImpl.QuitWorker));
  318. }
  319. }
  320. }
  321. #endregion