1 // <auto-generated> 2 // Generated by the protocol buffer compiler. DO NOT EDIT! 3 // source: src/proto/grpc/testing/metrics.proto 4 // </auto-generated> 5 // Original file comments: 6 // Copyright 2015-2016 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 // Contains the definitions for a metrics service and the type of metrics 21 // exposed by the service. 22 // 23 // Currently, 'Gauge' (i.e a metric that represents the measured value of 24 // something at an instant of time) is the only metric type supported by the 25 // service. 26 #pragma warning disable 0414, 1591 27 #region Designer generated code 28 29 using grpc = global::Grpc.Core; 30 31 namespace Grpc.Testing { 32 public static partial class MetricsService 33 { 34 static readonly string __ServiceName = "grpc.testing.MetricsService"; 35 __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)36 static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) 37 { 38 #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION 39 if (message is global::Google.Protobuf.IBufferMessage) 40 { 41 context.SetPayloadLength(message.CalculateSize()); 42 global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); 43 context.Complete(); 44 return; 45 } 46 #endif 47 context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); 48 } 49 50 static class __Helper_MessageCache<T> 51 { 52 public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); 53 } 54 55 static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T> 56 { 57 #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION 58 if (__Helper_MessageCache<T>.IsBufferMessage) 59 { 60 return parser.ParseFrom(context.PayloadAsReadOnlySequence()); 61 } 62 #endif 63 return parser.ParseFrom(context.PayloadAsNewBuffer()); 64 } 65 66 static readonly grpc::Marshaller<global::Grpc.Testing.EmptyMessage> __Marshaller_grpc_testing_EmptyMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.EmptyMessage.Parser)); 67 static readonly grpc::Marshaller<global::Grpc.Testing.GaugeResponse> __Marshaller_grpc_testing_GaugeResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.GaugeResponse.Parser)); 68 static readonly grpc::Marshaller<global::Grpc.Testing.GaugeRequest> __Marshaller_grpc_testing_GaugeRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.GaugeRequest.Parser)); 69 70 static readonly grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse> __Method_GetAllGauges = new grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse>( 71 grpc::MethodType.ServerStreaming, 72 __ServiceName, 73 "GetAllGauges", 74 __Marshaller_grpc_testing_EmptyMessage, 75 __Marshaller_grpc_testing_GaugeResponse); 76 77 static readonly grpc::Method<global::Grpc.Testing.GaugeRequest, global::Grpc.Testing.GaugeResponse> __Method_GetGauge = new grpc::Method<global::Grpc.Testing.GaugeRequest, global::Grpc.Testing.GaugeResponse>( 78 grpc::MethodType.Unary, 79 __ServiceName, 80 "GetGauge", 81 __Marshaller_grpc_testing_GaugeRequest, 82 __Marshaller_grpc_testing_GaugeResponse); 83 84 /// <summary>Service descriptor</summary> 85 public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor 86 { 87 get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } 88 } 89 90 /// <summary>Base class for server-side implementations of MetricsService</summary> 91 [grpc::BindServiceMethod(typeof(MetricsService), "BindService")] 92 public abstract partial class MetricsServiceBase 93 { 94 /// <summary> 95 /// Returns the values of all the gauges that are currently being maintained by 96 /// the service 97 /// </summary> 98 /// <param name="request">The request received from the client.</param> 99 /// <param name="responseStream">Used for sending responses back to the client.</param> 100 /// <param name="context">The context of the server-side call handler being invoked.</param> 101 /// <returns>A task indicating completion of the handler.</returns> GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, grpc::ServerCallContext context)102 public virtual global::System.Threading.Tasks.Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, grpc::ServerCallContext context) 103 { 104 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 105 } 106 107 /// <summary> 108 /// Returns the value of one gauge 109 /// </summary> 110 /// <param name="request">The request received from the client.</param> 111 /// <param name="context">The context of the server-side call handler being invoked.</param> 112 /// <returns>The response to send back to the client (wrapped by a task).</returns> GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::ServerCallContext context)113 public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::ServerCallContext context) 114 { 115 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 116 } 117 118 } 119 120 /// <summary>Client for MetricsService</summary> 121 public partial class MetricsServiceClient : grpc::ClientBase<MetricsServiceClient> 122 { 123 /// <summary>Creates a new client for MetricsService</summary> 124 /// <param name="channel">The channel to use to make remote calls.</param> MetricsServiceClient(grpc::ChannelBase channel)125 public MetricsServiceClient(grpc::ChannelBase channel) : base(channel) 126 { 127 } 128 /// <summary>Creates a new client for MetricsService that uses a custom <c>CallInvoker</c>.</summary> 129 /// <param name="callInvoker">The callInvoker to use to make remote calls.</param> MetricsServiceClient(grpc::CallInvoker callInvoker)130 public MetricsServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) 131 { 132 } 133 /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> MetricsServiceClient()134 protected MetricsServiceClient() : base() 135 { 136 } 137 /// <summary>Protected constructor to allow creation of configured clients.</summary> 138 /// <param name="configuration">The client configuration.</param> MetricsServiceClient(ClientBaseConfiguration configuration)139 protected MetricsServiceClient(ClientBaseConfiguration configuration) : base(configuration) 140 { 141 } 142 143 /// <summary> 144 /// Returns the values of all the gauges that are currently being maintained by 145 /// the service 146 /// </summary> 147 /// <param name="request">The request to send to the server.</param> 148 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 149 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 150 /// <param name="cancellationToken">An optional token for canceling the call.</param> 151 /// <returns>The call object.</returns> GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))152 public virtual grpc::AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 153 { 154 return GetAllGauges(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 155 } 156 /// <summary> 157 /// Returns the values of all the gauges that are currently being maintained by 158 /// the service 159 /// </summary> 160 /// <param name="request">The request to send to the server.</param> 161 /// <param name="options">The options for the call.</param> 162 /// <returns>The call object.</returns> GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::CallOptions options)163 public virtual grpc::AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, grpc::CallOptions options) 164 { 165 return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request); 166 } 167 /// <summary> 168 /// Returns the value of one gauge 169 /// </summary> 170 /// <param name="request">The request to send to the server.</param> 171 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 172 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 173 /// <param name="cancellationToken">An optional token for canceling the call.</param> 174 /// <returns>The response received from the server.</returns> GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))175 public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 176 { 177 return GetGauge(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 178 } 179 /// <summary> 180 /// Returns the value of one gauge 181 /// </summary> 182 /// <param name="request">The request to send to the server.</param> 183 /// <param name="options">The options for the call.</param> 184 /// <returns>The response received from the server.</returns> GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::CallOptions options)185 public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, grpc::CallOptions options) 186 { 187 return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request); 188 } 189 /// <summary> 190 /// Returns the value of one gauge 191 /// </summary> 192 /// <param name="request">The request to send to the server.</param> 193 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 194 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 195 /// <param name="cancellationToken">An optional token for canceling the call.</param> 196 /// <returns>The call object.</returns> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))197 public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 198 { 199 return GetGaugeAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 200 } 201 /// <summary> 202 /// Returns the value of one gauge 203 /// </summary> 204 /// <param name="request">The request to send to the server.</param> 205 /// <param name="options">The options for the call.</param> 206 /// <returns>The call object.</returns> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, grpc::CallOptions options)207 public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, grpc::CallOptions options) 208 { 209 return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request); 210 } 211 /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary> NewInstance(ClientBaseConfiguration configuration)212 protected override MetricsServiceClient NewInstance(ClientBaseConfiguration configuration) 213 { 214 return new MetricsServiceClient(configuration); 215 } 216 } 217 218 /// <summary>Creates service definition that can be registered with a server</summary> 219 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> BindService(MetricsServiceBase serviceImpl)220 public static grpc::ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) 221 { 222 return grpc::ServerServiceDefinition.CreateBuilder() 223 .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) 224 .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); 225 } 226 227 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. 228 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> 229 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> 230 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> BindService(grpc::ServiceBinderBase serviceBinder, MetricsServiceBase serviceImpl)231 public static void BindService(grpc::ServiceBinderBase serviceBinder, MetricsServiceBase serviceImpl) 232 { 233 serviceBinder.AddMethod(__Method_GetAllGauges, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse>(serviceImpl.GetAllGauges)); 234 serviceBinder.AddMethod(__Method_GetGauge, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.GaugeRequest, global::Grpc.Testing.GaugeResponse>(serviceImpl.GetGauge)); 235 } 236 237 } 238 } 239 #endregion 240