WorkerServiceGrpc.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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 void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
  30. {
  31. #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
  32. if (message is global::Google.Protobuf.IBufferMessage)
  33. {
  34. context.SetPayloadLength(message.CalculateSize());
  35. global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
  36. context.Complete();
  37. return;
  38. }
  39. #endif
  40. context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
  41. }
  42. static class __Helper_MessageCache<T>
  43. {
  44. public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
  45. }
  46. static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
  47. {
  48. #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
  49. if (__Helper_MessageCache<T>.IsBufferMessage)
  50. {
  51. return parser.ParseFrom(context.PayloadAsReadOnlySequence());
  52. }
  53. #endif
  54. return parser.ParseFrom(context.PayloadAsNewBuffer());
  55. }
  56. static readonly grpc::Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_grpc_testing_ServerArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ServerArgs.Parser));
  57. static readonly grpc::Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_grpc_testing_ServerStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ServerStatus.Parser));
  58. static readonly grpc::Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_grpc_testing_ClientArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ClientArgs.Parser));
  59. static readonly grpc::Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_grpc_testing_ClientStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ClientStatus.Parser));
  60. static readonly grpc::Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_grpc_testing_CoreRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.CoreRequest.Parser));
  61. static readonly grpc::Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_grpc_testing_CoreResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.CoreResponse.Parser));
  62. static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Void.Parser));
  63. 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>(
  64. grpc::MethodType.DuplexStreaming,
  65. __ServiceName,
  66. "RunServer",
  67. __Marshaller_grpc_testing_ServerArgs,
  68. __Marshaller_grpc_testing_ServerStatus);
  69. 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>(
  70. grpc::MethodType.DuplexStreaming,
  71. __ServiceName,
  72. "RunClient",
  73. __Marshaller_grpc_testing_ClientArgs,
  74. __Marshaller_grpc_testing_ClientStatus);
  75. 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>(
  76. grpc::MethodType.Unary,
  77. __ServiceName,
  78. "CoreCount",
  79. __Marshaller_grpc_testing_CoreRequest,
  80. __Marshaller_grpc_testing_CoreResponse);
  81. 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>(
  82. grpc::MethodType.Unary,
  83. __ServiceName,
  84. "QuitWorker",
  85. __Marshaller_grpc_testing_Void,
  86. __Marshaller_grpc_testing_Void);
  87. /// <summary>Service descriptor</summary>
  88. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  89. {
  90. get { return global::Grpc.Testing.WorkerServiceReflection.Descriptor.Services[0]; }
  91. }
  92. /// <summary>Base class for server-side implementations of WorkerService</summary>
  93. [grpc::BindServiceMethod(typeof(WorkerService), "BindService")]
  94. public abstract partial class WorkerServiceBase
  95. {
  96. /// <summary>
  97. /// Start server with specified workload.
  98. /// First request sent specifies the ServerConfig followed by ServerStatus
  99. /// response. After that, a "Mark" can be sent anytime to request the latest
  100. /// stats. Closing the stream will initiate shutdown of the test server
  101. /// and once the shutdown has finished, the OK status is sent to terminate
  102. /// this RPC.
  103. /// </summary>
  104. /// <param name="requestStream">Used for reading requests from the client.</param>
  105. /// <param name="responseStream">Used for sending responses back to the client.</param>
  106. /// <param name="context">The context of the server-side call handler being invoked.</param>
  107. /// <returns>A task indicating completion of the handler.</returns>
  108. 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)
  109. {
  110. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  111. }
  112. /// <summary>
  113. /// Start client with specified workload.
  114. /// First request sent specifies the ClientConfig followed by ClientStatus
  115. /// response. After that, a "Mark" can be sent anytime to request the latest
  116. /// stats. Closing the stream will initiate shutdown of the test client
  117. /// and once the shutdown has finished, the OK status is sent to terminate
  118. /// this RPC.
  119. /// </summary>
  120. /// <param name="requestStream">Used for reading requests from the client.</param>
  121. /// <param name="responseStream">Used for sending responses back to the client.</param>
  122. /// <param name="context">The context of the server-side call handler being invoked.</param>
  123. /// <returns>A task indicating completion of the handler.</returns>
  124. 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)
  125. {
  126. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  127. }
  128. /// <summary>
  129. /// Just return the core count - unary call
  130. /// </summary>
  131. /// <param name="request">The request received from the client.</param>
  132. /// <param name="context">The context of the server-side call handler being invoked.</param>
  133. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  134. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, grpc::ServerCallContext context)
  135. {
  136. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  137. }
  138. /// <summary>
  139. /// Quit this worker
  140. /// </summary>
  141. /// <param name="request">The request received from the client.</param>
  142. /// <param name="context">The context of the server-side call handler being invoked.</param>
  143. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  144. public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, grpc::ServerCallContext context)
  145. {
  146. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  147. }
  148. }
  149. /// <summary>Client for WorkerService</summary>
  150. public partial class WorkerServiceClient : grpc::ClientBase<WorkerServiceClient>
  151. {
  152. /// <summary>Creates a new client for WorkerService</summary>
  153. /// <param name="channel">The channel to use to make remote calls.</param>
  154. public WorkerServiceClient(grpc::ChannelBase channel) : base(channel)
  155. {
  156. }
  157. /// <summary>Creates a new client for WorkerService that uses a custom <c>CallInvoker</c>.</summary>
  158. /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
  159. public WorkerServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
  160. {
  161. }
  162. /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  163. protected WorkerServiceClient() : base()
  164. {
  165. }
  166. /// <summary>Protected constructor to allow creation of configured clients.</summary>
  167. /// <param name="configuration">The client configuration.</param>
  168. protected WorkerServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  169. {
  170. }
  171. /// <summary>
  172. /// Start server with specified workload.
  173. /// First request sent specifies the ServerConfig followed by ServerStatus
  174. /// response. After that, a "Mark" can be sent anytime to request the latest
  175. /// stats. Closing the stream will initiate shutdown of the test server
  176. /// and once the shutdown has finished, the OK status is sent to terminate
  177. /// this RPC.
  178. /// </summary>
  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::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))
  184. {
  185. return RunServer(new grpc::CallOptions(headers, deadline, cancellationToken));
  186. }
  187. /// <summary>
  188. /// Start server with specified workload.
  189. /// First request sent specifies the ServerConfig followed by ServerStatus
  190. /// response. After that, a "Mark" can be sent anytime to request the latest
  191. /// stats. Closing the stream will initiate shutdown of the test server
  192. /// and once the shutdown has finished, the OK status is sent to terminate
  193. /// this RPC.
  194. /// </summary>
  195. /// <param name="options">The options for the call.</param>
  196. /// <returns>The call object.</returns>
  197. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(grpc::CallOptions options)
  198. {
  199. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
  200. }
  201. /// <summary>
  202. /// Start client with specified workload.
  203. /// First request sent specifies the ClientConfig followed by ClientStatus
  204. /// response. After that, a "Mark" can be sent anytime to request the latest
  205. /// stats. Closing the stream will initiate shutdown of the test client
  206. /// and once the shutdown has finished, the OK status is sent to terminate
  207. /// this RPC.
  208. /// </summary>
  209. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  210. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  211. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  212. /// <returns>The call object.</returns>
  213. 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))
  214. {
  215. return RunClient(new grpc::CallOptions(headers, deadline, cancellationToken));
  216. }
  217. /// <summary>
  218. /// Start client with specified workload.
  219. /// First request sent specifies the ClientConfig followed by ClientStatus
  220. /// response. After that, a "Mark" can be sent anytime to request the latest
  221. /// stats. Closing the stream will initiate shutdown of the test client
  222. /// and once the shutdown has finished, the OK status is sent to terminate
  223. /// this RPC.
  224. /// </summary>
  225. /// <param name="options">The options for the call.</param>
  226. /// <returns>The call object.</returns>
  227. public virtual grpc::AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(grpc::CallOptions options)
  228. {
  229. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
  230. }
  231. /// <summary>
  232. /// Just return the core count - unary call
  233. /// </summary>
  234. /// <param name="request">The request to send to the server.</param>
  235. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  236. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  237. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  238. /// <returns>The response received from the server.</returns>
  239. 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))
  240. {
  241. return CoreCount(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  242. }
  243. /// <summary>
  244. /// Just return the core count - unary call
  245. /// </summary>
  246. /// <param name="request">The request to send to the server.</param>
  247. /// <param name="options">The options for the call.</param>
  248. /// <returns>The response received from the server.</returns>
  249. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, grpc::CallOptions options)
  250. {
  251. return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
  252. }
  253. /// <summary>
  254. /// Just return the core count - unary call
  255. /// </summary>
  256. /// <param name="request">The request to send to the server.</param>
  257. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  258. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  259. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  260. /// <returns>The call object.</returns>
  261. 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))
  262. {
  263. return CoreCountAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  264. }
  265. /// <summary>
  266. /// Just return the core count - unary call
  267. /// </summary>
  268. /// <param name="request">The request to send to the server.</param>
  269. /// <param name="options">The options for the call.</param>
  270. /// <returns>The call object.</returns>
  271. public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, grpc::CallOptions options)
  272. {
  273. return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
  274. }
  275. /// <summary>
  276. /// Quit this worker
  277. /// </summary>
  278. /// <param name="request">The request to send to the server.</param>
  279. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  280. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  281. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  282. /// <returns>The response received from the server.</returns>
  283. 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))
  284. {
  285. return QuitWorker(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  286. }
  287. /// <summary>
  288. /// Quit this worker
  289. /// </summary>
  290. /// <param name="request">The request to send to the server.</param>
  291. /// <param name="options">The options for the call.</param>
  292. /// <returns>The response received from the server.</returns>
  293. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, grpc::CallOptions options)
  294. {
  295. return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
  296. }
  297. /// <summary>
  298. /// Quit this worker
  299. /// </summary>
  300. /// <param name="request">The request to send to the server.</param>
  301. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  302. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  303. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  304. /// <returns>The call object.</returns>
  305. 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))
  306. {
  307. return QuitWorkerAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  308. }
  309. /// <summary>
  310. /// Quit this worker
  311. /// </summary>
  312. /// <param name="request">The request to send to the server.</param>
  313. /// <param name="options">The options for the call.</param>
  314. /// <returns>The call object.</returns>
  315. public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, grpc::CallOptions options)
  316. {
  317. return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
  318. }
  319. /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
  320. protected override WorkerServiceClient NewInstance(ClientBaseConfiguration configuration)
  321. {
  322. return new WorkerServiceClient(configuration);
  323. }
  324. }
  325. /// <summary>Creates service definition that can be registered with a server</summary>
  326. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  327. public static grpc::ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
  328. {
  329. return grpc::ServerServiceDefinition.CreateBuilder()
  330. .AddMethod(__Method_RunServer, serviceImpl.RunServer)
  331. .AddMethod(__Method_RunClient, serviceImpl.RunClient)
  332. .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
  333. .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
  334. }
  335. /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
  336. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
  337. /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
  338. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  339. public static void BindService(grpc::ServiceBinderBase serviceBinder, WorkerServiceBase serviceImpl)
  340. {
  341. serviceBinder.AddMethod(__Method_RunServer, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(serviceImpl.RunServer));
  342. serviceBinder.AddMethod(__Method_RunClient, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus>(serviceImpl.RunClient));
  343. serviceBinder.AddMethod(__Method_CoreCount, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse>(serviceImpl.CoreCount));
  344. serviceBinder.AddMethod(__Method_QuitWorker, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.Void, global::Grpc.Testing.Void>(serviceImpl.QuitWorker));
  345. }
  346. }
  347. }
  348. #endregion