diff options
Diffstat (limited to 'src')
36 files changed, 4027 insertions, 115 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 37ae42676d..ee8e8588c7 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -404,7 +404,11 @@ static void get_final_status(grpc_call *call, grpc_ioreq_data out) { return; } } - out.recv_status.set_value(GRPC_STATUS_UNKNOWN, out.recv_status.user_data); + if (call->is_client) { + out.recv_status.set_value(GRPC_STATUS_UNKNOWN, out.recv_status.user_data); + } else { + out.recv_status.set_value(GRPC_STATUS_OK, out.recv_status.user_data); + } } static void get_final_details(grpc_call *call, grpc_ioreq_data out) { diff --git a/src/csharp/Grpc.sln b/src/csharp/Grpc.sln index c46c4d6762..a7b2c9b580 100644 --- a/src/csharp/Grpc.sln +++ b/src/csharp/Grpc.sln @@ -1,8 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcDemo", "GrpcDemo\GrpcDemo.csproj", "{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcApi", "GrpcApi\GrpcApi.csproj", "{7DC1433E-3225-42C7-B7EA-546D56E27A4B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcCore", "GrpcCore\GrpcCore.csproj", "{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}"
@@ -11,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcCoreTests", "GrpcCoreTe EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcApiTests", "GrpcApiTests\GrpcApiTests.csproj", "{143B1C29-C442-4BE0-BF3F-A8F92288AC9F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MathClient", "MathClient\MathClient.csproj", "{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InteropClient", "InteropClient\InteropClient.csproj", "{C61154BA-DD4A-4838-8420-0162A28925E0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -33,12 +35,16 @@ Global {86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Debug|x86.Build.0 = Debug|Any CPU
{86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|x86.ActiveCfg = Release|Any CPU
{86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|x86.Build.0 = Release|Any CPU
+ {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.ActiveCfg = Debug|x86
+ {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.Build.0 = Debug|x86
+ {C61154BA-DD4A-4838-8420-0162A28925E0}.Release|x86.ActiveCfg = Release|x86
+ {C61154BA-DD4A-4838-8420-0162A28925E0}.Release|x86.Build.0 = Release|x86
{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Debug|x86.ActiveCfg = Debug|Any CPU
{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Debug|x86.Build.0 = Debug|Any CPU
{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Release|x86.ActiveCfg = Release|Any CPU
{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = GrpcDemo\GrpcDemo.csproj
+ StartupItem = InteropClient\InteropClient.csproj
EndGlobalSection
EndGlobal
diff --git a/src/csharp/GrpcApi/Empty.cs b/src/csharp/GrpcApi/Empty.cs new file mode 100644 index 0000000000..dadfd151ec --- /dev/null +++ b/src/csharp/GrpcApi/Empty.cs @@ -0,0 +1,282 @@ +// Generated by ProtoGen, Version=2.4.1.521, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace grpc.testing { + + namespace Proto { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Empty { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_grpc_testing_Empty__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.Empty, global::grpc.testing.Empty.Builder> internal__static_grpc_testing_Empty__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static Empty() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgtlbXB0eS5wcm90bxIMZ3JwYy50ZXN0aW5nIgcKBUVtcHR5")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_grpc_testing_Empty__Descriptor = Descriptor.MessageTypes[0]; + internal__static_grpc_testing_Empty__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.Empty, global::grpc.testing.Empty.Builder>(internal__static_grpc_testing_Empty__Descriptor, + new string[] { }); + return null; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + }, assigner); + } + #endregion + + } + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Empty : pb::GeneratedMessage<Empty, Empty.Builder> { + private Empty() { } + private static readonly Empty defaultInstance = new Empty().MakeReadOnly(); + private static readonly string[] _emptyFieldNames = new string[] { }; + private static readonly uint[] _emptyFieldTags = new uint[] { }; + public static Empty DefaultInstance { + get { return defaultInstance; } + } + + public override Empty DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Empty ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Proto.Empty.internal__static_grpc_testing_Empty__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<Empty, Empty.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Proto.Empty.internal__static_grpc_testing_Empty__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _emptyFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static Empty ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Empty ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Empty ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Empty ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Empty ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Empty ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Empty ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Empty ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Empty ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Empty ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Empty MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Empty prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<Empty, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Empty cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Empty result; + + private Empty PrepareBuilder() { + if (resultIsReadOnly) { + Empty original = result; + result = new Empty(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Empty MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.Empty.Descriptor; } + } + + public override Empty DefaultInstanceForType { + get { return global::grpc.testing.Empty.DefaultInstance; } + } + + public override Empty BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Empty) { + return MergeFrom((Empty) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Empty other) { + if (other == global::grpc.testing.Empty.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_emptyFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _emptyFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static Empty() { + object.ReferenceEquals(global::grpc.testing.Proto.Empty.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/csharp/GrpcApi/GrpcApi.csproj b/src/csharp/GrpcApi/GrpcApi.csproj index 07bd6f6efb..f0f11de216 100644 --- a/src/csharp/GrpcApi/GrpcApi.csproj +++ b/src/csharp/GrpcApi/GrpcApi.csproj @@ -47,10 +47,13 @@ </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Examples.cs" /> <Compile Include="Math.cs" /> <Compile Include="MathGrpc.cs" /> <Compile Include="MathServiceImpl.cs" /> + <Compile Include="Empty.cs" /> + <Compile Include="Messages.cs" /> + <Compile Include="TestServiceGrpc.cs" /> + <Compile Include="MathExamples.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> @@ -59,4 +62,13 @@ <Name>GrpcCore</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="proto\math.proto" /> + <None Include="proto\empty.proto" /> + <None Include="proto\messages.proto" /> + <None Include="proto\test.proto" /> + </ItemGroup> + <ItemGroup> + <Folder Include="proto\" /> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/src/csharp/GrpcApi/Examples.cs b/src/csharp/GrpcApi/MathExamples.cs index d2a6cc01fd..43f0cedef6 100644 --- a/src/csharp/GrpcApi/Examples.cs +++ b/src/csharp/GrpcApi/MathExamples.cs @@ -6,7 +6,7 @@ using Google.GRPC.Core.Utils; namespace math { - public class Examples + public static class MathExamples { public static void DivExample(MathGrpc.IMathServiceClient stub) { diff --git a/src/csharp/GrpcApi/Messages.cs b/src/csharp/GrpcApi/Messages.cs index b08816bdb7..78e3404d22 100644 --- a/src/csharp/GrpcApi/Messages.cs +++ b/src/csharp/GrpcApi/Messages.cs @@ -1,35 +1,2891 @@ -//using System; +// Generated by ProtoGen, Version=2.4.1.521, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code -//namespace Google.GRPC.Examples.Math -//{ -// // Messages in this file are placeholders for actual protobuf message classes -// // that will be generated from math.proto file. -// -// public class DivArgs -// { -// public long Dividend{ get; set; } -// public long Divisor { get; set; } -// } -// -// public class DivReply -// { -// public long Quotient { get; set; } -// public long Remainder { get; set; } -// } -// -// public class FibArgs -// { -// public long Limit { get; set; } -// } -// -// public class Number -// { -// public long Num { get; set; } -// } -// -// public class FibReply -// { -// public long Count { get; set; } -// } -//} +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace grpc.testing { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Messages { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_grpc_testing_Payload__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.Payload, global::grpc.testing.Payload.Builder> internal__static_grpc_testing_Payload__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_SimpleRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.SimpleRequest, global::grpc.testing.SimpleRequest.Builder> internal__static_grpc_testing_SimpleRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_SimpleResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.SimpleResponse, global::grpc.testing.SimpleResponse.Builder> internal__static_grpc_testing_SimpleResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_StreamingInputCallRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallRequest.Builder> internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_StreamingInputCallResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingInputCallResponse, global::grpc.testing.StreamingInputCallResponse.Builder> internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_ResponseParameters__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.ResponseParameters, global::grpc.testing.ResponseParameters.Builder> internal__static_grpc_testing_ResponseParameters__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallRequest.Builder> internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingOutputCallResponse, global::grpc.testing.StreamingOutputCallResponse.Builder> internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static Messages() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5tZXNzYWdlcy5wcm90bxIMZ3JwYy50ZXN0aW5nIkAKB1BheWxvYWQSJwoE", + "dHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIMCgRib2R5", + "GAIgASgMIrEBCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5cGUYASAB", + "KA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9uc2Vfc2l6", + "ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", + "YWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRoX3Njb3Bl", + "GAUgASgIIl8KDlNpbXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5n", + "cnBjLnRlc3RpbmcuUGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0", + "aF9zY29wZRgDIAEoCSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYK", + "B3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJl", + "YW1pbmdJbnB1dENhbGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRf", + "c2l6ZRgBIAEoBSI3ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEo", + "BRITCgtpbnRlcnZhbF91cxgCIAEoBSK1AQoaU3RyZWFtaW5nT3V0cHV0Q2Fs", + "bFJlcXVlc3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGlu", + "Zy5QYXlsb2FkVHlwZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAu", + "Z3JwYy50ZXN0aW5nLlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMg", + "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQiRQobU3RyZWFtaW5nT3V0cHV0", + "Q2FsbFJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3Rpbmcu", + "UGF5bG9hZCo/CgtQYXlsb2FkVHlwZRIQCgxDT01QUkVTU0FCTEUQABISCg5V", + "TkNPTVBSRVNTQUJMRRABEgoKBlJBTkRPTRAC")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_grpc_testing_Payload__Descriptor = Descriptor.MessageTypes[0]; + internal__static_grpc_testing_Payload__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.Payload, global::grpc.testing.Payload.Builder>(internal__static_grpc_testing_Payload__Descriptor, + new string[] { "Type", "Body", }); + internal__static_grpc_testing_SimpleRequest__Descriptor = Descriptor.MessageTypes[1]; + internal__static_grpc_testing_SimpleRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.SimpleRequest, global::grpc.testing.SimpleRequest.Builder>(internal__static_grpc_testing_SimpleRequest__Descriptor, + new string[] { "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", }); + internal__static_grpc_testing_SimpleResponse__Descriptor = Descriptor.MessageTypes[2]; + internal__static_grpc_testing_SimpleResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.SimpleResponse, global::grpc.testing.SimpleResponse.Builder>(internal__static_grpc_testing_SimpleResponse__Descriptor, + new string[] { "Payload", "Username", "OauthScope", }); + internal__static_grpc_testing_StreamingInputCallRequest__Descriptor = Descriptor.MessageTypes[3]; + internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingInputCallRequest, global::grpc.testing.StreamingInputCallRequest.Builder>(internal__static_grpc_testing_StreamingInputCallRequest__Descriptor, + new string[] { "Payload", }); + internal__static_grpc_testing_StreamingInputCallResponse__Descriptor = Descriptor.MessageTypes[4]; + internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingInputCallResponse, global::grpc.testing.StreamingInputCallResponse.Builder>(internal__static_grpc_testing_StreamingInputCallResponse__Descriptor, + new string[] { "AggregatedPayloadSize", }); + internal__static_grpc_testing_ResponseParameters__Descriptor = Descriptor.MessageTypes[5]; + internal__static_grpc_testing_ResponseParameters__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.ResponseParameters, global::grpc.testing.ResponseParameters.Builder>(internal__static_grpc_testing_ResponseParameters__Descriptor, + new string[] { "Size", "IntervalUs", }); + internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor = Descriptor.MessageTypes[6]; + internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingOutputCallRequest, global::grpc.testing.StreamingOutputCallRequest.Builder>(internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor, + new string[] { "ResponseType", "ResponseParameters", "Payload", }); + internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor = Descriptor.MessageTypes[7]; + internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable<global::grpc.testing.StreamingOutputCallResponse, global::grpc.testing.StreamingOutputCallResponse.Builder>(internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor, + new string[] { "Payload", }); + return null; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + }, assigner); + } + #endregion + + } + #region Enums + public enum PayloadType { + COMPRESSABLE = 0, + UNCOMPRESSABLE = 1, + RANDOM = 2, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Payload : pb::GeneratedMessage<Payload, Payload.Builder> { + private Payload() { } + private static readonly Payload defaultInstance = new Payload().MakeReadOnly(); + private static readonly string[] _payloadFieldNames = new string[] { "body", "type" }; + private static readonly uint[] _payloadFieldTags = new uint[] { 18, 8 }; + public static Payload DefaultInstance { + get { return defaultInstance; } + } + + public override Payload DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Payload ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_Payload__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<Payload, Payload.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_Payload__FieldAccessorTable; } + } + + public const int TypeFieldNumber = 1; + private bool hasType; + private global::grpc.testing.PayloadType type_ = global::grpc.testing.PayloadType.COMPRESSABLE; + public bool HasType { + get { return hasType; } + } + public global::grpc.testing.PayloadType Type { + get { return type_; } + } + + public const int BodyFieldNumber = 2; + private bool hasBody; + private pb::ByteString body_ = pb::ByteString.Empty; + public bool HasBody { + get { return hasBody; } + } + public pb::ByteString Body { + get { return body_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _payloadFieldNames; + if (hasType) { + output.WriteEnum(1, field_names[1], (int) Type, Type); + } + if (hasBody) { + output.WriteBytes(2, field_names[0], Body); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasType) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Type); + } + if (hasBody) { + size += pb::CodedOutputStream.ComputeBytesSize(2, Body); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static Payload ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Payload ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Payload ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Payload ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Payload ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Payload ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Payload ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Payload ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Payload ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Payload ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Payload MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Payload prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<Payload, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Payload cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Payload result; + + private Payload PrepareBuilder() { + if (resultIsReadOnly) { + Payload original = result; + result = new Payload(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Payload MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.Payload.Descriptor; } + } + + public override Payload DefaultInstanceForType { + get { return global::grpc.testing.Payload.DefaultInstance; } + } + + public override Payload BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Payload) { + return MergeFrom((Payload) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Payload other) { + if (other == global::grpc.testing.Payload.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasType) { + Type = other.Type; + } + if (other.HasBody) { + Body = other.Body; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_payloadFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _payloadFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.type_, out unknown)) { + result.hasType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 18: { + result.hasBody = input.ReadBytes(ref result.body_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasType { + get { return result.hasType; } + } + public global::grpc.testing.PayloadType Type { + get { return result.Type; } + set { SetType(value); } + } + public Builder SetType(global::grpc.testing.PayloadType value) { + PrepareBuilder(); + result.hasType = true; + result.type_ = value; + return this; + } + public Builder ClearType() { + PrepareBuilder(); + result.hasType = false; + result.type_ = global::grpc.testing.PayloadType.COMPRESSABLE; + return this; + } + + public bool HasBody { + get { return result.hasBody; } + } + public pb::ByteString Body { + get { return result.Body; } + set { SetBody(value); } + } + public Builder SetBody(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBody = true; + result.body_ = value; + return this; + } + public Builder ClearBody() { + PrepareBuilder(); + result.hasBody = false; + result.body_ = pb::ByteString.Empty; + return this; + } + } + static Payload() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SimpleRequest : pb::GeneratedMessage<SimpleRequest, SimpleRequest.Builder> { + private SimpleRequest() { } + private static readonly SimpleRequest defaultInstance = new SimpleRequest().MakeReadOnly(); + private static readonly string[] _simpleRequestFieldNames = new string[] { "fill_oauth_scope", "fill_username", "payload", "response_size", "response_type" }; + private static readonly uint[] _simpleRequestFieldTags = new uint[] { 40, 32, 26, 16, 8 }; + public static SimpleRequest DefaultInstance { + get { return defaultInstance; } + } + + public override SimpleRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SimpleRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<SimpleRequest, SimpleRequest.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleRequest__FieldAccessorTable; } + } + + public const int ResponseTypeFieldNumber = 1; + private bool hasResponseType; + private global::grpc.testing.PayloadType responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; + public bool HasResponseType { + get { return hasResponseType; } + } + public global::grpc.testing.PayloadType ResponseType { + get { return responseType_; } + } + + public const int ResponseSizeFieldNumber = 2; + private bool hasResponseSize; + private int responseSize_; + public bool HasResponseSize { + get { return hasResponseSize; } + } + public int ResponseSize { + get { return responseSize_; } + } + + public const int PayloadFieldNumber = 3; + private bool hasPayload; + private global::grpc.testing.Payload payload_; + public bool HasPayload { + get { return hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } + } + + public const int FillUsernameFieldNumber = 4; + private bool hasFillUsername; + private bool fillUsername_; + public bool HasFillUsername { + get { return hasFillUsername; } + } + public bool FillUsername { + get { return fillUsername_; } + } + + public const int FillOauthScopeFieldNumber = 5; + private bool hasFillOauthScope; + private bool fillOauthScope_; + public bool HasFillOauthScope { + get { return hasFillOauthScope; } + } + public bool FillOauthScope { + get { return fillOauthScope_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _simpleRequestFieldNames; + if (hasResponseType) { + output.WriteEnum(1, field_names[4], (int) ResponseType, ResponseType); + } + if (hasResponseSize) { + output.WriteInt32(2, field_names[3], ResponseSize); + } + if (hasPayload) { + output.WriteMessage(3, field_names[2], Payload); + } + if (hasFillUsername) { + output.WriteBool(4, field_names[1], FillUsername); + } + if (hasFillOauthScope) { + output.WriteBool(5, field_names[0], FillOauthScope); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasResponseType) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) ResponseType); + } + if (hasResponseSize) { + size += pb::CodedOutputStream.ComputeInt32Size(2, ResponseSize); + } + if (hasPayload) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Payload); + } + if (hasFillUsername) { + size += pb::CodedOutputStream.ComputeBoolSize(4, FillUsername); + } + if (hasFillOauthScope) { + size += pb::CodedOutputStream.ComputeBoolSize(5, FillOauthScope); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static SimpleRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SimpleRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SimpleRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SimpleRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SimpleRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SimpleRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SimpleRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SimpleRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SimpleRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SimpleRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SimpleRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SimpleRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<SimpleRequest, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SimpleRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SimpleRequest result; + + private SimpleRequest PrepareBuilder() { + if (resultIsReadOnly) { + SimpleRequest original = result; + result = new SimpleRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SimpleRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.SimpleRequest.Descriptor; } + } + + public override SimpleRequest DefaultInstanceForType { + get { return global::grpc.testing.SimpleRequest.DefaultInstance; } + } + + public override SimpleRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SimpleRequest) { + return MergeFrom((SimpleRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SimpleRequest other) { + if (other == global::grpc.testing.SimpleRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasResponseType) { + ResponseType = other.ResponseType; + } + if (other.HasResponseSize) { + ResponseSize = other.ResponseSize; + } + if (other.HasPayload) { + MergePayload(other.Payload); + } + if (other.HasFillUsername) { + FillUsername = other.FillUsername; + } + if (other.HasFillOauthScope) { + FillOauthScope = other.FillOauthScope; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_simpleRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _simpleRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.responseType_, out unknown)) { + result.hasResponseType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 16: { + result.hasResponseSize = input.ReadInt32(ref result.responseSize_); + break; + } + case 26: { + global::grpc.testing.Payload.Builder subBuilder = global::grpc.testing.Payload.CreateBuilder(); + if (result.hasPayload) { + subBuilder.MergeFrom(Payload); + } + input.ReadMessage(subBuilder, extensionRegistry); + Payload = subBuilder.BuildPartial(); + break; + } + case 32: { + result.hasFillUsername = input.ReadBool(ref result.fillUsername_); + break; + } + case 40: { + result.hasFillOauthScope = input.ReadBool(ref result.fillOauthScope_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasResponseType { + get { return result.hasResponseType; } + } + public global::grpc.testing.PayloadType ResponseType { + get { return result.ResponseType; } + set { SetResponseType(value); } + } + public Builder SetResponseType(global::grpc.testing.PayloadType value) { + PrepareBuilder(); + result.hasResponseType = true; + result.responseType_ = value; + return this; + } + public Builder ClearResponseType() { + PrepareBuilder(); + result.hasResponseType = false; + result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; + return this; + } + + public bool HasResponseSize { + get { return result.hasResponseSize; } + } + public int ResponseSize { + get { return result.ResponseSize; } + set { SetResponseSize(value); } + } + public Builder SetResponseSize(int value) { + PrepareBuilder(); + result.hasResponseSize = true; + result.responseSize_ = value; + return this; + } + public Builder ClearResponseSize() { + PrepareBuilder(); + result.hasResponseSize = false; + result.responseSize_ = 0; + return this; + } + + public bool HasPayload { + get { return result.hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return result.Payload; } + set { SetPayload(value); } + } + public Builder SetPayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = value; + return this; + } + public Builder SetPayload(global::grpc.testing.Payload.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = builderForValue.Build(); + return this; + } + public Builder MergePayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPayload && + result.payload_ != global::grpc.testing.Payload.DefaultInstance) { + result.payload_ = global::grpc.testing.Payload.CreateBuilder(result.payload_).MergeFrom(value).BuildPartial(); + } else { + result.payload_ = value; + } + result.hasPayload = true; + return this; + } + public Builder ClearPayload() { + PrepareBuilder(); + result.hasPayload = false; + result.payload_ = null; + return this; + } + + public bool HasFillUsername { + get { return result.hasFillUsername; } + } + public bool FillUsername { + get { return result.FillUsername; } + set { SetFillUsername(value); } + } + public Builder SetFillUsername(bool value) { + PrepareBuilder(); + result.hasFillUsername = true; + result.fillUsername_ = value; + return this; + } + public Builder ClearFillUsername() { + PrepareBuilder(); + result.hasFillUsername = false; + result.fillUsername_ = false; + return this; + } + + public bool HasFillOauthScope { + get { return result.hasFillOauthScope; } + } + public bool FillOauthScope { + get { return result.FillOauthScope; } + set { SetFillOauthScope(value); } + } + public Builder SetFillOauthScope(bool value) { + PrepareBuilder(); + result.hasFillOauthScope = true; + result.fillOauthScope_ = value; + return this; + } + public Builder ClearFillOauthScope() { + PrepareBuilder(); + result.hasFillOauthScope = false; + result.fillOauthScope_ = false; + return this; + } + } + static SimpleRequest() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SimpleResponse : pb::GeneratedMessage<SimpleResponse, SimpleResponse.Builder> { + private SimpleResponse() { } + private static readonly SimpleResponse defaultInstance = new SimpleResponse().MakeReadOnly(); + private static readonly string[] _simpleResponseFieldNames = new string[] { "oauth_scope", "payload", "username" }; + private static readonly uint[] _simpleResponseFieldTags = new uint[] { 26, 10, 18 }; + public static SimpleResponse DefaultInstance { + get { return defaultInstance; } + } + + public override SimpleResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SimpleResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<SimpleResponse, SimpleResponse.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleResponse__FieldAccessorTable; } + } + + public const int PayloadFieldNumber = 1; + private bool hasPayload; + private global::grpc.testing.Payload payload_; + public bool HasPayload { + get { return hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } + } + + public const int UsernameFieldNumber = 2; + private bool hasUsername; + private string username_ = ""; + public bool HasUsername { + get { return hasUsername; } + } + public string Username { + get { return username_; } + } + + public const int OauthScopeFieldNumber = 3; + private bool hasOauthScope; + private string oauthScope_ = ""; + public bool HasOauthScope { + get { return hasOauthScope; } + } + public string OauthScope { + get { return oauthScope_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _simpleResponseFieldNames; + if (hasPayload) { + output.WriteMessage(1, field_names[1], Payload); + } + if (hasUsername) { + output.WriteString(2, field_names[2], Username); + } + if (hasOauthScope) { + output.WriteString(3, field_names[0], OauthScope); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPayload) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); + } + if (hasUsername) { + size += pb::CodedOutputStream.ComputeStringSize(2, Username); + } + if (hasOauthScope) { + size += pb::CodedOutputStream.ComputeStringSize(3, OauthScope); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static SimpleResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SimpleResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SimpleResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SimpleResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SimpleResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SimpleResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SimpleResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SimpleResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SimpleResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SimpleResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SimpleResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SimpleResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<SimpleResponse, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SimpleResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SimpleResponse result; + + private SimpleResponse PrepareBuilder() { + if (resultIsReadOnly) { + SimpleResponse original = result; + result = new SimpleResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SimpleResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.SimpleResponse.Descriptor; } + } + + public override SimpleResponse DefaultInstanceForType { + get { return global::grpc.testing.SimpleResponse.DefaultInstance; } + } + + public override SimpleResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SimpleResponse) { + return MergeFrom((SimpleResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SimpleResponse other) { + if (other == global::grpc.testing.SimpleResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPayload) { + MergePayload(other.Payload); + } + if (other.HasUsername) { + Username = other.Username; + } + if (other.HasOauthScope) { + OauthScope = other.OauthScope; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_simpleResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _simpleResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::grpc.testing.Payload.Builder subBuilder = global::grpc.testing.Payload.CreateBuilder(); + if (result.hasPayload) { + subBuilder.MergeFrom(Payload); + } + input.ReadMessage(subBuilder, extensionRegistry); + Payload = subBuilder.BuildPartial(); + break; + } + case 18: { + result.hasUsername = input.ReadString(ref result.username_); + break; + } + case 26: { + result.hasOauthScope = input.ReadString(ref result.oauthScope_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPayload { + get { return result.hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return result.Payload; } + set { SetPayload(value); } + } + public Builder SetPayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = value; + return this; + } + public Builder SetPayload(global::grpc.testing.Payload.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = builderForValue.Build(); + return this; + } + public Builder MergePayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPayload && + result.payload_ != global::grpc.testing.Payload.DefaultInstance) { + result.payload_ = global::grpc.testing.Payload.CreateBuilder(result.payload_).MergeFrom(value).BuildPartial(); + } else { + result.payload_ = value; + } + result.hasPayload = true; + return this; + } + public Builder ClearPayload() { + PrepareBuilder(); + result.hasPayload = false; + result.payload_ = null; + return this; + } + + public bool HasUsername { + get { return result.hasUsername; } + } + public string Username { + get { return result.Username; } + set { SetUsername(value); } + } + public Builder SetUsername(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUsername = true; + result.username_ = value; + return this; + } + public Builder ClearUsername() { + PrepareBuilder(); + result.hasUsername = false; + result.username_ = ""; + return this; + } + + public bool HasOauthScope { + get { return result.hasOauthScope; } + } + public string OauthScope { + get { return result.OauthScope; } + set { SetOauthScope(value); } + } + public Builder SetOauthScope(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOauthScope = true; + result.oauthScope_ = value; + return this; + } + public Builder ClearOauthScope() { + PrepareBuilder(); + result.hasOauthScope = false; + result.oauthScope_ = ""; + return this; + } + } + static SimpleResponse() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class StreamingInputCallRequest : pb::GeneratedMessage<StreamingInputCallRequest, StreamingInputCallRequest.Builder> { + private StreamingInputCallRequest() { } + private static readonly StreamingInputCallRequest defaultInstance = new StreamingInputCallRequest().MakeReadOnly(); + private static readonly string[] _streamingInputCallRequestFieldNames = new string[] { "payload" }; + private static readonly uint[] _streamingInputCallRequestFieldTags = new uint[] { 10 }; + public static StreamingInputCallRequest DefaultInstance { + get { return defaultInstance; } + } + + public override StreamingInputCallRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override StreamingInputCallRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<StreamingInputCallRequest, StreamingInputCallRequest.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable; } + } + + public const int PayloadFieldNumber = 1; + private bool hasPayload; + private global::grpc.testing.Payload payload_; + public bool HasPayload { + get { return hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _streamingInputCallRequestFieldNames; + if (hasPayload) { + output.WriteMessage(1, field_names[0], Payload); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPayload) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static StreamingInputCallRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static StreamingInputCallRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingInputCallRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private StreamingInputCallRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(StreamingInputCallRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<StreamingInputCallRequest, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(StreamingInputCallRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private StreamingInputCallRequest result; + + private StreamingInputCallRequest PrepareBuilder() { + if (resultIsReadOnly) { + StreamingInputCallRequest original = result; + result = new StreamingInputCallRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override StreamingInputCallRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.StreamingInputCallRequest.Descriptor; } + } + + public override StreamingInputCallRequest DefaultInstanceForType { + get { return global::grpc.testing.StreamingInputCallRequest.DefaultInstance; } + } + + public override StreamingInputCallRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is StreamingInputCallRequest) { + return MergeFrom((StreamingInputCallRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(StreamingInputCallRequest other) { + if (other == global::grpc.testing.StreamingInputCallRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPayload) { + MergePayload(other.Payload); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_streamingInputCallRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _streamingInputCallRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::grpc.testing.Payload.Builder subBuilder = global::grpc.testing.Payload.CreateBuilder(); + if (result.hasPayload) { + subBuilder.MergeFrom(Payload); + } + input.ReadMessage(subBuilder, extensionRegistry); + Payload = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPayload { + get { return result.hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return result.Payload; } + set { SetPayload(value); } + } + public Builder SetPayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = value; + return this; + } + public Builder SetPayload(global::grpc.testing.Payload.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = builderForValue.Build(); + return this; + } + public Builder MergePayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPayload && + result.payload_ != global::grpc.testing.Payload.DefaultInstance) { + result.payload_ = global::grpc.testing.Payload.CreateBuilder(result.payload_).MergeFrom(value).BuildPartial(); + } else { + result.payload_ = value; + } + result.hasPayload = true; + return this; + } + public Builder ClearPayload() { + PrepareBuilder(); + result.hasPayload = false; + result.payload_ = null; + return this; + } + } + static StreamingInputCallRequest() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class StreamingInputCallResponse : pb::GeneratedMessage<StreamingInputCallResponse, StreamingInputCallResponse.Builder> { + private StreamingInputCallResponse() { } + private static readonly StreamingInputCallResponse defaultInstance = new StreamingInputCallResponse().MakeReadOnly(); + private static readonly string[] _streamingInputCallResponseFieldNames = new string[] { "aggregated_payload_size" }; + private static readonly uint[] _streamingInputCallResponseFieldTags = new uint[] { 8 }; + public static StreamingInputCallResponse DefaultInstance { + get { return defaultInstance; } + } + + public override StreamingInputCallResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override StreamingInputCallResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<StreamingInputCallResponse, StreamingInputCallResponse.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable; } + } + + public const int AggregatedPayloadSizeFieldNumber = 1; + private bool hasAggregatedPayloadSize; + private int aggregatedPayloadSize_; + public bool HasAggregatedPayloadSize { + get { return hasAggregatedPayloadSize; } + } + public int AggregatedPayloadSize { + get { return aggregatedPayloadSize_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _streamingInputCallResponseFieldNames; + if (hasAggregatedPayloadSize) { + output.WriteInt32(1, field_names[0], AggregatedPayloadSize); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasAggregatedPayloadSize) { + size += pb::CodedOutputStream.ComputeInt32Size(1, AggregatedPayloadSize); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static StreamingInputCallResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static StreamingInputCallResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static StreamingInputCallResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingInputCallResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private StreamingInputCallResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(StreamingInputCallResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<StreamingInputCallResponse, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(StreamingInputCallResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private StreamingInputCallResponse result; + + private StreamingInputCallResponse PrepareBuilder() { + if (resultIsReadOnly) { + StreamingInputCallResponse original = result; + result = new StreamingInputCallResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override StreamingInputCallResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.StreamingInputCallResponse.Descriptor; } + } + + public override StreamingInputCallResponse DefaultInstanceForType { + get { return global::grpc.testing.StreamingInputCallResponse.DefaultInstance; } + } + + public override StreamingInputCallResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is StreamingInputCallResponse) { + return MergeFrom((StreamingInputCallResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(StreamingInputCallResponse other) { + if (other == global::grpc.testing.StreamingInputCallResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasAggregatedPayloadSize) { + AggregatedPayloadSize = other.AggregatedPayloadSize; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_streamingInputCallResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _streamingInputCallResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasAggregatedPayloadSize = input.ReadInt32(ref result.aggregatedPayloadSize_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasAggregatedPayloadSize { + get { return result.hasAggregatedPayloadSize; } + } + public int AggregatedPayloadSize { + get { return result.AggregatedPayloadSize; } + set { SetAggregatedPayloadSize(value); } + } + public Builder SetAggregatedPayloadSize(int value) { + PrepareBuilder(); + result.hasAggregatedPayloadSize = true; + result.aggregatedPayloadSize_ = value; + return this; + } + public Builder ClearAggregatedPayloadSize() { + PrepareBuilder(); + result.hasAggregatedPayloadSize = false; + result.aggregatedPayloadSize_ = 0; + return this; + } + } + static StreamingInputCallResponse() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ResponseParameters : pb::GeneratedMessage<ResponseParameters, ResponseParameters.Builder> { + private ResponseParameters() { } + private static readonly ResponseParameters defaultInstance = new ResponseParameters().MakeReadOnly(); + private static readonly string[] _responseParametersFieldNames = new string[] { "interval_us", "size" }; + private static readonly uint[] _responseParametersFieldTags = new uint[] { 16, 8 }; + public static ResponseParameters DefaultInstance { + get { return defaultInstance; } + } + + public override ResponseParameters DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ResponseParameters ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_ResponseParameters__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<ResponseParameters, ResponseParameters.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_ResponseParameters__FieldAccessorTable; } + } + + public const int SizeFieldNumber = 1; + private bool hasSize; + private int size_; + public bool HasSize { + get { return hasSize; } + } + public int Size { + get { return size_; } + } + + public const int IntervalUsFieldNumber = 2; + private bool hasIntervalUs; + private int intervalUs_; + public bool HasIntervalUs { + get { return hasIntervalUs; } + } + public int IntervalUs { + get { return intervalUs_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _responseParametersFieldNames; + if (hasSize) { + output.WriteInt32(1, field_names[1], Size); + } + if (hasIntervalUs) { + output.WriteInt32(2, field_names[0], IntervalUs); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSize) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Size); + } + if (hasIntervalUs) { + size += pb::CodedOutputStream.ComputeInt32Size(2, IntervalUs); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static ResponseParameters ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResponseParameters ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResponseParameters ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResponseParameters ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResponseParameters ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResponseParameters ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ResponseParameters ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ResponseParameters ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ResponseParameters ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResponseParameters ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ResponseParameters MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ResponseParameters prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<ResponseParameters, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ResponseParameters cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ResponseParameters result; + + private ResponseParameters PrepareBuilder() { + if (resultIsReadOnly) { + ResponseParameters original = result; + result = new ResponseParameters(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ResponseParameters MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.ResponseParameters.Descriptor; } + } + + public override ResponseParameters DefaultInstanceForType { + get { return global::grpc.testing.ResponseParameters.DefaultInstance; } + } + + public override ResponseParameters BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ResponseParameters) { + return MergeFrom((ResponseParameters) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ResponseParameters other) { + if (other == global::grpc.testing.ResponseParameters.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasSize) { + Size = other.Size; + } + if (other.HasIntervalUs) { + IntervalUs = other.IntervalUs; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_responseParametersFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _responseParametersFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasSize = input.ReadInt32(ref result.size_); + break; + } + case 16: { + result.hasIntervalUs = input.ReadInt32(ref result.intervalUs_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasSize { + get { return result.hasSize; } + } + public int Size { + get { return result.Size; } + set { SetSize(value); } + } + public Builder SetSize(int value) { + PrepareBuilder(); + result.hasSize = true; + result.size_ = value; + return this; + } + public Builder ClearSize() { + PrepareBuilder(); + result.hasSize = false; + result.size_ = 0; + return this; + } + + public bool HasIntervalUs { + get { return result.hasIntervalUs; } + } + public int IntervalUs { + get { return result.IntervalUs; } + set { SetIntervalUs(value); } + } + public Builder SetIntervalUs(int value) { + PrepareBuilder(); + result.hasIntervalUs = true; + result.intervalUs_ = value; + return this; + } + public Builder ClearIntervalUs() { + PrepareBuilder(); + result.hasIntervalUs = false; + result.intervalUs_ = 0; + return this; + } + } + static ResponseParameters() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class StreamingOutputCallRequest : pb::GeneratedMessage<StreamingOutputCallRequest, StreamingOutputCallRequest.Builder> { + private StreamingOutputCallRequest() { } + private static readonly StreamingOutputCallRequest defaultInstance = new StreamingOutputCallRequest().MakeReadOnly(); + private static readonly string[] _streamingOutputCallRequestFieldNames = new string[] { "payload", "response_parameters", "response_type" }; + private static readonly uint[] _streamingOutputCallRequestFieldTags = new uint[] { 26, 18, 8 }; + public static StreamingOutputCallRequest DefaultInstance { + get { return defaultInstance; } + } + + public override StreamingOutputCallRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override StreamingOutputCallRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<StreamingOutputCallRequest, StreamingOutputCallRequest.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable; } + } + + public const int ResponseTypeFieldNumber = 1; + private bool hasResponseType; + private global::grpc.testing.PayloadType responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; + public bool HasResponseType { + get { return hasResponseType; } + } + public global::grpc.testing.PayloadType ResponseType { + get { return responseType_; } + } + + public const int ResponseParametersFieldNumber = 2; + private pbc::PopsicleList<global::grpc.testing.ResponseParameters> responseParameters_ = new pbc::PopsicleList<global::grpc.testing.ResponseParameters>(); + public scg::IList<global::grpc.testing.ResponseParameters> ResponseParametersList { + get { return responseParameters_; } + } + public int ResponseParametersCount { + get { return responseParameters_.Count; } + } + public global::grpc.testing.ResponseParameters GetResponseParameters(int index) { + return responseParameters_[index]; + } + + public const int PayloadFieldNumber = 3; + private bool hasPayload; + private global::grpc.testing.Payload payload_; + public bool HasPayload { + get { return hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _streamingOutputCallRequestFieldNames; + if (hasResponseType) { + output.WriteEnum(1, field_names[2], (int) ResponseType, ResponseType); + } + if (responseParameters_.Count > 0) { + output.WriteMessageArray(2, field_names[1], responseParameters_); + } + if (hasPayload) { + output.WriteMessage(3, field_names[0], Payload); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasResponseType) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) ResponseType); + } + foreach (global::grpc.testing.ResponseParameters element in ResponseParametersList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasPayload) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Payload); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static StreamingOutputCallRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static StreamingOutputCallRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingOutputCallRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private StreamingOutputCallRequest MakeReadOnly() { + responseParameters_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(StreamingOutputCallRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<StreamingOutputCallRequest, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(StreamingOutputCallRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private StreamingOutputCallRequest result; + + private StreamingOutputCallRequest PrepareBuilder() { + if (resultIsReadOnly) { + StreamingOutputCallRequest original = result; + result = new StreamingOutputCallRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override StreamingOutputCallRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.StreamingOutputCallRequest.Descriptor; } + } + + public override StreamingOutputCallRequest DefaultInstanceForType { + get { return global::grpc.testing.StreamingOutputCallRequest.DefaultInstance; } + } + + public override StreamingOutputCallRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is StreamingOutputCallRequest) { + return MergeFrom((StreamingOutputCallRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(StreamingOutputCallRequest other) { + if (other == global::grpc.testing.StreamingOutputCallRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasResponseType) { + ResponseType = other.ResponseType; + } + if (other.responseParameters_.Count != 0) { + result.responseParameters_.Add(other.responseParameters_); + } + if (other.HasPayload) { + MergePayload(other.Payload); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_streamingOutputCallRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _streamingOutputCallRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.responseType_, out unknown)) { + result.hasResponseType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.responseParameters_, global::grpc.testing.ResponseParameters.DefaultInstance, extensionRegistry); + break; + } + case 26: { + global::grpc.testing.Payload.Builder subBuilder = global::grpc.testing.Payload.CreateBuilder(); + if (result.hasPayload) { + subBuilder.MergeFrom(Payload); + } + input.ReadMessage(subBuilder, extensionRegistry); + Payload = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasResponseType { + get { return result.hasResponseType; } + } + public global::grpc.testing.PayloadType ResponseType { + get { return result.ResponseType; } + set { SetResponseType(value); } + } + public Builder SetResponseType(global::grpc.testing.PayloadType value) { + PrepareBuilder(); + result.hasResponseType = true; + result.responseType_ = value; + return this; + } + public Builder ClearResponseType() { + PrepareBuilder(); + result.hasResponseType = false; + result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; + return this; + } + + public pbc::IPopsicleList<global::grpc.testing.ResponseParameters> ResponseParametersList { + get { return PrepareBuilder().responseParameters_; } + } + public int ResponseParametersCount { + get { return result.ResponseParametersCount; } + } + public global::grpc.testing.ResponseParameters GetResponseParameters(int index) { + return result.GetResponseParameters(index); + } + public Builder SetResponseParameters(int index, global::grpc.testing.ResponseParameters value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.responseParameters_[index] = value; + return this; + } + public Builder SetResponseParameters(int index, global::grpc.testing.ResponseParameters.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.responseParameters_[index] = builderForValue.Build(); + return this; + } + public Builder AddResponseParameters(global::grpc.testing.ResponseParameters value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.responseParameters_.Add(value); + return this; + } + public Builder AddResponseParameters(global::grpc.testing.ResponseParameters.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.responseParameters_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeResponseParameters(scg::IEnumerable<global::grpc.testing.ResponseParameters> values) { + PrepareBuilder(); + result.responseParameters_.Add(values); + return this; + } + public Builder ClearResponseParameters() { + PrepareBuilder(); + result.responseParameters_.Clear(); + return this; + } + + public bool HasPayload { + get { return result.hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return result.Payload; } + set { SetPayload(value); } + } + public Builder SetPayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = value; + return this; + } + public Builder SetPayload(global::grpc.testing.Payload.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = builderForValue.Build(); + return this; + } + public Builder MergePayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPayload && + result.payload_ != global::grpc.testing.Payload.DefaultInstance) { + result.payload_ = global::grpc.testing.Payload.CreateBuilder(result.payload_).MergeFrom(value).BuildPartial(); + } else { + result.payload_ = value; + } + result.hasPayload = true; + return this; + } + public Builder ClearPayload() { + PrepareBuilder(); + result.hasPayload = false; + result.payload_ = null; + return this; + } + } + static StreamingOutputCallRequest() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class StreamingOutputCallResponse : pb::GeneratedMessage<StreamingOutputCallResponse, StreamingOutputCallResponse.Builder> { + private StreamingOutputCallResponse() { } + private static readonly StreamingOutputCallResponse defaultInstance = new StreamingOutputCallResponse().MakeReadOnly(); + private static readonly string[] _streamingOutputCallResponseFieldNames = new string[] { "payload" }; + private static readonly uint[] _streamingOutputCallResponseFieldTags = new uint[] { 10 }; + public static StreamingOutputCallResponse DefaultInstance { + get { return defaultInstance; } + } + + public override StreamingOutputCallResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override StreamingOutputCallResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable<StreamingOutputCallResponse, StreamingOutputCallResponse.Builder> InternalFieldAccessors { + get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable; } + } + + public const int PayloadFieldNumber = 1; + private bool hasPayload; + private global::grpc.testing.Payload payload_; + public bool HasPayload { + get { return hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _streamingOutputCallResponseFieldNames; + if (hasPayload) { + output.WriteMessage(1, field_names[0], Payload); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPayload) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static StreamingOutputCallResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static StreamingOutputCallResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static StreamingOutputCallResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private StreamingOutputCallResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(StreamingOutputCallResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder<StreamingOutputCallResponse, Builder> { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(StreamingOutputCallResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private StreamingOutputCallResponse result; + + private StreamingOutputCallResponse PrepareBuilder() { + if (resultIsReadOnly) { + StreamingOutputCallResponse original = result; + result = new StreamingOutputCallResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override StreamingOutputCallResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::grpc.testing.StreamingOutputCallResponse.Descriptor; } + } + + public override StreamingOutputCallResponse DefaultInstanceForType { + get { return global::grpc.testing.StreamingOutputCallResponse.DefaultInstance; } + } + + public override StreamingOutputCallResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is StreamingOutputCallResponse) { + return MergeFrom((StreamingOutputCallResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(StreamingOutputCallResponse other) { + if (other == global::grpc.testing.StreamingOutputCallResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPayload) { + MergePayload(other.Payload); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_streamingOutputCallResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _streamingOutputCallResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::grpc.testing.Payload.Builder subBuilder = global::grpc.testing.Payload.CreateBuilder(); + if (result.hasPayload) { + subBuilder.MergeFrom(Payload); + } + input.ReadMessage(subBuilder, extensionRegistry); + Payload = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPayload { + get { return result.hasPayload; } + } + public global::grpc.testing.Payload Payload { + get { return result.Payload; } + set { SetPayload(value); } + } + public Builder SetPayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = value; + return this; + } + public Builder SetPayload(global::grpc.testing.Payload.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPayload = true; + result.payload_ = builderForValue.Build(); + return this; + } + public Builder MergePayload(global::grpc.testing.Payload value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPayload && + result.payload_ != global::grpc.testing.Payload.DefaultInstance) { + result.payload_ = global::grpc.testing.Payload.CreateBuilder(result.payload_).MergeFrom(value).BuildPartial(); + } else { + result.payload_ = value; + } + result.hasPayload = true; + return this; + } + public Builder ClearPayload() { + PrepareBuilder(); + result.hasPayload = false; + result.payload_ = null; + return this; + } + } + static StreamingOutputCallResponse() { + object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); + } + } + + #endregion + +} +#endregion Designer generated code diff --git a/src/csharp/GrpcApi/TestServiceGrpc.cs b/src/csharp/GrpcApi/TestServiceGrpc.cs new file mode 100644 index 0000000000..e836d60492 --- /dev/null +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -0,0 +1,170 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Reactive.Linq; +using Google.GRPC.Core; + +namespace grpc.testing +{ + /// <summary> + /// TestService (this is handwritten version of code that will normally be generated). + /// </summary> + public class TestServiceGrpc + { + readonly static Marshaller<Empty> emptyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Empty.ParseFrom); + readonly static Marshaller<SimpleRequest> simpleRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleRequest.ParseFrom); + readonly static Marshaller<SimpleResponse> simpleResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleResponse.ParseFrom); + readonly static Marshaller<StreamingOutputCallRequest> streamingOutputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallRequest.ParseFrom); + readonly static Marshaller<StreamingOutputCallResponse> streamingOutputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallResponse.ParseFrom); + readonly static Marshaller<StreamingInputCallRequest> streamingInputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallRequest.ParseFrom); + readonly static Marshaller<StreamingInputCallResponse> streamingInputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallResponse.ParseFrom); + + readonly static Method<Empty, Empty> emptyCallMethod = new Method<Empty, Empty>( + MethodType.Unary, + "/grpc.testing.TestService/EmptyCall", + emptyMarshaller, + emptyMarshaller + ); + readonly static Method<SimpleRequest, SimpleResponse> unaryCallMethod = new Method<SimpleRequest, SimpleResponse>( + MethodType.Unary, + "/grpc.testing.TestService/UnaryCall", + simpleRequestMarshaller, + simpleResponseMarshaller + ); + readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> streamingOutputCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( + MethodType.ServerStreaming, + "/grpc.testing.TestService/StreamingOutputCall", + streamingOutputCallRequestMarshaller, + streamingOutputCallResponseMarshaller + ); + readonly static Method<StreamingInputCallRequest, StreamingInputCallResponse> streamingInputCallMethod = new Method<StreamingInputCallRequest, StreamingInputCallResponse>( + MethodType.ClientStreaming, + "/grpc.testing.TestService/StreamingInputCall", + streamingInputCallRequestMarshaller, + streamingInputCallResponseMarshaller + ); + readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> fullDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( + MethodType.DuplexStreaming, + "/grpc.testing.TestService/FullDuplexCall", + streamingOutputCallRequestMarshaller, + streamingOutputCallResponseMarshaller + ); + readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> halfDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( + MethodType.DuplexStreaming, + "/grpc.testing.TestService/HalfDuplexCall", + streamingOutputCallRequestMarshaller, + streamingOutputCallResponseMarshaller + ); + + public interface ITestServiceClient + { + Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken)); + + Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken)); + + SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken)); + + Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)); + + Task StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)); + + ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken)); + + IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)); + + IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)); + } + + public class TestServiceClientStub : ITestServiceClient + { + readonly Channel channel; + + public TestServiceClientStub(Channel channel) + { + this.channel = channel; + } + + public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<Empty, Empty>(emptyCallMethod, channel); + return Calls.BlockingUnaryCall(call, request, token); + } + + public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<Empty, Empty>(emptyCallMethod, channel); + return Calls.AsyncUnaryCall(call, request, token); + } + + public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); + return Calls.BlockingUnaryCall(call, request, token); + } + + public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); + return Calls.AsyncUnaryCall(call, request, token); + } + + public Task StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) { + var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(streamingOutputCallMethod, channel); + return Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + } + + public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(streamingInputCallMethod, channel); + return Calls.AsyncClientStreamingCall(call, token); + } + + public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(fullDuplexCallMethod, channel); + return Calls.DuplexStreamingCall(call, responseObserver, token); + } + + + public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) + { + var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(halfDuplexCallMethod, channel); + return Calls.DuplexStreamingCall(call, responseObserver, token); + } + } + + // server-side interface + public interface ITestService + { + void EmptyCall(Empty request, IObserver<Empty> responseObserver); + + void UnaryCall(SimpleRequest request, IObserver<SimpleResponse> responseObserver); + + void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver); + + IObserver<StreamingInputCallRequest> StreamingInputCall(IObserver<StreamingInputCallResponse> responseObserver); + + IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver); + + IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver); + } + + public static ServerServiceDefinition BindService(ITestService serviceImpl) + { + return ServerServiceDefinition.CreateBuilder("/grpc.testing.TestService/") + .AddMethod(emptyCallMethod, serviceImpl.EmptyCall) + .AddMethod(unaryCallMethod, serviceImpl.UnaryCall) + .AddMethod(streamingOutputCallMethod, serviceImpl.StreamingOutputCall) + .AddMethod(streamingInputCallMethod, serviceImpl.StreamingInputCall) + .AddMethod(fullDuplexCallMethod, serviceImpl.FullDuplexCall) + .AddMethod(halfDuplexCallMethod, serviceImpl.HalfDuplexCall) + .Build(); + } + + public static ITestServiceClient NewStub(Channel channel) + { + return new TestServiceClientStub(channel); + } + } +}
\ No newline at end of file diff --git a/src/csharp/GrpcApi/proto/empty.proto b/src/csharp/GrpcApi/proto/empty.proto new file mode 100644 index 0000000000..c88b5318cd --- /dev/null +++ b/src/csharp/GrpcApi/proto/empty.proto @@ -0,0 +1,13 @@ +syntax = "proto2"; + +package grpc.testing; + +// An empty message that you can re-use to avoid defining duplicated empty +// messages in your project. A typical example is to use it as argument or the +// return value of a service API. For instance: +// +// service Foo { +// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; +// }; +// +message Empty {} diff --git a/src/csharp/GrpcApi/math.proto b/src/csharp/GrpcApi/proto/math.proto index e98b99e002..e98b99e002 100755..100644 --- a/src/csharp/GrpcApi/math.proto +++ b/src/csharp/GrpcApi/proto/math.proto diff --git a/src/csharp/GrpcApi/proto/messages.proto b/src/csharp/GrpcApi/proto/messages.proto new file mode 100644 index 0000000000..1d95154cf4 --- /dev/null +++ b/src/csharp/GrpcApi/proto/messages.proto @@ -0,0 +1,102 @@ +// Message definitions to be used by integration test service definitions. + +syntax = "proto2"; + +package grpc.testing; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + optional PayloadType type = 1; + // Primary contents of payload. + optional bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + optional PayloadType response_type = 1; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 response_size = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; + + // Whether SimpleResponse should include username. + optional bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + optional bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + optional Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + optional string username = 2; + // OAuth scope. + optional string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + optional Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + optional int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + optional int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + optional PayloadType response_type = 1; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + optional Payload payload = 1; +} diff --git a/src/csharp/GrpcApi/proto/test.proto b/src/csharp/GrpcApi/proto/test.proto new file mode 100644 index 0000000000..8380ebb31d --- /dev/null +++ b/src/csharp/GrpcApi/proto/test.proto @@ -0,0 +1,42 @@ +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto2"; + +import "empty.proto"; +import "messages.proto"; + +package grpc.testing; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); + + // One request followed by one response. + // The server returns the client payload as-is. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // 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. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // 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. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); +} diff --git a/src/csharp/GrpcCore/GrpcCore.csproj b/src/csharp/GrpcCore/GrpcCore.csproj index fbfe50e4d8..95df890917 100644 --- a/src/csharp/GrpcCore/GrpcCore.csproj +++ b/src/csharp/GrpcCore/GrpcCore.csproj @@ -62,6 +62,7 @@ <Compile Include="ServerServiceDefinition.cs" /> <Compile Include="Utils\RecordingObserver.cs" /> <Compile Include="Utils\PortPicker.cs" /> + <Compile Include="Utils\RecordingQueue.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> diff --git a/src/csharp/GrpcCore/Utils/RecordingQueue.cs b/src/csharp/GrpcCore/Utils/RecordingQueue.cs new file mode 100644 index 0000000000..0726f00af7 --- /dev/null +++ b/src/csharp/GrpcCore/Utils/RecordingQueue.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Collections.Concurrent; + +namespace Google.GRPC.Core.Utils +{ + /// <summary> + /// Observer that allows us to await incoming messages one-by-one. + /// The implementation is not ideal and class will be probably replaced + /// by something more versatile in the future. + /// </summary> + public class RecordingQueue<T> : IObserver<T> + { + readonly BlockingCollection<T> queue = new BlockingCollection<T>(); + TaskCompletionSource<object> tcs = new TaskCompletionSource<object>(); + + public void OnCompleted() + { + tcs.SetResult(null); + } + + public void OnError(Exception error) + { + tcs.SetException(error); + } + + public void OnNext(T value) + { + queue.Add(value); + } + + public BlockingCollection<T> Queue + { + get + { + return queue; + } + } + + public Task Finished + { + get + { + return tcs.Task; + } + } + } +} + diff --git a/src/csharp/GrpcDemo/.gitignore b/src/csharp/InteropClient/.gitignore index ba077a4031..ba077a4031 100644 --- a/src/csharp/GrpcDemo/.gitignore +++ b/src/csharp/InteropClient/.gitignore diff --git a/src/csharp/InteropClient/Client.cs b/src/csharp/InteropClient/Client.cs new file mode 100644 index 0000000000..9f5815050e --- /dev/null +++ b/src/csharp/InteropClient/Client.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using System.Text.RegularExpressions; +using Google.GRPC.Core; +using Google.GRPC.Core.Utils; +using Google.ProtocolBuffers; +using grpc.testing; + +namespace Google.GRPC.Interop +{ + class Client + { + private class ClientOptions + { + public bool help; + public string serverHost; + public string serverHostOverride; + public int? serverPort; + public string testCase; + public bool useTls; + public bool useTestCa; + } + + ClientOptions options; + + private Client(ClientOptions options) + { + this.options = options; + } + + public static void Main(string[] args) + { + Console.WriteLine("gRPC C# interop testing client"); + ClientOptions options = ParseArguments(args); + + if (options.serverHost == null || !options.serverPort.HasValue || options.testCase == null) + { + Console.WriteLine("Missing required argument."); + Console.WriteLine(); + options.help = true; + } + + if (options.help) + { + Console.WriteLine("Usage:"); + Console.WriteLine(" --server_host=HOSTNAME"); + Console.WriteLine(" --server_host_override=HOSTNAME"); + Console.WriteLine(" --server_port=PORT"); + Console.WriteLine(" --test_case=TESTCASE"); + Console.WriteLine(" --use_tls=BOOLEAN"); + Console.WriteLine(" --use_test_ca=BOOLEAN"); + Console.WriteLine(); + Environment.Exit(1); + } + + var interopClient = new Client(options); + interopClient.Run(); + } + + private void Run() + { + string addr = string.Format("{0}:{1}", options.serverHost, options.serverPort); + using (Channel channel = new Channel(addr)) + { + TestServiceGrpc.ITestServiceClient client = new TestServiceGrpc.TestServiceClientStub(channel); + + RunTestCase(options.testCase, client); + } + + GrpcEnvironment.Shutdown(); + } + + private void RunTestCase(string testCase, TestServiceGrpc.ITestServiceClient client) + { + switch (testCase) + { + case "empty_unary": + RunEmptyUnary(client); + break; + case "large_unary": + RunLargeUnary(client); + break; + case "client_streaming": + RunClientStreaming(client); + break; + case "server_streaming": + RunServerStreaming(client); + break; + case "ping_pong": + RunPingPong(client); + break; + case "empty_stream": + RunEmptyStream(client); + break; + default: + throw new ArgumentException("Unknown test case " + testCase); + } + } + + private void RunEmptyUnary(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running empty_unary"); + var response = client.EmptyCall(Empty.DefaultInstance); + Assert.IsNotNull(response); + Console.WriteLine("Passed!"); + } + + private void RunLargeUnary(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running large_unary"); + var request = SimpleRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .SetResponseSize(314159) + .SetPayload(CreateZerosPayload(271828)) + .Build(); + + var response = client.UnaryCall(request); + + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(314159, response.Payload.Body.Length); + Console.WriteLine("Passed!"); + } + + private void RunClientStreaming(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running client_streaming"); + + var bodySizes = new List<int>{27182, 8, 1828, 45904}; + + var context = client.StreamingInputCall(); + foreach (var size in bodySizes) + { + context.Inputs.OnNext( + StreamingInputCallRequest.CreateBuilder().SetPayload(CreateZerosPayload(size)).Build()); + } + context.Inputs.OnCompleted(); + + var response = context.Task.Result; + Assert.AreEqual(74922, response.AggregatedPayloadSize); + Console.WriteLine("Passed!"); + } + + private void RunServerStreaming(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running server_streaming"); + + var bodySizes = new List<int>{31415, 9, 2653, 58979}; + + var request = StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddRangeResponseParameters(bodySizes.ConvertAll( + (size) => ResponseParameters.CreateBuilder().SetSize(size).Build())) + .Build(); + + var recorder = new RecordingObserver<StreamingOutputCallResponse>(); + client.StreamingOutputCall(request, recorder); + + var responseList = recorder.ToList().Result; + + foreach (var res in responseList) + { + Assert.AreEqual(PayloadType.COMPRESSABLE, res.Payload.Type); + } + CollectionAssert.AreEqual(bodySizes, responseList.ConvertAll((item) => item.Payload.Body.Length)); + Console.WriteLine("Passed!"); + } + + private void RunPingPong(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running ping_pong"); + + var recorder = new RecordingQueue<StreamingOutputCallResponse>(); + var inputs = client.FullDuplexCall(recorder); + + StreamingOutputCallResponse response; + + inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415)) + .SetPayload(CreateZerosPayload(27182)).Build()); + + response = recorder.Queue.Take(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(31415, response.Payload.Body.Length); + + inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(9)) + .SetPayload(CreateZerosPayload(8)).Build()); + + response = recorder.Queue.Take(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(9, response.Payload.Body.Length); + + inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(2635)) + .SetPayload(CreateZerosPayload(1828)).Build()); + + response = recorder.Queue.Take(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(2653, response.Payload.Body.Length); + + + inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(58979)) + .SetPayload(CreateZerosPayload(45904)).Build()); + + response = recorder.Queue.Take(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(58979, response.Payload.Body.Length); + + recorder.Finished.Wait(); + Assert.AreEqual(0, recorder.Queue.Count); + + Console.WriteLine("Passed!"); + } + + private void RunEmptyStream(TestServiceGrpc.ITestServiceClient client) + { + Console.WriteLine("running empty_stream"); + + var recorder = new RecordingObserver<StreamingOutputCallResponse>(); + var inputs = client.FullDuplexCall(recorder); + inputs.OnCompleted(); + + var responseList = recorder.ToList().Result; + Assert.AreEqual(0, responseList.Count); + + Console.WriteLine("Passed!"); + } + + + private Payload CreateZerosPayload(int size) { + return Payload.CreateBuilder().SetBody(ByteString.CopyFrom(new byte[size])).Build(); + } + + private static ClientOptions ParseArguments(string[] args) + { + var options = new ClientOptions(); + foreach(string arg in args) + { + ParseArgument(arg, options); + if (options.help) + { + break; + } + } + return options; + } + + private static void ParseArgument(string arg, ClientOptions options) + { + Match match; + match = Regex.Match(arg, "--server_host=(.*)"); + if (match.Success) + { + options.serverHost = match.Groups[1].Value.Trim(); + return; + } + + match = Regex.Match(arg, "--server_host_override=(.*)"); + if (match.Success) + { + options.serverHostOverride = match.Groups[1].Value.Trim(); + return; + } + + match = Regex.Match(arg, "--server_port=(.*)"); + if (match.Success) + { + options.serverPort = int.Parse(match.Groups[1].Value.Trim()); + return; + } + + match = Regex.Match(arg, "--test_case=(.*)"); + if (match.Success) + { + options.testCase = match.Groups[1].Value.Trim(); + return; + } + + match = Regex.Match(arg, "--use_tls=(.*)"); + if (match.Success) + { + options.useTls = bool.Parse(match.Groups[1].Value.Trim()); + return; + } + + match = Regex.Match(arg, "--use_test_ca=(.*)"); + if (match.Success) + { + options.useTestCa = bool.Parse(match.Groups[1].Value.Trim()); + return; + } + + Console.WriteLine(string.Format("Unrecognized argument \"{0}\"", arg)); + options.help = true; + } + } +} diff --git a/src/csharp/InteropClient/InteropClient.csproj b/src/csharp/InteropClient/InteropClient.csproj new file mode 100644 index 0000000000..b8e099d785 --- /dev/null +++ b/src/csharp/InteropClient/InteropClient.csproj @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>10.0.0</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{C61154BA-DD4A-4838-8420-0162A28925E0}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>InteropClient</RootNamespace> + <AssemblyName>InteropClient</AssemblyName> + <StartupObject>Google.GRPC.Interop.Client</StartupObject> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Externalconsole>true</Externalconsole> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Externalconsole>true</Externalconsole> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="nunit.framework, Version=2.6.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"> + <Private>False</Private> + </Reference> + <Reference Include="Google.ProtocolBuffers"> + <HintPath>..\lib\Google.ProtocolBuffers.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Client.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <ProjectReference Include="..\GrpcCore\GrpcCore.csproj"> + <Project>{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}</Project> + <Name>GrpcCore</Name> + </ProjectReference> + <ProjectReference Include="..\GrpcApi\GrpcApi.csproj"> + <Project>{7DC1433E-3225-42C7-B7EA-546D56E27A4B}</Project> + <Name>GrpcApi</Name> + </ProjectReference> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/csharp/InteropClient/Properties/AssemblyInfo.cs b/src/csharp/InteropClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1f3cc19a9d --- /dev/null +++ b/src/csharp/InteropClient/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle("InteropClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("jtattermusch")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. +[assembly: AssemblyVersion("1.0.*")] +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/src/csharp/MathClient/.gitignore b/src/csharp/MathClient/.gitignore new file mode 100644 index 0000000000..ba077a4031 --- /dev/null +++ b/src/csharp/MathClient/.gitignore @@ -0,0 +1 @@ +bin diff --git a/src/csharp/GrpcDemo/Program.cs b/src/csharp/MathClient/MathClient.cs index c442c32193..45222abb79 100644 --- a/src/csharp/GrpcDemo/Program.cs +++ b/src/csharp/MathClient/MathClient.cs @@ -2,25 +2,23 @@ using System; using System.Runtime.InteropServices; using Google.GRPC.Core; using System.Threading; -using math; -namespace Google.GRPC.Demo +namespace math { - class MainClass + class MathClient { public static void Main (string[] args) { using (Channel channel = new Channel("127.0.0.1:23456")) { - MathGrpc.IMathServiceClient stub = new MathGrpc.MathServiceClientStub(channel); - Examples.DivExample(stub); + MathExamples.DivExample(stub); - Examples.FibExample(stub); + MathExamples.FibExample(stub); - Examples.SumExample(stub); + MathExamples.SumExample(stub); - Examples.DivManyExample(stub); + MathExamples.DivManyExample(stub); } GrpcEnvironment.Shutdown(); diff --git a/src/csharp/GrpcDemo/GrpcDemo.csproj b/src/csharp/MathClient/MathClient.csproj index 31ce7f133b..74213653d2 100644 --- a/src/csharp/GrpcDemo/GrpcDemo.csproj +++ b/src/csharp/MathClient/MathClient.csproj @@ -35,8 +35,8 @@ <Reference Include="System" /> </ItemGroup> <ItemGroup> - <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="MathClient.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> diff --git a/src/csharp/GrpcDemo/Properties/AssemblyInfo.cs b/src/csharp/MathClient/Properties/AssemblyInfo.cs index b8e1406da7..f521cd63f0 100644 --- a/src/csharp/GrpcDemo/Properties/AssemblyInfo.cs +++ b/src/csharp/MathClient/Properties/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. -[assembly: AssemblyTitle ("GrpcDemo")] +[assembly: AssemblyTitle ("MathClient")] [assembly: AssemblyDescription ("")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] diff --git a/src/csharp/README.md b/src/csharp/README.md index c2f988cc5e..0df6925b39 100755 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -47,8 +47,11 @@ CONTENTS - ext: The extension library that wraps C API to be more digestible by C#. +- GrpcApi: + API examples for math.proto and testservice.proto - GrpcCore: The main gRPC C# library. -- GrpcApi: - API examples for math.proto. - +- InteropClient: + Client for interop testing. +- MathClient: + An example client that sends some requests to math server. diff --git a/src/node/examples/math_server.js b/src/node/examples/math_server.js index e65cfe3002..e1bd11b5a6 100644 --- a/src/node/examples/math_server.js +++ b/src/node/examples/math_server.js @@ -128,7 +128,8 @@ var server = new Server({ }); if (require.main === module) { - server.bind('localhost:7070').listen(); + server.bind('0.0.0.0:7070'); + server.listen(); } /** diff --git a/src/node/examples/stock.proto b/src/node/examples/stock.proto index efe98d84ff..2bc5c29d17 100644 --- a/src/node/examples/stock.proto +++ b/src/node/examples/stock.proto @@ -35,28 +35,28 @@ package examples; message StockRequest { optional string symbol = 1; optional int32 num_trades_to_watch = 2 [default=0]; -}; +} message StockReply { optional float price = 1; optional string symbol = 2; -}; +} // Interface exported by the server service Stock { // Simple blocking RPC rpc GetLastTradePrice(StockRequest) returns (StockReply) { - }; + } // Bidirectional streaming RPC rpc GetLastTradePriceMultiple(stream StockRequest) returns (stream StockReply) { - }; + } // Unidirectional server-to-client streaming RPC rpc WatchFutureTrades(StockRequest) returns (stream StockReply) { - }; + } // Unidirectional client-to-server streaming RPC rpc GetHighestTradePrice(stream StockRequest) returns (StockReply) { - }; + } -};
\ No newline at end of file +}
\ No newline at end of file diff --git a/src/node/examples/stock_client.js b/src/node/examples/stock_client.js index 8e99090f35..b37e66df07 100644 --- a/src/node/examples/stock_client.js +++ b/src/node/examples/stock_client.js @@ -39,5 +39,8 @@ var examples = grpc.load(__dirname + '/stock.proto').examples; * * var StockClient = require('stock_client.js'); * var stockClient = new StockClient(server_address); + * stockClient.getLastTradePrice({symbol: 'GOOG'}, function(error, response) { + * console.log(error || response); + * }); */ module.exports = examples.Stock; diff --git a/src/node/examples/stock_server.js b/src/node/examples/stock_server.js index c188181b77..b226a71573 100644 --- a/src/node/examples/stock_server.js +++ b/src/node/examples/stock_server.js @@ -35,10 +35,10 @@ var _ = require('underscore'); var grpc = require('..'); var examples = grpc.load(__dirname + '/stock.proto').examples; -var StockServer = grpc.makeServerConstructor([examples.Stock.service]); +var StockServer = grpc.buildServer([examples.Stock.service]); function getLastTradePrice(call, callback) { - callback(null, {price: 88}); + callback(null, {symbol: call.request.symbol, price: 88}); } function watchFutureTrades(call) { @@ -80,4 +80,9 @@ var stockServer = new StockServer({ } }); -exports.module = stockServer; +if (require.main === module) { + stockServer.bind('0.0.0.0:8080'); + stockServer.listen(); +} + +module.exports = stockServer; diff --git a/src/node/ext/event.cc b/src/node/ext/event.cc index b9446062d7..d59b68fb40 100644 --- a/src/node/ext/event.cc +++ b/src/node/ext/event.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,11 +58,11 @@ using v8::Value; Handle<Value> ParseMetadata(grpc_metadata *metadata_elements, size_t length) { NanEscapableScope(); - std::map<char*, size_t> size_map; - std::map<char*, size_t> index_map; + std::map<const char*, size_t> size_map; + std::map<const char*, size_t> index_map; for (unsigned int i = 0; i < length; i++) { - char *key = metadata_elements[i].key; + const char *key = metadata_elements[i].key; if (size_map.count(key)) { size_map[key] += 1; } @@ -97,8 +97,6 @@ Handle<Value> GetEventData(grpc_event *event) { switch (event->type) { case GRPC_READ: return NanEscapeScope(ByteBufferToBuffer(event->data.read)); - case GRPC_INVOKE_ACCEPTED: - return NanEscapeScope(NanNew<Number>(event->data.invoke_accepted)); case GRPC_WRITE_ACCEPTED: return NanEscapeScope(NanNew<Number>(event->data.write_accepted)); case GRPC_FINISH_ACCEPTED: @@ -124,12 +122,12 @@ Handle<Value> GetEventData(grpc_event *event) { return NanEscapeScope(NanNull()); } rpc_new->Set( - NanNew<String, const char *>("method"), - NanNew<String, const char *>(event->data.server_rpc_new.method)); + NanNew("method"), + NanNew(event->data.server_rpc_new.method)); rpc_new->Set( - NanNew<String, const char *>("host"), - NanNew<String, const char *>(event->data.server_rpc_new.host)); - rpc_new->Set(NanNew<String, const char *>("absolute_deadline"), + NanNew("host"), + NanNew(event->data.server_rpc_new.host)); + rpc_new->Set(NanNew("absolute_deadline"), NanNew<Date>(TimespecToMilliseconds( event->data.server_rpc_new.deadline))); count = event->data.server_rpc_new.metadata_count; @@ -137,12 +135,11 @@ Handle<Value> GetEventData(grpc_event *event) { metadata = NanNew<Array>(static_cast<int>(count)); for (unsigned int i = 0; i < count; i++) { Handle<Object> item_obj = Object::New(); - item_obj->Set(NanNew<String, const char *>("key"), - NanNew<String, char *>(items[i].key)); + item_obj->Set(NanNew("key"), + NanNew(items[i].key)); item_obj->Set( - NanNew<String, const char *>("value"), - NanNew<String, char *>(items[i].value, - static_cast<int>(items[i].value_length))); + NanNew("value"), + NanNew(items[i].value, static_cast<int>(items[i].value_length))); metadata->Set(i, item_obj); } rpc_new->Set(NanNew("metadata"), ParseMetadata(items, count)); diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb index 195406c8b3..7e838e23d1 100755 --- a/src/ruby/bin/math_client.rb +++ b/src/ruby/bin/math_client.rb @@ -83,7 +83,7 @@ def do_div_many(stub) logger.info('-------------') reqs = [] reqs << Math::DivArgs.new(dividend: 7, divisor: 3) - reqs << Math::Di5AvArgs.new(dividend: 5, divisor: 2) + reqs << Math::DivArgs.new(dividend: 5, divisor: 2) reqs << Math::DivArgs.new(dividend: 7, divisor: 2) logger.info("div(7/3), div(5/2), div(7/2): reqs=#{reqs.inspect}") resp = stub.div_many(reqs, 10) diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c index a1ab6251c8..72c9dd2ec0 100644 --- a/src/ruby/ext/grpc/rb_event.c +++ b/src/ruby/ext/grpc/rb_event.c @@ -256,14 +256,6 @@ static VALUE grpc_rb_event_result(VALUE self) { event->data.finish_accepted); break; - case GRPC_INVOKE_ACCEPTED: - if (event->data.invoke_accepted == GRPC_OP_OK) { - return Qnil; - } - rb_raise(rb_eEventError, "invoke failed, not sure why (code=%d)", - event->data.invoke_accepted); - break; - case GRPC_WRITE_ACCEPTED: if (event->data.write_accepted == GRPC_OP_OK) { return Qnil; @@ -343,9 +335,8 @@ void Init_google_rpc_event() { rb_define_module_under(rb_mGoogleRpcCore, "CompletionType"); rb_define_const(rb_mCompletionType, "QUEUE_SHUTDOWN", INT2NUM(GRPC_QUEUE_SHUTDOWN)); + rb_define_const(rb_mCompletionType, "OP_COMPLETE", INT2NUM(GRPC_OP_COMPLETE)); rb_define_const(rb_mCompletionType, "READ", INT2NUM(GRPC_READ)); - rb_define_const(rb_mCompletionType, "INVOKE_ACCEPTED", - INT2NUM(GRPC_INVOKE_ACCEPTED)); rb_define_const(rb_mCompletionType, "WRITE_ACCEPTED", INT2NUM(GRPC_WRITE_ACCEPTED)); rb_define_const(rb_mCompletionType, "FINISH_ACCEPTED", diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index e1aa33e318..876397a6e7 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -81,7 +81,6 @@ module Google active_call.run_server_bidi(mth) end send_status(active_call, OK, 'OK') - active_call.finished rescue BadStatus => e # this is raised by handlers that want GRPC to send an application # error code and detail message. diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb index c793284488..8bb5043186 100644 --- a/src/ruby/spec/call_spec.rb +++ b/src/ruby/spec/call_spec.rb @@ -75,14 +75,14 @@ describe GRPC::Core::Call do end describe '#start_read' do - it 'should fail if called immediately' do + xit 'should fail if called immediately' do blk = proc { make_test_call.start_read(@tag) } expect(&blk).to raise_error GRPC::Core::CallError end end describe '#start_write' do - it 'should fail if called immediately' do + xit 'should fail if called immediately' do bytes = GRPC::Core::ByteBuffer.new('test string') blk = proc { make_test_call.start_write(bytes, @tag) } expect(&blk).to raise_error GRPC::Core::CallError @@ -90,14 +90,14 @@ describe GRPC::Core::Call do end describe '#start_write_status' do - it 'should fail if called immediately' do + xit 'should fail if called immediately' do blk = proc { make_test_call.start_write_status(153, 'x', @tag) } expect(&blk).to raise_error GRPC::Core::CallError end end describe '#writes_done' do - it 'should fail if called immediately' do + xit 'should fail if called immediately' do blk = proc { make_test_call.writes_done(Object.new) } expect(&blk).to raise_error GRPC::Core::CallError end diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb index 96b8ef4300..f5acae896a 100644 --- a/src/ruby/spec/client_server_spec.rb +++ b/src/ruby/spec/client_server_spec.rb @@ -292,10 +292,10 @@ shared_examples 'GRPC metadata delivery works OK' do # TODO: update this with the bug number to be resolved ev = expect_next_event_on(@client_queue, CLIENT_METADATA_READ, @client_metadata_tag) - expect(ev.result).to eq(':status' => '200') + expect(ev.result).to eq({}) end - it 'sends all the pairs and status:200 when keys and values are valid' do + it 'sends all the pairs when keys and values are valid' do @valid_metadata.each do |md| call = new_client_call call.invoke(@client_queue, @client_metadata_tag, @client_finished_tag) @@ -314,7 +314,6 @@ shared_examples 'GRPC metadata delivery works OK' do ev = expect_next_event_on(@client_queue, CLIENT_METADATA_READ, @client_metadata_tag) replace_symbols = Hash[md.each_pair.collect { |x, y| [x.to_s, y] }] - replace_symbols[':status'] = '200' expect(ev.result).to eq(replace_symbols) end end diff --git a/src/ruby/spec/event_spec.rb b/src/ruby/spec/event_spec.rb index 7ef08d021b..89acd4ba67 100644 --- a/src/ruby/spec/event_spec.rb +++ b/src/ruby/spec/event_spec.rb @@ -33,8 +33,8 @@ describe GRPC::Core::CompletionType do before(:each) do @known_types = { QUEUE_SHUTDOWN: 0, - READ: 1, - INVOKE_ACCEPTED: 2, + OP_COMPLETE: 1, + READ: 2, WRITE_ACCEPTED: 3, FINISH_ACCEPTED: 4, CLIENT_METADATA_READ: 5, diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 599e68bef0..86495d7369 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -166,7 +166,7 @@ describe GRPC::ActiveCall do expect(client_call.remote_read).to eq('server_response') end - it 'saves metadata { status=200 } when the server adds no metadata' do + it 'saves no metadata when the server adds no metadata' do call = make_test_call done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue, deadline) @@ -180,7 +180,7 @@ describe GRPC::ActiveCall do server_call.remote_send('ignore me') expect(client_call.metadata).to be_nil client_call.remote_read - expect(client_call.metadata).to eq(':status' => '200') + expect(client_call.metadata).to eq({}) end it 'saves metadata add by the server' do @@ -197,7 +197,7 @@ describe GRPC::ActiveCall do server_call.remote_send('ignore me') expect(client_call.metadata).to be_nil client_call.remote_read - expected = { ':status' => '200', 'k1' => 'v1', 'k2' => 'v2' } + expected = { 'k1' => 'v1', 'k2' => 'v2' } expect(client_call.metadata).to eq(expected) end @@ -307,7 +307,6 @@ describe GRPC::ActiveCall do server_call.remote_send('server_response') expect(client_call.remote_read).to eq('server_response') server_call.send_status(OK, 'status code is OK') - expect { server_call.finished }.to_not raise_error expect { client_call.finished }.to_not raise_error end @@ -326,7 +325,6 @@ describe GRPC::ActiveCall do server_call.send_status(OK, 'status code is OK') expect(client_call.remote_read).to eq('server_response') expect { client_call.writes_done(false) }.to_not raise_error - expect { server_call.finished }.to_not raise_error expect { client_call.finished }.to_not raise_error end @@ -345,7 +343,6 @@ describe GRPC::ActiveCall do server_call.send_status(OK, 'status code is OK') expect(client_call.remote_read).to eq('server_response') expect { client_call.writes_done(true) }.to_not raise_error - expect { server_call.finished }.to_not raise_error end end diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index f1500fbd44..c7218da2cf 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -434,7 +434,7 @@ describe 'ClientStub' do end expect(c.remote_read).to eq(expected_input) replys.each { |r| c.remote_send(r) } - c.send_status(status, status == @pass ? 'OK' : 'NOK', true) + c.send_status(status, status == @pass ? 'OK' : 'NOK') end end @@ -444,7 +444,7 @@ describe 'ClientStub' do c = expect_server_to_be_invoked(mtx, cnd) expected_inputs.each { |i| expect(c.remote_read).to eq(i) } replys.each { |r| c.remote_send(r) } - c.send_status(status, status == @pass ? 'OK' : 'NOK', true) + c.send_status(status, status == @pass ? 'OK' : 'NOK') end end @@ -460,7 +460,7 @@ describe 'ClientStub' do expect(c.remote_read).to eq(i) end end - c.send_status(status, status == @pass ? 'OK' : 'NOK', true) + c.send_status(status, status == @pass ? 'OK' : 'NOK') end end @@ -473,7 +473,7 @@ describe 'ClientStub' do expect(c.metadata[k.to_s]).to eq(v) end c.remote_send(resp) - c.send_status(status, status == @pass ? 'OK' : 'NOK', true) + c.send_status(status, status == @pass ? 'OK' : 'NOK') end end @@ -486,7 +486,7 @@ describe 'ClientStub' do expect(c.metadata[k.to_s]).to eq(v) end c.remote_send(resp) - c.send_status(status, status == @pass ? 'OK' : 'NOK', true) + c.send_status(status, status == @pass ? 'OK' : 'NOK') end end diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb index ac0b5c51f4..54ccf7ab8b 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -94,7 +94,6 @@ describe GRPC::RpcDesc do expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') - expect(@call).to receive(:finished).once @request_response.run_server_method(@call, method(:fake_reqresp)) end end @@ -135,7 +134,6 @@ describe GRPC::RpcDesc do it 'sends a response and closes the stream if there no errors' do expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') - expect(@call).to receive(:finished).once @client_streamer.run_server_method(@call, method(:fake_clstream)) end end @@ -180,7 +178,6 @@ describe GRPC::RpcDesc do expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_send).twice.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') - expect(@call).to receive(:finished).once @server_streamer.run_server_method(@call, method(:fake_svstream)) end end @@ -210,7 +207,6 @@ describe GRPC::RpcDesc do it 'closes the stream if there no errors' do expect(@call).to receive(:run_server_bidi) expect(@call).to receive(:send_status).once.with(OK, 'OK') - expect(@call).to receive(:finished).once @bidi_streamer.run_server_method(@call, method(:fake_bidistream)) end end |