From 8ecd4d7aa6a522c68ba96d0362a778cdc98f4550 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 21 Apr 2016 00:33:46 -0700 Subject: Add support for an "OTHER" value in client_type, server_type, and add a string to represent the name of the desired system api. This allows expansion without putting an upper-limit based on some foressen variants. --- src/csharp/Grpc.IntegrationTesting/Control.cs | 160 +++++++++++++++++++------- 1 file changed, 117 insertions(+), 43 deletions(-) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 003d2428fa..3fa8d43f38 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -31,7 +31,7 @@ namespace Grpc.Testing { "cnBjLnRlc3RpbmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiAB", "KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiQwoO", "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", - "X2hvc3Rfb3ZlcnJpZGUYAiABKAki1gMKDENsaWVudENvbmZpZxIWCg5zZXJ2", + "X2hvc3Rfb3ZlcnJpZGUYAiABKAki8AMKDENsaWVudENvbmZpZxIWCg5zZXJ2", "ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu", "dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc", "LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y", @@ -41,46 +41,48 @@ namespace Grpc.Testing { "ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m", "aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBoaXN0", "b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbVBh", - "cmFtcxIRCgljb3JlX2xpc3QYDSADKAUSEgoKY29yZV9saW1pdBgOIAEoBSI4", - "CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBjLnRlc3Rpbmcu", - "Q2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNldBgBIAEoCCJoCgpDbGllbnRB", - "cmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVudENvbmZp", - "Z0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2Fy", - "Z3R5cGUi/AEKDFNlcnZlckNvbmZpZxItCgtzZXJ2ZXJfdHlwZRgBIAEoDjIY", - "LmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgC", - "IAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIMCgRwb3J0GAQg", - "ASgFEhwKFGFzeW5jX3NlcnZlcl90aHJlYWRzGAcgASgFEhIKCmNvcmVfbGlt", - "aXQYCCABKAUSMwoOcGF5bG9hZF9jb25maWcYCSABKAsyGy5ncnBjLnRlc3Rp", - "bmcuUGF5bG9hZENvbmZpZxIRCgljb3JlX2xpc3QYCiADKAUiaAoKU2VydmVy", - "QXJncxIrCgVzZXR1cBgBIAEoCzIaLmdycGMudGVzdGluZy5TZXJ2ZXJDb25m", - "aWdIABIiCgRtYXJrGAIgASgLMhIuZ3JwYy50ZXN0aW5nLk1hcmtIAEIJCgdh", - "cmd0eXBlIlUKDFNlcnZlclN0YXR1cxIoCgVzdGF0cxgBIAEoCzIZLmdycGMu", - "dGVzdGluZy5TZXJ2ZXJTdGF0cxIMCgRwb3J0GAIgASgFEg0KBWNvcmVzGAMg", - "ASgFIg0KC0NvcmVSZXF1ZXN0Ih0KDENvcmVSZXNwb25zZRINCgVjb3JlcxgB", - "IAEoBSIGCgRWb2lkIv0BCghTY2VuYXJpbxIMCgRuYW1lGAEgASgJEjEKDWNs", - "aWVudF9jb25maWcYAiABKAsyGi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmln", - "EhMKC251bV9jbGllbnRzGAMgASgFEjEKDXNlcnZlcl9jb25maWcYBCABKAsy", - "Gi5ncnBjLnRlc3RpbmcuU2VydmVyQ29uZmlnEhMKC251bV9zZXJ2ZXJzGAUg", - "ASgFEhYKDndhcm11cF9zZWNvbmRzGAYgASgFEhkKEWJlbmNobWFya19zZWNv", - "bmRzGAcgASgFEiAKGHNwYXduX2xvY2FsX3dvcmtlcl9jb3VudBgIIAEoBSI2", - "CglTY2VuYXJpb3MSKQoJc2NlbmFyaW9zGAEgAygLMhYuZ3JwYy50ZXN0aW5n", - "LlNjZW5hcmlvIpICChVTY2VuYXJpb1Jlc3VsdFN1bW1hcnkSCwoDcXBzGAEg", - "ASgBEhsKE3Fwc19wZXJfc2VydmVyX2NvcmUYAiABKAESGgoSc2VydmVyX3N5", - "c3RlbV90aW1lGAMgASgBEhgKEHNlcnZlcl91c2VyX3RpbWUYBCABKAESGgoS", - "Y2xpZW50X3N5c3RlbV90aW1lGAUgASgBEhgKEGNsaWVudF91c2VyX3RpbWUY", - "BiABKAESEgoKbGF0ZW5jeV81MBgHIAEoARISCgpsYXRlbmN5XzkwGAggASgB", - "EhIKCmxhdGVuY3lfOTUYCSABKAESEgoKbGF0ZW5jeV85ORgKIAEoARITCgts", - "YXRlbmN5Xzk5ORgLIAEoASKYAgoOU2NlbmFyaW9SZXN1bHQSKAoIc2NlbmFy", - "aW8YASABKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8SLgoJbGF0ZW5jaWVz", - "GAIgASgLMhsuZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbURhdGESLwoMY2xpZW50", - "X3N0YXRzGAMgAygLMhkuZ3JwYy50ZXN0aW5nLkNsaWVudFN0YXRzEi8KDHNl", - "cnZlcl9zdGF0cxgEIAMoCzIZLmdycGMudGVzdGluZy5TZXJ2ZXJTdGF0cxIU", - "CgxzZXJ2ZXJfY29yZXMYBSADKAUSNAoHc3VtbWFyeRgGIAEoCzIjLmdycGMu", - "dGVzdGluZy5TY2VuYXJpb1Jlc3VsdFN1bW1hcnkqLwoKQ2xpZW50VHlwZRIP", - "CgtTWU5DX0NMSUVOVBAAEhAKDEFTWU5DX0NMSUVOVBABKkkKClNlcnZlclR5", - "cGUSDwoLU1lOQ19TRVJWRVIQABIQCgxBU1lOQ19TRVJWRVIQARIYChRBU1lO", - "Q19HRU5FUklDX1NFUlZFUhACKiMKB1JwY1R5cGUSCQoFVU5BUlkQABINCglT", - "VFJFQU1JTkcQAWIGcHJvdG8z")); + "cmFtcxIRCgljb3JlX2xpc3QYDSADKAUSEgoKY29yZV9saW1pdBgOIAEoBRIY", + "ChBvdGhlcl9jbGllbnRfYXBpGA8gASgJIjgKDENsaWVudFN0YXR1cxIoCgVz", + "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr", + "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy", + "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS", + "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSKWAgoMU2VydmVyQ29u", + "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl", + "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n", + "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy", + "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk", + "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK", + "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJImgK", + "ClNlcnZlckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRlc3RpbmcuU2Vy", + "dmVyQ29uZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVzdGluZy5NYXJr", + "SABCCQoHYXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3RhdHMYASABKAsy", + "GS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgCIAEoBRINCgVj", + "b3JlcxgDIAEoBSINCgtDb3JlUmVxdWVzdCIdCgxDb3JlUmVzcG9uc2USDQoF", + "Y29yZXMYASABKAUiBgoEVm9pZCL9AQoIU2NlbmFyaW8SDAoEbmFtZRgBIAEo", + "CRIxCg1jbGllbnRfY29uZmlnGAIgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVu", + "dENvbmZpZxITCgtudW1fY2xpZW50cxgDIAEoBRIxCg1zZXJ2ZXJfY29uZmln", + "GAQgASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZxITCgtudW1fc2Vy", + "dmVycxgFIAEoBRIWCg53YXJtdXBfc2Vjb25kcxgGIAEoBRIZChFiZW5jaG1h", + "cmtfc2Vjb25kcxgHIAEoBRIgChhzcGF3bl9sb2NhbF93b3JrZXJfY291bnQY", + "CCABKAUiNgoJU2NlbmFyaW9zEikKCXNjZW5hcmlvcxgBIAMoCzIWLmdycGMu", + "dGVzdGluZy5TY2VuYXJpbyKSAgoVU2NlbmFyaW9SZXN1bHRTdW1tYXJ5EgsK", + "A3FwcxgBIAEoARIbChNxcHNfcGVyX3NlcnZlcl9jb3JlGAIgASgBEhoKEnNl", + "cnZlcl9zeXN0ZW1fdGltZRgDIAEoARIYChBzZXJ2ZXJfdXNlcl90aW1lGAQg", + "ASgBEhoKEmNsaWVudF9zeXN0ZW1fdGltZRgFIAEoARIYChBjbGllbnRfdXNl", + "cl90aW1lGAYgASgBEhIKCmxhdGVuY3lfNTAYByABKAESEgoKbGF0ZW5jeV85", + "MBgIIAEoARISCgpsYXRlbmN5Xzk1GAkgASgBEhIKCmxhdGVuY3lfOTkYCiAB", + "KAESEwoLbGF0ZW5jeV85OTkYCyABKAEimAIKDlNjZW5hcmlvUmVzdWx0EigK", + "CHNjZW5hcmlvGAEgASgLMhYuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvEi4KCWxh", + "dGVuY2llcxgCIAEoCzIbLmdycGMudGVzdGluZy5IaXN0b2dyYW1EYXRhEi8K", + "DGNsaWVudF9zdGF0cxgDIAMoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0", + "cxIvCgxzZXJ2ZXJfc3RhdHMYBCADKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVy", + "U3RhdHMSFAoMc2VydmVyX2NvcmVzGAUgAygFEjQKB3N1bW1hcnkYBiABKAsy", + "Iy5ncnBjLnRlc3RpbmcuU2NlbmFyaW9SZXN1bHRTdW1tYXJ5KkEKCkNsaWVu", + "dFR5cGUSDwoLU1lOQ19DTElFTlQQABIQCgxBU1lOQ19DTElFTlQQARIQCgxP", + "VEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJUeXBlEg8KC1NZTkNfU0VSVkVSEAAS", + "EAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZTkNfR0VORVJJQ19TRVJWRVIQAhIQ", + "CgxPVEhFUl9TRVJWRVIQAyojCgdScGNUeXBlEgkKBVVOQVJZEAASDQoJU1RS", + "RUFNSU5HEAFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedCodeInfo[] { @@ -88,11 +90,11 @@ namespace Grpc.Testing { new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null), @@ -109,14 +111,26 @@ namespace Grpc.Testing { } #region Enums public enum ClientType { + /// + /// Many languages support a basic distinction between using + /// sync or async client, and this allows the specification + /// SYNC_CLIENT = 0, ASYNC_CLIENT = 1, + /// + /// used for some language-specific variants + /// + OTHER_CLIENT = 2, } public enum ServerType { SYNC_SERVER = 0, ASYNC_SERVER = 1, ASYNC_GENERIC_SERVER = 2, + /// + /// used for some language-specific variants + /// + OTHER_SERVER = 3, } public enum RpcType { @@ -651,6 +665,7 @@ namespace Grpc.Testing { HistogramParams = other.histogramParams_ != null ? other.HistogramParams.Clone() : null; coreList_ = other.coreList_.Clone(); coreLimit_ = other.coreLimit_; + otherClientApi_ = other.otherClientApi_; } public ClientConfig Clone() { @@ -795,6 +810,19 @@ namespace Grpc.Testing { } } + /// Field number for the "other_client_api" field. + public const int OtherClientApiFieldNumber = 15; + private string otherClientApi_ = ""; + /// + /// If we use an OTHER_CLIENT client_type, this string gives more detail + /// + public string OtherClientApi { + get { return otherClientApi_; } + set { + otherClientApi_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + public override bool Equals(object other) { return Equals(other as ClientConfig); } @@ -818,6 +846,7 @@ namespace Grpc.Testing { if (!object.Equals(HistogramParams, other.HistogramParams)) return false; if(!coreList_.Equals(other.coreList_)) return false; if (CoreLimit != other.CoreLimit) return false; + if (OtherClientApi != other.OtherClientApi) return false; return true; } @@ -835,6 +864,7 @@ namespace Grpc.Testing { if (histogramParams_ != null) hash ^= HistogramParams.GetHashCode(); hash ^= coreList_.GetHashCode(); if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); + if (OtherClientApi.Length != 0) hash ^= OtherClientApi.GetHashCode(); return hash; } @@ -885,6 +915,10 @@ namespace Grpc.Testing { output.WriteRawTag(112); output.WriteInt32(CoreLimit); } + if (OtherClientApi.Length != 0) { + output.WriteRawTag(122); + output.WriteString(OtherClientApi); + } } public int CalculateSize() { @@ -921,6 +955,9 @@ namespace Grpc.Testing { if (CoreLimit != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(CoreLimit); } + if (OtherClientApi.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherClientApi); + } return size; } @@ -972,6 +1009,9 @@ namespace Grpc.Testing { if (other.CoreLimit != 0) { CoreLimit = other.CoreLimit; } + if (other.OtherClientApi.Length != 0) { + OtherClientApi = other.OtherClientApi; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -1042,6 +1082,10 @@ namespace Grpc.Testing { CoreLimit = input.ReadInt32(); break; } + case 122: { + OtherClientApi = input.ReadString(); + break; + } } } } @@ -1462,6 +1506,7 @@ namespace Grpc.Testing { coreLimit_ = other.coreLimit_; PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null; coreList_ = other.coreList_.Clone(); + otherServerApi_ = other.otherServerApi_; } public ServerConfig Clone() { @@ -1552,6 +1597,19 @@ namespace Grpc.Testing { get { return coreList_; } } + /// Field number for the "other_server_api" field. + public const int OtherServerApiFieldNumber = 11; + private string otherServerApi_ = ""; + /// + /// If we use an OTHER_SERVER client_type, this string gives more detail + /// + public string OtherServerApi { + get { return otherServerApi_; } + set { + otherServerApi_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + public override bool Equals(object other) { return Equals(other as ServerConfig); } @@ -1570,6 +1628,7 @@ namespace Grpc.Testing { if (CoreLimit != other.CoreLimit) return false; if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false; if(!coreList_.Equals(other.coreList_)) return false; + if (OtherServerApi != other.OtherServerApi) return false; return true; } @@ -1582,6 +1641,7 @@ namespace Grpc.Testing { if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode(); hash ^= coreList_.GetHashCode(); + if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode(); return hash; } @@ -1615,6 +1675,10 @@ namespace Grpc.Testing { output.WriteMessage(PayloadConfig); } coreList_.WriteTo(output, _repeated_coreList_codec); + if (OtherServerApi.Length != 0) { + output.WriteRawTag(90); + output.WriteString(OtherServerApi); + } } public int CalculateSize() { @@ -1638,6 +1702,9 @@ namespace Grpc.Testing { size += 1 + pb::CodedOutputStream.ComputeMessageSize(PayloadConfig); } size += coreList_.CalculateSize(_repeated_coreList_codec); + if (OtherServerApi.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherServerApi); + } return size; } @@ -1670,6 +1737,9 @@ namespace Grpc.Testing { PayloadConfig.MergeFrom(other.PayloadConfig); } coreList_.Add(other.coreList_); + if (other.OtherServerApi.Length != 0) { + OtherServerApi = other.OtherServerApi; + } } public void MergeFrom(pb::CodedInputStream input) { @@ -1714,6 +1784,10 @@ namespace Grpc.Testing { coreList_.AddEntriesFrom(input, _repeated_coreList_codec); break; } + case 90: { + OtherServerApi = input.ReadString(); + break; + } } } } -- cgit v1.2.3 From 445a82bfae3a3b221d5c55183edfca7802c8476c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 21 Apr 2016 13:18:26 -0700 Subject: Add C# stress test client --- .../.gitignore | 3 + .../Grpc.IntegrationTesting.StressClient.csproj | 60 +++++ .../Program.cs | 12 + .../Properties/AssemblyInfo.cs | 11 + .../Grpc.IntegrationTesting.csproj | 1 + .../Grpc.IntegrationTesting/StressTestClient.cs | 296 +++++++++++++++++++++ src/csharp/Grpc.sln | 8 + src/csharp/generate_proto_csharp.sh | 2 +- 8 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/.gitignore create mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj create mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs create mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/Properties/AssemblyInfo.cs create mode 100644 src/csharp/Grpc.IntegrationTesting/StressTestClient.cs (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/.gitignore b/src/csharp/Grpc.IntegrationTesting.StressClient/.gitignore new file mode 100644 index 0000000000..a382af2294 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/.gitignore @@ -0,0 +1,3 @@ +bin +obj + diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj new file mode 100644 index 0000000000..d6eba74289 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj @@ -0,0 +1,60 @@ + + + + Debug + AnyCPU + {ADEBA147-80AE-4710-82E9-5B7F93690266} + Exe + Grpc.IntegrationTesting.StressClient + Grpc.IntegrationTesting.StressClient + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + AnyCPU + + + pdbonly + true + bin\Release + prompt + 4 + AnyCPU + + + pdbonly + true + bin\ReleaseSigned + prompt + 4 + True + ..\keys\Grpc.snk + + + + + + + Version.cs + + + + + + + + {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} + Grpc.Core + + + {C61154BA-DD4A-4838-8420-0162A28925E0} + Grpc.IntegrationTesting + + + \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs b/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs new file mode 100644 index 0000000000..4285146756 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace Grpc.IntegrationTesting.StressClient +{ + class MainClass + { + public static void Main(string[] args) + { + StressTestClient.Run(args); + } + } +} diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting.StressClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e845bbfb9e --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Grpc.IntegrationTesting.StressClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Google Inc. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index c16d0e5c5d..176e005d02 100644 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -113,6 +113,7 @@ + diff --git a/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs new file mode 100644 index 0000000000..b12b28b9a3 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs @@ -0,0 +1,296 @@ +#region Copyright notice and license + +// Copyright 2015-2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +using CommandLine; +using CommandLine.Text; +using Grpc.Core; +using Grpc.Core.Logging; +using Grpc.Core.Utils; +using Grpc.Testing; + +namespace Grpc.IntegrationTesting +{ + public class StressTestClient + { + static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + const double SecondsToNanos = 1e9; + + private class ClientOptions + { + [Option("server_addresses", DefaultValue = "localhost:8080")] + public string ServerAddresses { get; set; } + + [Option("test_cases", DefaultValue = "large_unary:100")] + public string TestCases { get; set; } + + [Option("test_duration_secs", DefaultValue = -1)] + public int TestDurationSecs { get; set; } + + [Option("num_channels_per_server", DefaultValue = 1)] + public int NumChannelsPerServer { get; set; } + + [Option("num_stubs_per_channel", DefaultValue = 1)] + public int NumStubsPerChannel { get; set; } + + [Option("metrics_port", DefaultValue = 8081)] + public int MetricsPort { get; set; } + + [HelpOption] + public string GetUsage() + { + var help = new HelpText + { + Heading = "gRPC C# stress test client", + AddDashesToOption = true + }; + help.AddPreOptionsLine("Usage:"); + help.AddOptions(this); + return help; + } + } + + ClientOptions options; + List serverAddresses; + Dictionary weightedTestCases; + WeightedRandomGenerator testCaseGenerator; + + // cancellation will be emitted once test_duration_secs has elapsed. + CancellationTokenSource finishedTokenSource = new CancellationTokenSource(); + Histogram histogram = new Histogram(0.01, 60 * SecondsToNanos); + + private StressTestClient(ClientOptions options, List serverAddresses, Dictionary weightedTestCases) + { + this.options = options; + this.serverAddresses = serverAddresses; + this.weightedTestCases = weightedTestCases; + this.testCaseGenerator = new WeightedRandomGenerator(this.weightedTestCases); + } + + public static void Run(string[] args) + { + var options = new ClientOptions(); + if (!Parser.Default.ParseArguments(args, options)) + { + Environment.Exit(1); + } + + GrpcPreconditions.CheckArgument(options.NumChannelsPerServer > 0); + GrpcPreconditions.CheckArgument(options.NumStubsPerChannel > 0); + + var serverAddresses = options.ServerAddresses.Split(','); + GrpcPreconditions.CheckArgument(serverAddresses.Length > 0, "You need to provide at least one server address"); + + var testCases = ParseWeightedTestCases(options.TestCases); + GrpcPreconditions.CheckArgument(testCases.Count > 0, "You need to provide at least one test case"); + + var interopClient = new StressTestClient(options, serverAddresses.ToList(), testCases); + interopClient.Run().Wait(); + } + + async Task Run() + { + var metricsServer = new Server() + { + Services = { MetricsService.BindService(new MetricsServiceImpl(histogram)) }, + Ports = { { "[::]", options.MetricsPort, ServerCredentials.Insecure } } + }; + metricsServer.Start(); + + if (options.TestDurationSecs >= 0) + { + finishedTokenSource.CancelAfter(TimeSpan.FromSeconds(options.TestDurationSecs)); + } + + var tasks = new List(); + var channels = new List(); + foreach (var serverAddress in serverAddresses) + { + for (int i = 0; i < options.NumChannelsPerServer; i++) + { + var channel = new Channel(serverAddress, ChannelCredentials.Insecure); + channels.Add(channel); + for (int j = 0; j < options.NumStubsPerChannel; j++) + { + var client = TestService.NewClient(channel); + var task = Task.Factory.StartNew(() => RunBodyAsync(client).GetAwaiter().GetResult(), + TaskCreationOptions.LongRunning); + tasks.Add(task); + } + } + } + await Task.WhenAll(tasks); + + foreach (var channel in channels) + { + await channel.ShutdownAsync(); + } + + await metricsServer.ShutdownAsync(); + } + + async Task RunBodyAsync(TestService.TestServiceClient client) + { + Logger.Info("Starting stress test client thread."); + while (!finishedTokenSource.Token.IsCancellationRequested) + { + var testCase = testCaseGenerator.GetNext(); + + var stopwatch = Stopwatch.StartNew(); + + await RunTestCaseAsync(client, testCase); + + stopwatch.Stop(); + histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos); + } + Logger.Info("Stress test client thread finished."); + } + + async Task RunTestCaseAsync(TestService.TestServiceClient client, string testCase) + { + switch (testCase) + { + case "empty_unary": + InteropClient.RunEmptyUnary(client); + break; + case "large_unary": + InteropClient.RunLargeUnary(client); + break; + case "client_streaming": + await InteropClient.RunClientStreamingAsync(client); + break; + case "server_streaming": + await InteropClient.RunServerStreamingAsync(client); + break; + case "ping_pong": + await InteropClient.RunPingPongAsync(client); + break; + case "empty_stream": + await InteropClient.RunEmptyStreamAsync(client); + break; + case "cancel_after_begin": + await InteropClient.RunCancelAfterBeginAsync(client); + break; + case "cancel_after_first_response": + await InteropClient.RunCancelAfterFirstResponseAsync(client); + break; + case "timeout_on_sleeping_server": + await InteropClient.RunTimeoutOnSleepingServerAsync(client); + break; + case "custom_metadata": + await InteropClient.RunCustomMetadataAsync(client); + break; + case "status_code_and_message": + await InteropClient.RunStatusCodeAndMessageAsync(client); + break; + default: + throw new ArgumentException("Unsupported test case " + testCase); + } + } + + static Dictionary ParseWeightedTestCases(string weightedTestCases) + { + var result = new Dictionary(); + foreach (var weightedTestCase in weightedTestCases.Split(',')) + { + var parts = weightedTestCase.Split(new char[] {':'}, 2); + GrpcPreconditions.CheckArgument(parts.Length == 2, "Malformed test_cases option."); + result.Add(parts[0], int.Parse(parts[1])); + } + return result; + } + + class WeightedRandomGenerator + { + readonly Random random = new Random(); + readonly List> cumulativeSums; + readonly int weightSum; + + public WeightedRandomGenerator(Dictionary weightedItems) + { + cumulativeSums = new List>(); + weightSum = 0; + foreach (var entry in weightedItems) + { + weightSum += entry.Value; + cumulativeSums.Add(Tuple.Create(weightSum, entry.Key)); + } + } + + public string GetNext() + { + int rand = random.Next(weightSum); + foreach (var entry in cumulativeSums) + { + if (rand < entry.Item1) + { + return entry.Item2; + } + } + throw new InvalidOperationException("GetNext() failed."); + } + } + + class MetricsServiceImpl : MetricsService.MetricsServiceBase + { + readonly Histogram histogram; + readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); + + public MetricsServiceImpl(Histogram histogram) + { + this.histogram = histogram; + } + + public override async Task GetAllGauges(EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context) + { + var snapshot = histogram.GetSnapshot(true); + var elapsedSnapshot = wallClockStopwatch.GetElapsedSnapshot(true); + + double qps = snapshot.Count / elapsedSnapshot.Seconds; + + var response = new GaugeResponse + { + Name = "csharp_overall_qps", + DoubleValue = qps + }; + await responseStream.WriteAsync(response); + } + } + } +} diff --git a/src/csharp/Grpc.sln b/src/csharp/Grpc.sln index 8ff35e8c0d..9be36c0caa 100644 --- a/src/csharp/Grpc.sln +++ b/src/csharp/Grpc.sln @@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.HealthCheck.Tests", "G EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.csproj", "{B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.csproj", "{ADEBA147-80AE-4710-82E9-5B7F93690266}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +85,12 @@ Global {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Release|Any CPU.Build.0 = Release|Any CPU {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.Build.0 = Release|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU + {ADEBA147-80AE-4710-82E9-5B7F93690266}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 9ac770b79d..79488e02a5 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -45,4 +45,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_D -I src/proto/grpc/health/v1 src/proto/grpc/health/v1/health.proto $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ - -I . src/proto/grpc/testing/{control,empty,messages,payloads,services,stats,test}.proto + -I . src/proto/grpc/testing/{control,empty,messages,metrics,payloads,services,stats,test}.proto -- cgit v1.2.3 From 987e978e4136d7ab47412a9a6aaab9275ac152c9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 21 Apr 2016 13:53:39 -0700 Subject: add metrics.proto generated files to C# project --- src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index 176e005d02..9685cf1837 100644 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -114,6 +114,8 @@ + + -- cgit v1.2.3 From 44aa843b1b1cb2467efec434c4ef002ca86dd2bf Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 21 Apr 2016 13:54:44 -0700 Subject: add generated proto files --- src/csharp/Grpc.IntegrationTesting/Metrics.cs | 452 ++++++++++++++++++++++ src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 146 +++++++ 2 files changed, 598 insertions(+) create mode 100644 src/csharp/Grpc.IntegrationTesting/Metrics.cs create mode 100644 src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting/Metrics.cs b/src/csharp/Grpc.IntegrationTesting/Metrics.cs new file mode 100644 index 0000000000..3163949d32 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/Metrics.cs @@ -0,0 +1,452 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/metrics.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Grpc.Testing { + + /// Holder for reflection information generated from src/proto/grpc/testing/metrics.proto + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class MetricsReflection { + + #region Descriptor + /// File descriptor for src/proto/grpc/testing/metrics.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static MetricsReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiRzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL21ldHJpY3MucHJvdG8SDGdycGMu", + "dGVzdGluZyJsCg1HYXVnZVJlc3BvbnNlEgwKBG5hbWUYASABKAkSFAoKbG9u", + "Z192YWx1ZRgCIAEoA0gAEhYKDGRvdWJsZV92YWx1ZRgDIAEoAUgAEhYKDHN0", + "cmluZ192YWx1ZRgEIAEoCUgAQgcKBXZhbHVlIhwKDEdhdWdlUmVxdWVzdBIM", + "CgRuYW1lGAEgASgJIg4KDEVtcHR5TWVzc2FnZTKgAQoOTWV0cmljc1NlcnZp", + "Y2USSQoMR2V0QWxsR2F1Z2VzEhouZ3JwYy50ZXN0aW5nLkVtcHR5TWVzc2Fn", + "ZRobLmdycGMudGVzdGluZy5HYXVnZVJlc3BvbnNlMAESQwoIR2V0R2F1Z2US", + "Gi5ncnBjLnRlc3RpbmcuR2F1Z2VSZXF1ZXN0GhsuZ3JwYy50ZXN0aW5nLkdh", + "dWdlUmVzcG9uc2ViBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.GaugeResponse), global::Grpc.Testing.GaugeResponse.Parser, new[]{ "Name", "LongValue", "DoubleValue", "StringValue" }, new[]{ "Value" }, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.GaugeRequest), global::Grpc.Testing.GaugeRequest.Parser, new[]{ "Name" }, null, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.EmptyMessage), global::Grpc.Testing.EmptyMessage.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Reponse message containing the gauge name and value + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class GaugeResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GaugeResponse()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[0]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public GaugeResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + public GaugeResponse(GaugeResponse other) : this() { + name_ = other.name_; + switch (other.ValueCase) { + case ValueOneofCase.LongValue: + LongValue = other.LongValue; + break; + case ValueOneofCase.DoubleValue: + DoubleValue = other.DoubleValue; + break; + case ValueOneofCase.StringValue: + StringValue = other.StringValue; + break; + } + + } + + public GaugeResponse Clone() { + return new GaugeResponse(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + public string Name { + get { return name_; } + set { + name_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "long_value" field. + public const int LongValueFieldNumber = 2; + public long LongValue { + get { return valueCase_ == ValueOneofCase.LongValue ? (long) value_ : 0L; } + set { + value_ = value; + valueCase_ = ValueOneofCase.LongValue; + } + } + + /// Field number for the "double_value" field. + public const int DoubleValueFieldNumber = 3; + public double DoubleValue { + get { return valueCase_ == ValueOneofCase.DoubleValue ? (double) value_ : 0D; } + set { + value_ = value; + valueCase_ = ValueOneofCase.DoubleValue; + } + } + + /// Field number for the "string_value" field. + public const int StringValueFieldNumber = 4; + public string StringValue { + get { return valueCase_ == ValueOneofCase.StringValue ? (string) value_ : ""; } + set { + value_ = pb::Preconditions.CheckNotNull(value, "value"); + valueCase_ = ValueOneofCase.StringValue; + } + } + + private object value_; + /// Enum of possible cases for the "value" oneof. + public enum ValueOneofCase { + None = 0, + LongValue = 2, + DoubleValue = 3, + StringValue = 4, + } + private ValueOneofCase valueCase_ = ValueOneofCase.None; + public ValueOneofCase ValueCase { + get { return valueCase_; } + } + + public void ClearValue() { + valueCase_ = ValueOneofCase.None; + value_ = null; + } + + public override bool Equals(object other) { + return Equals(other as GaugeResponse); + } + + public bool Equals(GaugeResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (LongValue != other.LongValue) return false; + if (DoubleValue != other.DoubleValue) return false; + if (StringValue != other.StringValue) return false; + if (ValueCase != other.ValueCase) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (valueCase_ == ValueOneofCase.LongValue) hash ^= LongValue.GetHashCode(); + if (valueCase_ == ValueOneofCase.DoubleValue) hash ^= DoubleValue.GetHashCode(); + if (valueCase_ == ValueOneofCase.StringValue) hash ^= StringValue.GetHashCode(); + hash ^= (int) valueCase_; + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (valueCase_ == ValueOneofCase.LongValue) { + output.WriteRawTag(16); + output.WriteInt64(LongValue); + } + if (valueCase_ == ValueOneofCase.DoubleValue) { + output.WriteRawTag(25); + output.WriteDouble(DoubleValue); + } + if (valueCase_ == ValueOneofCase.StringValue) { + output.WriteRawTag(34); + output.WriteString(StringValue); + } + } + + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (valueCase_ == ValueOneofCase.LongValue) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(LongValue); + } + if (valueCase_ == ValueOneofCase.DoubleValue) { + size += 1 + 8; + } + if (valueCase_ == ValueOneofCase.StringValue) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue); + } + return size; + } + + public void MergeFrom(GaugeResponse other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + switch (other.ValueCase) { + case ValueOneofCase.LongValue: + LongValue = other.LongValue; + break; + case ValueOneofCase.DoubleValue: + DoubleValue = other.DoubleValue; + break; + case ValueOneofCase.StringValue: + StringValue = other.StringValue; + break; + } + + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + LongValue = input.ReadInt64(); + break; + } + case 25: { + DoubleValue = input.ReadDouble(); + break; + } + case 34: { + StringValue = input.ReadString(); + break; + } + } + } + } + + } + + /// + /// Request message containing the gauge name + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class GaugeRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GaugeRequest()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[1]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public GaugeRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + public GaugeRequest(GaugeRequest other) : this() { + name_ = other.name_; + } + + public GaugeRequest Clone() { + return new GaugeRequest(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + public string Name { + get { return name_; } + set { + name_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public override bool Equals(object other) { + return Equals(other as GaugeRequest); + } + + public bool Equals(GaugeRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + } + + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + return size; + } + + public void MergeFrom(GaugeRequest other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + } + } + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class EmptyMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EmptyMessage()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[2]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public EmptyMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + public EmptyMessage(EmptyMessage other) : this() { + } + + public EmptyMessage Clone() { + return new EmptyMessage(this); + } + + public override bool Equals(object other) { + return Equals(other as EmptyMessage); + } + + public bool Equals(EmptyMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + public override int GetHashCode() { + int hash = 1; + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + } + + public int CalculateSize() { + int size = 0; + return size; + } + + public void MergeFrom(EmptyMessage other) { + if (other == null) { + return; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs new file mode 100644 index 0000000000..cc01ae91a1 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -0,0 +1,146 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/metrics.proto +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; + +namespace Grpc.Testing { + public static class MetricsService + { + static readonly string __ServiceName = "grpc.testing.MetricsService"; + + static readonly Marshaller __Marshaller_EmptyMessage = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.EmptyMessage.Parser.ParseFrom); + static readonly Marshaller __Marshaller_GaugeResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeResponse.Parser.ParseFrom); + static readonly Marshaller __Marshaller_GaugeRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeRequest.Parser.ParseFrom); + + static readonly Method __Method_GetAllGauges = new Method( + MethodType.ServerStreaming, + __ServiceName, + "GetAllGauges", + __Marshaller_EmptyMessage, + __Marshaller_GaugeResponse); + + static readonly Method __Method_GetGauge = new Method( + MethodType.Unary, + __ServiceName, + "GetGauge", + __Marshaller_GaugeRequest, + __Marshaller_GaugeResponse); + + // service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } + } + + // client interface + [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] + public interface IMetricsServiceClient + { + AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options); + global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options); + AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options); + } + + // server-side interface + [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] + public interface IMetricsService + { + Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context); + Task GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context); + } + + // server-side abstract class + public abstract class MetricsServiceBase + { + public virtual Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context) + { + throw new RpcException(new Status(StatusCode.Unimplemented, "")); + } + + public virtual Task GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context) + { + throw new RpcException(new Status(StatusCode.Unimplemented, "")); + } + + } + + // client stub + public class MetricsServiceClient : ClientBase, IMetricsServiceClient + { + public MetricsServiceClient(Channel channel) : base(channel) + { + } + public MetricsServiceClient(CallInvoker callInvoker) : base(callInvoker) + { + } + ///Protected parameterless constructor to allow creation of test doubles. + protected MetricsServiceClient() : base() + { + } + ///Protected constructor to allow creation of configured clients. + protected MetricsServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetAllGauges(request, new CallOptions(headers, deadline, cancellationToken)); + } + public virtual AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options) + { + return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request); + } + public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetGauge(request, new CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request); + } + public virtual AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetGaugeAsync(request, new CallOptions(headers, deadline, cancellationToken)); + } + public virtual AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request); + } + protected override MetricsServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new MetricsServiceClient(configuration); + } + } + + // creates service definition that can be registered with a server + public static ServerServiceDefinition BindService(IMetricsService serviceImpl) + { + return ServerServiceDefinition.CreateBuilder(__ServiceName) + .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) + .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); + } + + // creates service definition that can be registered with a server + public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) + { + return ServerServiceDefinition.CreateBuilder(__ServiceName) + .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) + .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); + } + + // creates a new client + public static MetricsServiceClient NewClient(Channel channel) + { + return new MetricsServiceClient(channel); + } + + } +} +#endregion -- cgit v1.2.3 From f4bc99eb004f11e4fd75cccb863b65e9e6cbe414 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 25 Apr 2016 09:13:38 -0700 Subject: address comments --- .../Program.cs | 35 +++++++++++++++++++++- .../Grpc.IntegrationTesting/StressTestClient.cs | 34 +++++++++++++++++---- 2 files changed, 62 insertions(+), 7 deletions(-) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs b/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs index 4285146756..dffdf22fa5 100644 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs @@ -1,4 +1,37 @@ -using System; +#region Copyright notice and license + +// Copyright 2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; namespace Grpc.IntegrationTesting.StressClient { diff --git a/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs index b12b28b9a3..8db691cb04 100644 --- a/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs @@ -269,6 +269,8 @@ namespace Grpc.IntegrationTesting class MetricsServiceImpl : MetricsService.MetricsServiceBase { + const string GaugeName = "csharp_overall_qps"; + readonly Histogram histogram; readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); @@ -277,20 +279,40 @@ namespace Grpc.IntegrationTesting this.histogram = histogram; } - public override async Task GetAllGauges(EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context) + public override Task GetGauge(GaugeRequest request, ServerCallContext context) { - var snapshot = histogram.GetSnapshot(true); - var elapsedSnapshot = wallClockStopwatch.GetElapsedSnapshot(true); + if (request.Name == GaugeName) + { + long qps = GetQpsAndReset(); - double qps = snapshot.Count / elapsedSnapshot.Seconds; + return Task.FromResult(new GaugeResponse + { + Name = GaugeName, + LongValue = qps + }); + } + throw new RpcException(new Status(StatusCode.InvalidArgument, "Gauge does not exist")); + } + + public override async Task GetAllGauges(EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context) + { + long qps = GetQpsAndReset(); var response = new GaugeResponse { - Name = "csharp_overall_qps", - DoubleValue = qps + Name = GaugeName, + LongValue = qps }; await responseStream.WriteAsync(response); } + + long GetQpsAndReset() + { + var snapshot = histogram.GetSnapshot(true); + var elapsedSnapshot = wallClockStopwatch.GetElapsedSnapshot(true); + + return (long) (snapshot.Count / elapsedSnapshot.Seconds); + } } } } -- cgit v1.2.3 From 55fad175dd3909f08ecda6270b324fa4098d0efe Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 25 Apr 2016 13:42:28 -0700 Subject: regenerate C# protos --- src/csharp/Grpc.Examples/MathGrpc.cs | 6 ++++++ src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 6 ++++++ src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 6 ++++++ src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 12 ++++++++++++ src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 18 ++++++++++++++++++ 5 files changed, 48 insertions(+) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index f3bb0d1cdc..1a6482df90 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -103,7 +103,9 @@ namespace Math { } // client stub + #pragma warning disable 0618 public class MathClient : ClientBase, IMathClient + #pragma warning restore 0618 { public MathClient(Channel channel) : base(channel) { @@ -167,7 +169,9 @@ namespace Math { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMath serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Div, serviceImpl.Div) @@ -177,7 +181,9 @@ namespace Math { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(MathBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Div, serviceImpl.Div) diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 72e11cca3a..e7f779753d 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -56,7 +56,9 @@ namespace Grpc.Health.V1 { } // client stub + #pragma warning disable 0618 public class HealthClient : ClientBase, IHealthClient + #pragma warning restore 0618 { public HealthClient(Channel channel) : base(channel) { @@ -96,14 +98,18 @@ namespace Grpc.Health.V1 { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IHealth serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Check, serviceImpl.Check).Build(); } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(HealthBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Check, serviceImpl.Check).Build(); diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index cc01ae91a1..11c1572c19 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -72,7 +72,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class MetricsServiceClient : ClientBase, IMetricsServiceClient + #pragma warning restore 0618 { public MetricsServiceClient(Channel channel) : base(channel) { @@ -120,7 +122,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMetricsService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) @@ -128,7 +132,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 46b16cf202..18cf0672e3 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -71,7 +71,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class BenchmarkServiceClient : ClientBase, IBenchmarkServiceClient + #pragma warning restore 0618 { public BenchmarkServiceClient(Channel channel) : base(channel) { @@ -119,7 +121,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) @@ -127,7 +131,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) @@ -241,7 +247,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class WorkerServiceClient : ClientBase, IWorkerServiceClient + #pragma warning restore 0618 { public WorkerServiceClient(Channel channel) : base(channel) { @@ -313,7 +321,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IWorkerService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_RunServer, serviceImpl.RunServer) @@ -323,7 +333,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_RunServer, serviceImpl.RunServer) diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 31746cbe71..3b915f6df1 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -138,7 +138,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class TestServiceClient : ClientBase, ITestServiceClient + #pragma warning restore 0618 { public TestServiceClient(Channel channel) : base(channel) { @@ -226,7 +228,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(ITestService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) @@ -238,7 +242,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) @@ -303,7 +309,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class UnimplementedServiceClient : ClientBase, IUnimplementedServiceClient + #pragma warning restore 0618 { public UnimplementedServiceClient(Channel channel) : base(channel) { @@ -343,14 +351,18 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); @@ -429,7 +441,9 @@ namespace Grpc.Testing { } // client stub + #pragma warning disable 0618 public class ReconnectServiceClient : ClientBase, IReconnectServiceClient + #pragma warning restore 0618 { public ReconnectServiceClient(Channel channel) : base(channel) { @@ -485,7 +499,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(IReconnectService serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Start, serviceImpl.Start) @@ -493,7 +509,9 @@ namespace Grpc.Testing { } // creates service definition that can be registered with a server + #pragma warning disable 0618 public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) + #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_Start, serviceImpl.Start) -- cgit v1.2.3 From 85c3ab0b0b1c3abf7f8b2c7538e5ca147c88d557 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 26 Apr 2016 17:17:02 -0700 Subject: fix #5912 --- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 5436517960..b3b1abf1bc 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -494,7 +494,8 @@ namespace Grpc.IntegrationTesting } var ex = Assert.ThrowsAsync(async () => await call.ResponseStream.MoveNext()); - Assert.AreEqual(StatusCode.DeadlineExceeded, ex.Status.StatusCode); + // We can't guarantee the status code always DeadlineExceeded. See issue #2685. + Assert.Contains(ex.Status.StatusCode, new[] { StatusCode.DeadlineExceeded, StatusCode.Internal }); } Console.WriteLine("Passed!"); } -- cgit v1.2.3 From 7c0e1eec85d74c5b1c8d9565f0bc28194aebae4f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 25 Apr 2016 16:00:34 -0700 Subject: regenerate code --- src/csharp/Grpc.Examples/MathGrpc.cs | 12 ++++---- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 12 ++++---- src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 12 ++++---- src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 24 +++++++-------- src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 36 +++++++++++----------- 5 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 1a6482df90..edbce913b8 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -168,6 +168,12 @@ namespace Math { } } + // creates a new client + public static MathClient NewClient(Channel channel) + { + return new MathClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMath serviceImpl) @@ -192,12 +198,6 @@ namespace Math { .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); } - // creates a new client - public static MathClient NewClient(Channel channel) - { - return new MathClient(channel); - } - } } #endregion diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index e7f779753d..e2cdabf011 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -97,6 +97,12 @@ namespace Grpc.Health.V1 { } } + // creates a new client + public static HealthClient NewClient(Channel channel) + { + return new HealthClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IHealth serviceImpl) @@ -115,12 +121,6 @@ namespace Grpc.Health.V1 { .AddMethod(__Method_Check, serviceImpl.Check).Build(); } - // creates a new client - public static HealthClient NewClient(Channel channel) - { - return new HealthClient(channel); - } - } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 11c1572c19..0f701a837f 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -121,6 +121,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static MetricsServiceClient NewClient(Channel channel) + { + return new MetricsServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMetricsService serviceImpl) @@ -141,12 +147,6 @@ namespace Grpc.Testing { .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } - // creates a new client - public static MetricsServiceClient NewClient(Channel channel) - { - return new MetricsServiceClient(channel); - } - } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 18cf0672e3..3f07a7aeb6 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -120,6 +120,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static BenchmarkServiceClient NewClient(Channel channel) + { + return new BenchmarkServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) @@ -140,12 +146,6 @@ namespace Grpc.Testing { .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); } - // creates a new client - public static BenchmarkServiceClient NewClient(Channel channel) - { - return new BenchmarkServiceClient(channel); - } - } public static class WorkerService { @@ -320,6 +320,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static WorkerServiceClient NewClient(Channel channel) + { + return new WorkerServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IWorkerService serviceImpl) @@ -344,12 +350,6 @@ namespace Grpc.Testing { .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); } - // creates a new client - public static WorkerServiceClient NewClient(Channel channel) - { - return new WorkerServiceClient(channel); - } - } } #endregion diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 3b915f6df1..4efd35f81f 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -227,6 +227,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static TestServiceClient NewClient(Channel channel) + { + return new TestServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(ITestService serviceImpl) @@ -255,12 +261,6 @@ namespace Grpc.Testing { .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build(); } - // creates a new client - public static TestServiceClient NewClient(Channel channel) - { - return new TestServiceClient(channel); - } - } public static class UnimplementedService { @@ -350,6 +350,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static UnimplementedServiceClient NewClient(Channel channel) + { + return new UnimplementedServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) @@ -368,12 +374,6 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } - // creates a new client - public static UnimplementedServiceClient NewClient(Channel channel) - { - return new UnimplementedServiceClient(channel); - } - } public static class ReconnectService { @@ -498,6 +498,12 @@ namespace Grpc.Testing { } } + // creates a new client + public static ReconnectServiceClient NewClient(Channel channel) + { + return new ReconnectServiceClient(channel); + } + // creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IReconnectService serviceImpl) @@ -518,12 +524,6 @@ namespace Grpc.Testing { .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } - // creates a new client - public static ReconnectServiceClient NewClient(Channel channel) - { - return new ReconnectServiceClient(channel); - } - } } #endregion -- cgit v1.2.3 From bfee01ddc88b8f655fbfb88f83566a170f1ae3a3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 28 Apr 2016 10:52:41 -0700 Subject: regenerate C# sources --- src/csharp/Grpc.Examples/MathGrpc.cs | 176 +++++++++++- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 46 +++- src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 106 +++++++- src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 284 ++++++++++++++++++-- src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 296 +++++++++++++++++++-- 5 files changed, 844 insertions(+), 64 deletions(-) (limited to 'src/csharp/Grpc.IntegrationTesting') diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index edbce913b8..2d3034d28b 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -1,5 +1,35 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: math.proto +// Original file comments: +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// #region Designer generated code using System; @@ -45,56 +75,140 @@ namespace Math { __Marshaller_Num, __Marshaller_Num); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Math.MathReflection.Descriptor.Services[0]; } } - // client interface + /// Client for Math [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IMathClient { + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options); + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// AsyncUnaryCall DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// AsyncUnaryCall DivAsync(global::Math.DivArgs request, CallOptions options); + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// AsyncDuplexStreamingCall DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// AsyncDuplexStreamingCall DivMany(CallOptions options); + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// AsyncServerStreamingCall Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// AsyncServerStreamingCall Fib(global::Math.FibArgs request, CallOptions options); + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// AsyncClientStreamingCall Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// AsyncClientStreamingCall Sum(CallOptions options); } - // server-side interface + /// Interface of server-side implementations of Math [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IMath { + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// Task Div(global::Math.DivArgs request, ServerCallContext context); + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// Task Fib(global::Math.FibArgs request, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// Task Sum(IAsyncStreamReader requestStream, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of Math public abstract class MathBase { + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// public virtual Task Div(global::Math.DivArgs request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// public virtual Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// public virtual Task Fib(global::Math.FibArgs request, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// public virtual Task Sum(IAsyncStreamReader requestStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -102,7 +216,7 @@ namespace Math { } - // client stub + /// Client for Math #pragma warning disable 0618 public class MathClient : ClientBase, IMathClient #pragma warning restore 0618 @@ -122,42 +236,88 @@ namespace Math { { } + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// public virtual global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return Div(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// public virtual global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request); } + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// public virtual AsyncUnaryCall DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return DivAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Div divides args.dividend by args.divisor and returns the quotient and + /// remainder. + /// public virtual AsyncUnaryCall DivAsync(global::Math.DivArgs request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request); } + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// public virtual AsyncDuplexStreamingCall DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return DivMany(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// DivMany accepts an arbitrary number of division args from the client stream + /// and sends back the results in the reply stream. The stream continues until + /// the client closes its end; the server does the same after sending all the + /// replies. The stream ends immediately if either end aborts. + /// public virtual AsyncDuplexStreamingCall DivMany(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options); } + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// public virtual AsyncServerStreamingCall Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return Fib(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib + /// generates up to limit numbers; otherwise it continues until the call is + /// canceled. Unlike Fib above, Fib has no final FibReply. + /// public virtual AsyncServerStreamingCall Fib(global::Math.FibArgs request, CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request); } + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// public virtual AsyncClientStreamingCall Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return Sum(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Sum sums a stream of numbers, returning the final result once the stream + /// is closed. + /// public virtual AsyncClientStreamingCall Sum(CallOptions options) { return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options); @@ -168,13 +328,13 @@ namespace Math { } } - // creates a new client + /// Creates a new client for Math public static MathClient NewClient(Channel channel) { return new MathClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMath serviceImpl) #pragma warning restore 0618 @@ -186,7 +346,7 @@ namespace Math { .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(MathBase serviceImpl) #pragma warning restore 0618 diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index e2cdabf011..967d1170be 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -1,5 +1,35 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: health.proto +// Original file comments: +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// #region Designer generated code using System; @@ -22,13 +52,13 @@ namespace Grpc.Health.V1 { __Marshaller_HealthCheckRequest, __Marshaller_HealthCheckResponse); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; } } - // client interface + /// Client for Health [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IHealthClient { @@ -38,14 +68,14 @@ namespace Grpc.Health.V1 { AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of Health [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IHealth { Task Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of Health public abstract class HealthBase { public virtual Task Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context) @@ -55,7 +85,7 @@ namespace Grpc.Health.V1 { } - // client stub + /// Client for Health #pragma warning disable 0618 public class HealthClient : ClientBase, IHealthClient #pragma warning restore 0618 @@ -97,13 +127,13 @@ namespace Grpc.Health.V1 { } } - // creates a new client + /// Creates a new client for Health public static HealthClient NewClient(Channel channel) { return new HealthClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IHealth serviceImpl) #pragma warning restore 0618 @@ -112,7 +142,7 @@ namespace Grpc.Health.V1 { .AddMethod(__Method_Check, serviceImpl.Check).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(HealthBase serviceImpl) #pragma warning restore 0618 diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 0f701a837f..aa4f1c5c3e 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -1,5 +1,41 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: src/proto/grpc/testing/metrics.proto +// Original file comments: +// Copyright 2015-2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Contains the definitions for a metrics service and the type of metrics +// exposed by the service. +// +// Currently, 'Gauge' (i.e a metric that represents the measured value of +// something at an instant of time) is the only metric type supported by the +// service. #region Designer generated code using System; @@ -30,40 +66,74 @@ namespace Grpc.Testing { __Marshaller_GaugeRequest, __Marshaller_GaugeResponse); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } } - // client interface + /// Client for MetricsService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IMetricsServiceClient { + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options); + /// + /// Returns the value of one gauge + /// global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the value of one gauge + /// global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options); + /// + /// Returns the value of one gauge + /// AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the value of one gauge + /// AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of MetricsService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IMetricsService { + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// Returns the value of one gauge + /// Task GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of MetricsService public abstract class MetricsServiceBase { + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// public virtual Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Returns the value of one gauge + /// public virtual Task GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -71,7 +141,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for MetricsService #pragma warning disable 0618 public class MetricsServiceClient : ClientBase, IMetricsServiceClient #pragma warning restore 0618 @@ -91,26 +161,46 @@ namespace Grpc.Testing { { } + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// public virtual AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return GetAllGauges(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Returns the values of all the gauges that are currently being maintained by + /// the service + /// public virtual AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request); } + /// + /// Returns the value of one gauge + /// public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return GetGauge(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Returns the value of one gauge + /// public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request); } + /// + /// Returns the value of one gauge + /// public virtual AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return GetGaugeAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Returns the value of one gauge + /// public virtual AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request); @@ -121,13 +211,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for MetricsService public static MetricsServiceClient NewClient(Channel channel) { return new MetricsServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IMetricsService serviceImpl) #pragma warning restore 0618 @@ -137,7 +227,7 @@ namespace Grpc.Testing { .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) #pragma warning restore 0618 diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 3f07a7aeb6..42bf5e0b58 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -1,5 +1,37 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: src/proto/grpc/testing/services.proto +// Original file comments: +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. #region Designer generated code using System; @@ -29,40 +61,80 @@ namespace Grpc.Testing { __Marshaller_SimpleRequest, __Marshaller_SimpleResponse); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; } } - // client interface + /// Client for BenchmarkService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IBenchmarkServiceClient { + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// AsyncDuplexStreamingCall StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// AsyncDuplexStreamingCall StreamingCall(CallOptions options); } - // server-side interface + /// Interface of server-side implementations of BenchmarkService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IBenchmarkService { + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// Task StreamingCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of BenchmarkService public abstract class BenchmarkServiceBase { + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual Task StreamingCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -70,7 +142,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for BenchmarkService #pragma warning disable 0618 public class BenchmarkServiceClient : ClientBase, IBenchmarkServiceClient #pragma warning restore 0618 @@ -90,26 +162,50 @@ namespace Grpc.Testing { { } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual AsyncDuplexStreamingCall StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return StreamingCall(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by one response. + /// The server returns the client payload as-is. + /// public virtual AsyncDuplexStreamingCall StreamingCall(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options); @@ -120,13 +216,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for BenchmarkService public static BenchmarkServiceClient NewClient(Channel channel) { return new BenchmarkServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) #pragma warning restore 0618 @@ -136,7 +232,7 @@ namespace Grpc.Testing { .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) #pragma warning restore 0618 @@ -187,58 +283,158 @@ namespace Grpc.Testing { __Marshaller_Void, __Marshaller_Void); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; } } - // client interface + /// Client for WorkerService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IWorkerServiceClient { + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// AsyncDuplexStreamingCall RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// AsyncDuplexStreamingCall RunServer(CallOptions options); + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// AsyncDuplexStreamingCall RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// AsyncDuplexStreamingCall RunClient(CallOptions options); + /// + /// Just return the core count - unary call + /// global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Just return the core count - unary call + /// global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options); + /// + /// Just return the core count - unary call + /// AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Just return the core count - unary call + /// AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options); + /// + /// Quit this worker + /// global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Quit this worker + /// global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options); + /// + /// Quit this worker + /// AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Quit this worker + /// AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of WorkerService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IWorkerService { + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// Task RunServer(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// Task RunClient(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// Just return the core count - unary call + /// Task CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context); + /// + /// Quit this worker + /// Task QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of WorkerService public abstract class WorkerServiceBase { + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual Task RunServer(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual Task RunClient(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Just return the core count - unary call + /// public virtual Task CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// Quit this worker + /// public virtual Task QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -246,7 +442,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for WorkerService #pragma warning disable 0618 public class WorkerServiceClient : ClientBase, IWorkerServiceClient #pragma warning restore 0618 @@ -266,50 +462,106 @@ namespace Grpc.Testing { { } + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual AsyncDuplexStreamingCall RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return RunServer(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual AsyncDuplexStreamingCall RunServer(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options); } + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual AsyncDuplexStreamingCall RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return RunClient(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + /// public virtual AsyncDuplexStreamingCall RunClient(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options); } + /// + /// Just return the core count - unary call + /// public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return CoreCount(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Just return the core count - unary call + /// public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request); } + /// + /// Just return the core count - unary call + /// public virtual AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Just return the core count - unary call + /// public virtual AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request); } + /// + /// Quit this worker + /// public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Quit this worker + /// public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request); } + /// + /// Quit this worker + /// public virtual AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// Quit this worker + /// public virtual AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request); @@ -320,13 +572,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for WorkerService public static WorkerServiceClient NewClient(Channel channel) { return new WorkerServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IWorkerService serviceImpl) #pragma warning restore 0618 @@ -338,7 +590,7 @@ namespace Grpc.Testing { .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) #pragma warning restore 0618 diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 4efd35f81f..f1878cbb55 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -1,5 +1,38 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: src/proto/grpc/testing/test.proto +// Original file comments: +// Copyright 2015-2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +// #region Designer generated code using System; @@ -8,6 +41,10 @@ using System.Threading.Tasks; using Grpc.Core; namespace Grpc.Testing { + /// + /// A simple service to test the various types of RPCs and experiment with + /// performance with various types of payload. + /// public static class TestService { static readonly string __ServiceName = "grpc.testing.TestService"; @@ -62,74 +99,186 @@ namespace Grpc.Testing { __Marshaller_StreamingOutputCallRequest, __Marshaller_StreamingOutputCallResponse); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[0]; } } - // client interface + /// Client for TestService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface ITestServiceClient { + /// + /// One empty request followed by one empty response. + /// global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One empty request followed by one empty response. + /// global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options); + /// + /// One empty request followed by one empty response. + /// AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One empty request followed by one empty response. + /// AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options); + /// + /// One request followed by one response. + /// global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by one response. + /// global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); + /// + /// One request followed by one response. + /// AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by one response. + /// AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options); + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// AsyncClientStreamingCall StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// AsyncClientStreamingCall StreamingInputCall(CallOptions options); + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// AsyncDuplexStreamingCall FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// AsyncDuplexStreamingCall FullDuplexCall(CallOptions options); + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// AsyncDuplexStreamingCall HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// AsyncDuplexStreamingCall HalfDuplexCall(CallOptions options); } - // server-side interface + /// Interface of server-side implementations of TestService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface ITestService { + /// + /// One empty request followed by one empty response. + /// Task EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context); + /// + /// One request followed by one response. + /// Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// Task StreamingInputCall(IAsyncStreamReader requestStream, ServerCallContext context); + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of TestService public abstract class TestServiceBase { + /// + /// One empty request followed by one empty response. + /// public virtual Task EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// One request followed by one response. + /// public virtual Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// public virtual Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// public virtual Task StreamingInputCall(IAsyncStreamReader requestStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// public virtual Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// public virtual Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -137,7 +286,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for TestService #pragma warning disable 0618 public class TestServiceClient : ClientBase, ITestServiceClient #pragma warning restore 0618 @@ -157,66 +306,128 @@ namespace Grpc.Testing { { } + /// + /// One empty request followed by one empty response. + /// public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return EmptyCall(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One empty request followed by one empty response. + /// public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_EmptyCall, null, options, request); } + /// + /// One empty request followed by one empty response. + /// public virtual AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return EmptyCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One empty request followed by one empty response. + /// public virtual AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_EmptyCall, null, options, request); } + /// + /// One request followed by one response. + /// public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by one response. + /// public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request); } + /// + /// One request followed by one response. + /// public virtual AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by one response. + /// public virtual AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); } + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// public virtual AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return StreamingOutputCall(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// public virtual AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_StreamingOutputCall, null, options, request); } + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// public virtual AsyncClientStreamingCall StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return StreamingInputCall(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + /// public virtual AsyncClientStreamingCall StreamingInputCall(CallOptions options) { return CallInvoker.AsyncClientStreamingCall(__Method_StreamingInputCall, null, options); } + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// public virtual AsyncDuplexStreamingCall FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return FullDuplexCall(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + /// public virtual AsyncDuplexStreamingCall FullDuplexCall(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_FullDuplexCall, null, options); } + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// public virtual AsyncDuplexStreamingCall HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return HalfDuplexCall(new CallOptions(headers, deadline, cancellationToken)); } + /// + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + /// public virtual AsyncDuplexStreamingCall HalfDuplexCall(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_HalfDuplexCall, null, options); @@ -227,13 +438,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for TestService public static TestServiceClient NewClient(Channel channel) { return new TestServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(ITestService serviceImpl) #pragma warning restore 0618 @@ -247,7 +458,7 @@ namespace Grpc.Testing { .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) #pragma warning restore 0618 @@ -262,6 +473,10 @@ namespace Grpc.Testing { } } + /// + /// A simple service NOT implemented at servers so clients can test for + /// that case. + /// public static class UnimplementedService { static readonly string __ServiceName = "grpc.testing.UnimplementedService"; @@ -275,32 +490,50 @@ namespace Grpc.Testing { __Marshaller_Empty, __Marshaller_Empty); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[1]; } } - // client interface + /// Client for UnimplementedService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IUnimplementedServiceClient { + /// + /// A call that no server should implement + /// global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A call that no server should implement + /// global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options); + /// + /// A call that no server should implement + /// AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// A call that no server should implement + /// AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of UnimplementedService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IUnimplementedService { + /// + /// A call that no server should implement + /// Task UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of UnimplementedService public abstract class UnimplementedServiceBase { + /// + /// A call that no server should implement + /// public virtual Task UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); @@ -308,7 +541,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for UnimplementedService #pragma warning disable 0618 public class UnimplementedServiceClient : ClientBase, IUnimplementedServiceClient #pragma warning restore 0618 @@ -328,18 +561,30 @@ namespace Grpc.Testing { { } + /// + /// A call that no server should implement + /// public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// A call that no server should implement + /// public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request); } + /// + /// A call that no server should implement + /// public virtual AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); } + /// + /// A call that no server should implement + /// public virtual AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request); @@ -350,13 +595,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for UnimplementedService public static UnimplementedServiceClient NewClient(Channel channel) { return new UnimplementedServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) #pragma warning restore 0618 @@ -365,7 +610,7 @@ namespace Grpc.Testing { .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) #pragma warning restore 0618 @@ -375,6 +620,9 @@ namespace Grpc.Testing { } } + /// + /// A service used to control reconnect server. + /// public static class ReconnectService { static readonly string __ServiceName = "grpc.testing.ReconnectService"; @@ -397,13 +645,13 @@ namespace Grpc.Testing { __Marshaller_Empty, __Marshaller_ReconnectInfo); - // service descriptor + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[2]; } } - // client interface + /// Client for ReconnectService [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IReconnectServiceClient { @@ -417,7 +665,7 @@ namespace Grpc.Testing { AsyncUnaryCall StopAsync(global::Grpc.Testing.Empty request, CallOptions options); } - // server-side interface + /// Interface of server-side implementations of ReconnectService [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IReconnectService { @@ -425,7 +673,7 @@ namespace Grpc.Testing { Task Stop(global::Grpc.Testing.Empty request, ServerCallContext context); } - // server-side abstract class + /// Base class for server-side implementations of ReconnectService public abstract class ReconnectServiceBase { public virtual Task Start(global::Grpc.Testing.ReconnectParams request, ServerCallContext context) @@ -440,7 +688,7 @@ namespace Grpc.Testing { } - // client stub + /// Client for ReconnectService #pragma warning disable 0618 public class ReconnectServiceClient : ClientBase, IReconnectServiceClient #pragma warning restore 0618 @@ -498,13 +746,13 @@ namespace Grpc.Testing { } } - // creates a new client + /// Creates a new client for ReconnectService public static ReconnectServiceClient NewClient(Channel channel) { return new ReconnectServiceClient(channel); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IReconnectService serviceImpl) #pragma warning restore 0618 @@ -514,7 +762,7 @@ namespace Grpc.Testing { .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } - // creates service definition that can be registered with a server + /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) #pragma warning restore 0618 -- cgit v1.2.3