From 9d77cdf42f5280c2c3120c8bebb7a487cd90e274 Mon Sep 17 00:00:00 2001 From: Volodymyr Gotra Date: Wed, 14 Sep 2016 19:18:48 -0500 Subject: [PATCH 1/2] THRIFT-3933 Microsoft .Net Core library port and generator for this library Client: .NET Core Patch: Volodymyr Gotra This closes #1088 --- .../cpp/src/generate/t_netcore_generator.cc | 3221 ++++ compiler/cpp/src/thrift/thriftl.ll | 1 + lib/netcore/.gitignore | 249 + lib/netcore/README.md | 12 + lib/netcore/build.cmd | 7 + lib/netcore/build.sh | 20 + .../CassandraTest.thrift | 705 + .../Facebook303Test.thrift | 110 + .../Cassandra/Test/AuthenticationException.cs | 147 + .../Cassandra/Test/AuthenticationRequest.cs | 160 + .../Cassandra/Test/AuthorizationException.cs | 147 + .../Apache/Cassandra/Test/Cassandra.cs | 15404 ++++++++++++++++ .../Cassandra/Test/CassandraTest.Constants.cs | 37 + .../Generated/Apache/Cassandra/Test/CfDef.cs | 1043 ++ .../Generated/Apache/Cassandra/Test/Column.cs | 282 + .../Apache/Cassandra/Test/ColumnDef.cs | 326 + .../Cassandra/Test/ColumnOrSuperColumn.cs | 325 + .../Apache/Cassandra/Test/ColumnParent.cs | 195 + .../Apache/Cassandra/Test/ColumnPath.cs | 239 + .../Apache/Cassandra/Test/Compression.cs | 28 + .../Apache/Cassandra/Test/ConsistencyLevel.cs | 84 + .../Apache/Cassandra/Test/CounterColumn.cs | 163 + .../Cassandra/Test/CounterSuperColumn.cs | 181 + .../Apache/Cassandra/Test/CqlMetadata.cs | 264 + .../Cassandra/Test/CqlPreparedResult.cs | 163 + .../Apache/Cassandra/Test/CqlResult.cs | 295 + .../Apache/Cassandra/Test/CqlResultType.cs | 26 + .../Generated/Apache/Cassandra/Test/CqlRow.cs | 184 + .../Apache/Cassandra/Test/Deletion.cs | 261 + .../Apache/Cassandra/Test/EndpointDetails.cs | 257 + .../Apache/Cassandra/Test/IndexClause.cs | 210 + .../Apache/Cassandra/Test/IndexExpression.cs | 194 + .../Apache/Cassandra/Test/IndexOperator.cs | 28 + .../Apache/Cassandra/Test/IndexType.cs | 25 + .../Cassandra/Test/InvalidRequestException.cs | 149 + .../Apache/Cassandra/Test/KeyCount.cs | 163 + .../Apache/Cassandra/Test/KeyRange.cs | 349 + .../Apache/Cassandra/Test/KeySlice.cs | 189 + .../Generated/Apache/Cassandra/Test/KsDef.cs | 374 + .../Apache/Cassandra/Test/Mutation.cs | 218 + .../Cassandra/Test/NotFoundException.cs | 110 + .../Test/SchemaDisagreementException.cs | 110 + .../Apache/Cassandra/Test/SlicePredicate.cs | 239 + .../Apache/Cassandra/Test/SliceRange.cs | 238 + .../Apache/Cassandra/Test/SuperColumn.cs | 188 + .../Cassandra/Test/TimedOutException.cs | 111 + .../Apache/Cassandra/Test/TokenRange.cs | 348 + .../Cassandra/Test/UnavailableException.cs | 110 + .../Facebook/FB303/Test/FacebookService.cs | 3538 ++++ .../Facebook/FB303/Test/fb_status.cs | 32 + .../Generated/ThriftAsync/Test/Bonk.cs | 210 + .../Generated/ThriftAsync/Test/BoolTest.cs | 214 + .../Generated/ThriftAsync/Test/Bools.cs | 210 + .../ThriftAsync/Test/CrazyNesting.cs | 482 + .../Generated/ThriftAsync/Test/EmptyStruct.cs | 102 + .../ThriftAsync/Test/GuessProtocolStruct.cs | 185 + .../Generated/ThriftAsync/Test/Insanity.cs | 248 + .../Generated/ThriftAsync/Test/LargeDeltas.cs | 626 + .../Generated/ThriftAsync/Test/ListBonks.cs | 181 + .../ThriftAsync/Test/ListTypeVersioningV1.cs | 227 + .../ThriftAsync/Test/ListTypeVersioningV2.cs | 227 + .../ThriftAsync/Test/NestedListsBonk.cs | 218 + .../ThriftAsync/Test/NestedListsI32x2.cs | 197 + .../ThriftAsync/Test/NestedListsI32x3.cs | 216 + .../ThriftAsync/Test/NestedMixedx2.cs | 391 + .../Generated/ThriftAsync/Test/Numberz.cs | 32 + .../Generated/ThriftAsync/Test/OneField.cs | 164 + .../ThriftAsync/Test/SecondService.cs | 638 + .../Generated/ThriftAsync/Test/StructA.cs | 135 + .../Generated/ThriftAsync/Test/StructB.cs | 201 + .../Generated/ThriftAsync/Test/ThriftTest.cs | 7866 ++++++++ .../Test/ThriftTestAsync.Constants.cs | 37 + .../ThriftAsync/Test/VersioningTestV1.cs | 257 + .../ThriftAsync/Test/VersioningTestV2.cs | 735 + .../Generated/ThriftAsync/Test/Xception.cs | 231 + .../Generated/ThriftAsync/Test/Xception2.cs | 232 + .../Generated/ThriftAsync/Test/Xtruct.cs | 351 + .../Generated/ThriftAsync/Test/Xtruct2.cs | 258 + .../Generated/ThriftAsync/Test/Xtruct3.cs | 304 + .../Properties/AssemblyInfo.cs | 39 + ...hrift.PublicInterfaces.Compile.Tests.xproj | 21 + .../ThriftTestAsync.thrift | 382 + .../project.json | 25 + lib/netcore/src/Thrift.sln | 38 + .../src/Thrift/Collections/TCollections.cs | 101 + .../src/Thrift/Collections/THashSet.cs | 67 + lib/netcore/src/Thrift/ITAsyncProcessor.cs | 29 + lib/netcore/src/Thrift/ITProcessorFactory.cs | 28 + .../src/Thrift/Properties/AssemblyInfo.cs | 56 + .../src/Thrift/Protocols/Entities/TField.cs | 37 + .../src/Thrift/Protocols/Entities/TList.cs | 33 + .../src/Thrift/Protocols/Entities/TMap.cs | 36 + .../src/Thrift/Protocols/Entities/TMessage.cs | 37 + .../Thrift/Protocols/Entities/TMessageType.cs | 28 + .../src/Thrift/Protocols/Entities/TSet.cs | 38 + .../src/Thrift/Protocols/Entities/TStruct.cs | 30 + .../src/Thrift/Protocols/Entities/TType.cs | 37 + .../src/Thrift/Protocols/ITProtocolFactory.cs | 27 + .../src/Thrift/Protocols/TAbstractBase.cs | 28 + lib/netcore/src/Thrift/Protocols/TBase.cs | 28 + .../src/Thrift/Protocols/TBinaryProtocol.cs | 608 + .../src/Thrift/Protocols/TCompactProtocol.cs | 922 + .../src/Thrift/Protocols/TJSONProtocol.cs | 1170 ++ .../Thrift/Protocols/TMultiplexedProtocol.cs | 100 + lib/netcore/src/Thrift/Protocols/TProtocol.cs | 377 + .../Thrift/Protocols/TProtocolDecorator.cs | 252 + .../Thrift/Protocols/TProtocolException.cs | 58 + .../Protocols/Utilities/TBase64Utils.cs | 101 + .../Protocols/Utilities/TProtocolUtil.cs | 108 + .../src/Thrift/Server/AsyncBaseServer.cs | 184 + lib/netcore/src/Thrift/Server/TBaseServer.cs | 86 + .../src/Thrift/Server/TServerEventHandler.cs | 54 + .../src/Thrift/SingletonTProcessorFactory.cs | 38 + .../src/Thrift/TApplicationException.cs | 149 + lib/netcore/src/Thrift/TBaseClient.cs | 98 + lib/netcore/src/Thrift/TException.cs | 34 + .../src/Thrift/TMultiplexedProcessor.cs | 143 + lib/netcore/src/Thrift/Thrift.xproj | 21 + .../Client/TBufferedClientTransport.cs | 210 + .../Client/TFramedClientTransport.cs | 207 + .../Transports/Client/THttpClientTransport.cs | 228 + .../Client/TMemoryBufferClientTransport.cs | 97 + .../Client/TNamedPipeClientTransport.cs | 95 + .../Client/TSocketClientTransport.cs | 144 + .../Client/TStreamClientTransport.cs | 110 + .../Client/TTlsSocketClientTransport.cs | 236 + .../Transports/Server/THttpServerTransport.cs | 113 + .../Server/TNamedPipeServerTransport.cs | 191 + .../Server/TServerSocketTransport.cs | 162 + .../Server/TTlsServerSocketTransport.cs | 156 + .../src/Thrift/Transports/TClientTransport.cs | 178 + .../src/Thrift/Transports/TServerTransport.cs | 54 + .../Thrift/Transports/TTransportException.cs | 58 + .../Thrift/Transports/TTransportFactory.cs | 35 + lib/netcore/src/Thrift/project.json | 19 + lib/netcore/src/global.json | 3 + test/netcore/.gitignore | 5 + test/netcore/ThriftTest/Program.cs | 64 + .../ThriftTest/Properties/AssemblyInfo.cs | 27 + .../ThriftTest/Properties/launchSettings.json | 7 + test/netcore/ThriftTest/TestClient.cs | 862 + test/netcore/ThriftTest/TestServer.cs | 527 + test/netcore/ThriftTest/ThirftTest.sln | 33 + test/netcore/ThriftTest/ThirftTest.xproj | 21 + .../gen-netcore/thrift/test/Bonk.cs | 182 + .../gen-netcore/thrift/test/BoolTest.cs | 186 + .../gen-netcore/thrift/test/Bools.cs | 182 + .../gen-netcore/thrift/test/CrazyNesting.cs | 400 + .../gen-netcore/thrift/test/EmptyStruct.cs | 92 + .../thrift/test/GuessProtocolStruct.cs | 161 + .../gen-netcore/thrift/test/Insanity.cs | 220 + .../gen-netcore/thrift/test/LargeDeltas.cs | 550 + .../gen-netcore/thrift/test/ListBonks.cs | 159 + .../thrift/test/ListTypeVersioningV1.cs | 199 + .../thrift/test/ListTypeVersioningV2.cs | 199 + .../thrift/test/NestedListsBonk.cs | 193 + .../thrift/test/NestedListsI32x2.cs | 175 + .../thrift/test/NestedListsI32x3.cs | 192 + .../gen-netcore/thrift/test/NestedMixedx2.cs | 348 + .../gen-netcore/thrift/test/Numberz.cs | 22 + .../gen-netcore/thrift/test/OneField.cs | 142 + .../gen-netcore/thrift/test/SecondService.cs | 581 + .../gen-netcore/thrift/test/StructA.cs | 124 + .../gen-netcore/thrift/test/StructB.cs | 175 + .../thrift/test/ThriftTest.Constants.cs | 24 + .../gen-netcore/thrift/test/ThriftTest.cs | 7046 +++++++ .../thrift/test/VersioningTestV1.cs | 223 + .../thrift/test/VersioningTestV2.cs | 647 + .../gen-netcore/thrift/test/Xception.cs | 182 + .../gen-netcore/thrift/test/Xception2.cs | 183 + .../gen-netcore/thrift/test/Xtruct.cs | 264 + .../gen-netcore/thrift/test/Xtruct2.cs | 224 + .../gen-netcore/thrift/test/Xtruct3.cs | 264 + test/netcore/ThriftTest/project.json | 27 + test/netcore/global.json | 3 + test/tests.json | 28 + tutorial/netcore/.gitignore | 1 + tutorial/netcore/Client/Client.xproj | 21 + tutorial/netcore/Client/Program.cs | 276 + .../netcore/Client/Properties/AssemblyInfo.cs | 39 + .../Client/Properties/launchSettings.json | 8 + tutorial/netcore/Client/ThriftTest.pfx | Bin 0 -> 2661 bytes tutorial/netcore/Client/project.json | 26 + tutorial/netcore/Interfaces/Interfaces.xproj | 21 + .../Interfaces/Properties/AssemblyInfo.cs | 39 + .../Interfaces/Thrift/Samples/Calculator.cs | 1230 ++ .../Thrift/Samples/InvalidOperation.cs | 234 + .../Interfaces/Thrift/Samples/Operation.cs | 31 + .../Thrift/Samples/SharedService.cs | 439 + .../Interfaces/Thrift/Samples/SharedStruct.cs | 210 + .../netcore/Interfaces/Thrift/Samples/Work.cs | 317 + tutorial/netcore/Interfaces/project.json | 21 + tutorial/netcore/Interfaces/shared.thrift | 34 + tutorial/netcore/Interfaces/tutorial.thrift | 131 + tutorial/netcore/README.md | 253 + tutorial/netcore/Server/Program.cs | 397 + .../netcore/Server/Properties/AssemblyInfo.cs | 39 + .../Server/Properties/launchSettings.json | 8 + tutorial/netcore/Server/Server.xproj | 21 + tutorial/netcore/Server/ThriftTest.pfx | Bin 0 -> 2661 bytes tutorial/netcore/Server/project.json | 29 + tutorial/netcore/Tutorial.sln | 34 + 202 files changed, 73780 insertions(+) create mode 100644 compiler/cpp/src/generate/t_netcore_generator.cc create mode 100644 lib/netcore/.gitignore create mode 100644 lib/netcore/README.md create mode 100644 lib/netcore/build.cmd create mode 100755 lib/netcore/build.sh create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift create mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json create mode 100644 lib/netcore/src/Thrift.sln create mode 100644 lib/netcore/src/Thrift/Collections/TCollections.cs create mode 100644 lib/netcore/src/Thrift/Collections/THashSet.cs create mode 100644 lib/netcore/src/Thrift/ITAsyncProcessor.cs create mode 100644 lib/netcore/src/Thrift/ITProcessorFactory.cs create mode 100644 lib/netcore/src/Thrift/Properties/AssemblyInfo.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TField.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TList.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TMap.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TSet.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Entities/TType.cs create mode 100644 lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TAbstractBase.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TBase.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TProtocol.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs create mode 100644 lib/netcore/src/Thrift/Protocols/TProtocolException.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs create mode 100644 lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs create mode 100644 lib/netcore/src/Thrift/Server/AsyncBaseServer.cs create mode 100644 lib/netcore/src/Thrift/Server/TBaseServer.cs create mode 100644 lib/netcore/src/Thrift/Server/TServerEventHandler.cs create mode 100644 lib/netcore/src/Thrift/SingletonTProcessorFactory.cs create mode 100644 lib/netcore/src/Thrift/TApplicationException.cs create mode 100644 lib/netcore/src/Thrift/TBaseClient.cs create mode 100644 lib/netcore/src/Thrift/TException.cs create mode 100644 lib/netcore/src/Thrift/TMultiplexedProcessor.cs create mode 100644 lib/netcore/src/Thrift/Thrift.xproj create mode 100644 lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/TClientTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/TServerTransport.cs create mode 100644 lib/netcore/src/Thrift/Transports/TTransportException.cs create mode 100644 lib/netcore/src/Thrift/Transports/TTransportFactory.cs create mode 100644 lib/netcore/src/Thrift/project.json create mode 100644 lib/netcore/src/global.json create mode 100644 test/netcore/.gitignore create mode 100644 test/netcore/ThriftTest/Program.cs create mode 100644 test/netcore/ThriftTest/Properties/AssemblyInfo.cs create mode 100644 test/netcore/ThriftTest/Properties/launchSettings.json create mode 100644 test/netcore/ThriftTest/TestClient.cs create mode 100644 test/netcore/ThriftTest/TestServer.cs create mode 100644 test/netcore/ThriftTest/ThirftTest.sln create mode 100644 test/netcore/ThriftTest/ThirftTest.xproj create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs create mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs create mode 100644 test/netcore/ThriftTest/project.json create mode 100644 test/netcore/global.json create mode 100644 tutorial/netcore/.gitignore create mode 100644 tutorial/netcore/Client/Client.xproj create mode 100644 tutorial/netcore/Client/Program.cs create mode 100644 tutorial/netcore/Client/Properties/AssemblyInfo.cs create mode 100644 tutorial/netcore/Client/Properties/launchSettings.json create mode 100644 tutorial/netcore/Client/ThriftTest.pfx create mode 100644 tutorial/netcore/Client/project.json create mode 100644 tutorial/netcore/Interfaces/Interfaces.xproj create mode 100644 tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs create mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Work.cs create mode 100644 tutorial/netcore/Interfaces/project.json create mode 100644 tutorial/netcore/Interfaces/shared.thrift create mode 100644 tutorial/netcore/Interfaces/tutorial.thrift create mode 100644 tutorial/netcore/README.md create mode 100644 tutorial/netcore/Server/Program.cs create mode 100644 tutorial/netcore/Server/Properties/AssemblyInfo.cs create mode 100644 tutorial/netcore/Server/Properties/launchSettings.json create mode 100644 tutorial/netcore/Server/Server.xproj create mode 100644 tutorial/netcore/Server/ThriftTest.pfx create mode 100644 tutorial/netcore/Server/project.json create mode 100644 tutorial/netcore/Tutorial.sln diff --git a/compiler/cpp/src/generate/t_netcore_generator.cc b/compiler/cpp/src/generate/t_netcore_generator.cc new file mode 100644 index 00000000000..ff436658c72 --- /dev/null +++ b/compiler/cpp/src/generate/t_netcore_generator.cc @@ -0,0 +1,3221 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Contains some contributions under the Thrift Software License. + * Please see doc/old-thrift-license.txt in the Thrift distribution for + * details. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "platform.h" +#include "t_oop_generator.h" + +using std::map; +using std::ofstream; +using std::ostringstream; +using std::string; +using std::stringstream; +using std::vector; + +//TODO: check for indentation +//TODO: Do we need seqId_ in generation? + +static const string endl = "\n"; // avoid ostream << std::endl flushes + +struct member_mapping_scope +{ + void* scope_member; + map mapping_table; +}; + +class t_netcore_generator : public t_oop_generator +{ +public: + t_netcore_generator(t_program* program, const map& parsed_options, const string& option_string) + : t_oop_generator(program) + { + (void)option_string; + + nullable_ = false; + hashcode_ = false; + union_ = false; + serialize_ = false; + wcf_ = false; + wcf_namespace_.clear(); + + map::const_iterator iter; + + for (iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) + { + if (iter->first.compare("nullable") == 0) + { + nullable_ = true; + } + else if (iter->first.compare("hashcode") == 0) + { + hashcode_ = true; + } + else if (iter->first.compare("union") == 0) + { + union_ = true; + } + else if (iter->first.compare("serial") == 0) + { + serialize_ = true; + wcf_namespace_ = iter->second; // since there can be only one namespace + } + else if (iter->first.compare("wcf") == 0) + { + wcf_ = true; + wcf_namespace_ = iter->second; + } + else + { + throw "unknown option netcore:" + iter->first; + } + } + + out_dir_base_ = "gen-netcore"; + } + + // overrides + void init_generator() override; + void close_generator() override; + void generate_consts(vector consts) override; + void generate_typedef(t_typedef* ttypedef) override; + void generate_enum(t_enum* tenum) override; + void generate_struct(t_struct* tstruct) override; + void generate_xception(t_struct* txception) override; + void generate_service(t_service* tservice) override; + + void generate_property(ofstream& out, t_field* tfield, bool isPublic, bool generateIsset); + void generate_netcore_property(ofstream& out, t_field* tfield, bool isPublic, bool includeIsset = true, string fieldPrefix = ""); + bool print_const_value(ofstream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval = false, bool needtype = false); + string render_const_value(ofstream& out, string name, t_type* type, t_const_value* value); + void print_const_constructor(ofstream& out, vector consts); + void print_const_def_value(ofstream& out, string name, t_type* type, t_const_value* value); + void generate_netcore_struct(t_struct* tstruct, bool is_exception); + void generate_netcore_union(t_struct* tunion); + void generate_netcore_struct_definition(ofstream& out, t_struct* tstruct, bool is_xception = false, bool in_class = false, bool is_result = false); + void generate_netcore_union_definition(ofstream& out, t_struct* tunion); + void generate_netcore_union_class(ofstream& out, t_struct* tunion, t_field* tfield); + void generate_netcore_wcffault(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_reader(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_result_writer(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_writer(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_tostring(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_equals(ofstream& out, t_struct* tstruct); + void generate_netcore_struct_hashcode(ofstream& out, t_struct* tstruct); + void generate_netcore_union_reader(ofstream& out, t_struct* tunion); + void generate_function_helpers(ofstream& out, t_function* tfunction); + void generate_service_interface(ofstream& out, t_service* tservice); + void generate_service_helpers(ofstream& out, t_service* tservice); + void generate_service_client(ofstream& out, t_service* tservice); + void generate_service_server(ofstream& out, t_service* tservice); + void generate_process_function_async(ofstream& out, t_service* tservice, t_function* function); + void generate_deserialize_field(ofstream& out, t_field* tfield, string prefix = "", bool is_propertyless = false); + void generate_deserialize_struct(ofstream& out, t_struct* tstruct, string prefix = ""); + void generate_deserialize_container(ofstream& out, t_type* ttype, string prefix = ""); + void generate_deserialize_set_element(ofstream& out, t_set* tset, string prefix = ""); + void generate_deserialize_map_element(ofstream& out, t_map* tmap, string prefix = ""); + void generate_deserialize_list_element(ofstream& out, t_list* list, string prefix = ""); + void generate_serialize_field(ofstream& out, t_field* tfield, string prefix = "", bool is_element = false, bool is_propertyless = false); + void generate_serialize_struct(ofstream& out, t_struct* tstruct, string prefix = ""); + void generate_serialize_container(ofstream& out, t_type* ttype, string prefix = ""); + void generate_serialize_map_element(ofstream& out, t_map* tmap, string iter, string map); + void generate_serialize_set_element(ofstream& out, t_set* tmap, string iter); + void generate_serialize_list_element(ofstream& out, t_list* tlist, string iter); + void generate_netcore_doc(ofstream& out, t_field* field); + void generate_netcore_doc(ofstream& out, t_doc* tdoc); + void generate_netcore_doc(ofstream& out, t_function* tdoc); + void generate_netcore_docstring_comment(ofstream& out, string contents); + void docstring_comment(ofstream& out, const string& comment_start, const string& line_prefix, const string& contents, const string& comment_end); + void start_netcore_namespace(ofstream& out); + void end_netcore_namespace(ofstream& out); + + string netcore_type_usings() const; + string netcore_thrift_usings() const; + string type_name(t_type* ttype, bool in_countainer = false, bool in_init = false, bool in_param = false, bool is_required = false); + string base_type_name(t_base_type* tbase, bool in_container = false, bool in_param = false, bool is_required = false); + string declare_field(t_field* tfield, bool init = false, string prefix = ""); + string function_signature_async(t_function* tfunction, string prefix = ""); + string function_signature(t_function* tfunction, string prefix = ""); + string argument_list(t_struct* tstruct); + string type_to_enum(t_type* ttype); + string prop_name(t_field* tfield, bool suppress_mapping = false); + string get_enum_class_name(t_type* type) override; + + static string correct_function_name_for_async(string const& function_name) + { + string const async_end = "Async"; + size_t i = function_name.find(async_end); + if (i != string::npos) + { + return function_name + async_end; + } + + return function_name; + } + + /** + * \brief Search and replace "_args" substring in struct name if exist (for C# class naming) + * \param struct_name + * \return Modified struct name ("Struct_args" -> "StructArgs") or original name + */ + static string check_and_correct_struct_name(const string& struct_name) + { + string args_end = "_args"; + size_t i = struct_name.find(args_end); + if (i != string::npos) + { + string new_struct_name = { struct_name }; + new_struct_name.replace(i, args_end.length(), "Args"); + return new_struct_name; + } + + string result_end = "_result"; + size_t j = struct_name.find(result_end); + if (j != string::npos) + { + string new_struct_name = { struct_name }; + new_struct_name.replace(j, result_end.length(), "Result"); + return new_struct_name; + } + + return struct_name; + } + + static bool field_has_default(t_field* tfield) { return tfield->get_value() != NULL; } + + static bool field_is_required(t_field* tfield) { return tfield->get_req() == t_field::T_REQUIRED; } + + static bool type_can_be_null(t_type* ttype) + { + while (ttype->is_typedef()) + { + ttype = static_cast(ttype)->get_type(); + } + + return ttype->is_container() || ttype->is_struct() || ttype->is_xception() || ttype->is_string(); + } + + // TODO: discuss improvements to base class (indent_reset, etc.) + string indent() + { + string spaces_per_indent = " "; + string ind = ""; + int i; + for (i = 0; i < _indent; ++i) { + ind += spaces_per_indent; + } + return ind; + } + + void indent_up() { ++_indent; } + void indent_down() { --_indent; } + void reset_indent() { _indent = 0; } + + void scope_up(std::ostream& out) + { + out << indent() << "{" << endl; + indent_up(); + } + + void scope_down(std::ostream& out) + { + indent_down(); + out << indent() << "}" << endl; + } + + int indent_count() + { + return _indent; + } + +private: + string namespace_name_; + string namespace_dir_; + + int _indent = 0; + bool nullable_; + bool union_; + bool hashcode_; + bool serialize_; + bool wcf_; + + string wcf_namespace_; + map netcore_keywords; + vector member_mapping_scopes; + + void init_keywords(); + string normalize_name(string name); + string make_valid_csharp_identifier(string const& fromName); + void prepare_member_name_mapping(t_struct* tstruct); + void prepare_member_name_mapping(void* scope, const vector& members, const string& structname); + void cleanup_member_name_mapping(void* scope); + string get_mapped_member_name(string oldname); +}; + +void t_netcore_generator::init_generator() +{ + MKDIR(get_out_dir().c_str()); + + // for usage of csharp namespaces in thrift files (from files for csharp) + namespace_name_ = program_->get_namespace("netcore"); + if (namespace_name_.empty()) + { + namespace_name_ = program_->get_namespace("csharp"); + } + + string dir = namespace_name_; + string subdir = get_out_dir().c_str(); + string::size_type loc; + + while ((loc = dir.find(".")) != string::npos) + { + subdir = subdir + "/" + dir.substr(0, loc); + MKDIR(subdir.c_str()); + dir = dir.substr(loc + 1); + } + if (dir.size() > 0) + { + subdir = subdir + "/" + dir; + MKDIR(subdir.c_str()); + } + + namespace_dir_ = subdir; + init_keywords(); + + while (!member_mapping_scopes.empty()) + { + cleanup_member_name_mapping(member_mapping_scopes.back().scope_member); + } + + pverbose("C# options:\n"); + pverbose("- nullable ... %s\n", (nullable_ ? "ON" : "off")); + pverbose("- union ...... %s\n", (union_ ? "ON" : "off")); + pverbose("- hashcode ... %s\n", (hashcode_ ? "ON" : "off")); + pverbose("- serialize .. %s\n", (serialize_ ? "ON" : "off")); + pverbose("- wcf ........ %s\n", (wcf_ ? "ON" : "off")); +} + +string t_netcore_generator::normalize_name(string name) +{ + string tmp(name); + transform(tmp.begin(), tmp.end(), tmp.begin(), static_cast(tolower)); + + // un-conflict keywords by prefixing with "@" + if (netcore_keywords.find(tmp) != netcore_keywords.end()) + { + return "@" + name; + } + + // no changes necessary + return name; +} + +void t_netcore_generator::init_keywords() +{ + netcore_keywords.clear(); + + // C# keywords + netcore_keywords["abstract"] = 1; + netcore_keywords["as"] = 1; + netcore_keywords["base"] = 1; + netcore_keywords["bool"] = 1; + netcore_keywords["break"] = 1; + netcore_keywords["byte"] = 1; + netcore_keywords["case"] = 1; + netcore_keywords["catch"] = 1; + netcore_keywords["char"] = 1; + netcore_keywords["checked"] = 1; + netcore_keywords["class"] = 1; + netcore_keywords["const"] = 1; + netcore_keywords["continue"] = 1; + netcore_keywords["decimal"] = 1; + netcore_keywords["default"] = 1; + netcore_keywords["delegate"] = 1; + netcore_keywords["do"] = 1; + netcore_keywords["double"] = 1; + netcore_keywords["else"] = 1; + netcore_keywords["enum"] = 1; + netcore_keywords["event"] = 1; + netcore_keywords["explicit"] = 1; + netcore_keywords["extern"] = 1; + netcore_keywords["false"] = 1; + netcore_keywords["finally"] = 1; + netcore_keywords["fixed"] = 1; + netcore_keywords["float"] = 1; + netcore_keywords["for"] = 1; + netcore_keywords["foreach"] = 1; + netcore_keywords["goto"] = 1; + netcore_keywords["if"] = 1; + netcore_keywords["implicit"] = 1; + netcore_keywords["in"] = 1; + netcore_keywords["int"] = 1; + netcore_keywords["interface"] = 1; + netcore_keywords["internal"] = 1; + netcore_keywords["is"] = 1; + netcore_keywords["lock"] = 1; + netcore_keywords["long"] = 1; + netcore_keywords["namespace"] = 1; + netcore_keywords["new"] = 1; + netcore_keywords["null"] = 1; + netcore_keywords["object"] = 1; + netcore_keywords["operator"] = 1; + netcore_keywords["out"] = 1; + netcore_keywords["override"] = 1; + netcore_keywords["params"] = 1; + netcore_keywords["private"] = 1; + netcore_keywords["protected"] = 1; + netcore_keywords["public"] = 1; + netcore_keywords["readonly"] = 1; + netcore_keywords["ref"] = 1; + netcore_keywords["return"] = 1; + netcore_keywords["sbyte"] = 1; + netcore_keywords["sealed"] = 1; + netcore_keywords["short"] = 1; + netcore_keywords["sizeof"] = 1; + netcore_keywords["stackalloc"] = 1; + netcore_keywords["static"] = 1; + netcore_keywords["string"] = 1; + netcore_keywords["struct"] = 1; + netcore_keywords["switch"] = 1; + netcore_keywords["this"] = 1; + netcore_keywords["throw"] = 1; + netcore_keywords["true"] = 1; + netcore_keywords["try"] = 1; + netcore_keywords["typeof"] = 1; + netcore_keywords["uint"] = 1; + netcore_keywords["ulong"] = 1; + netcore_keywords["unchecked"] = 1; + netcore_keywords["unsafe"] = 1; + netcore_keywords["ushort"] = 1; + netcore_keywords["using"] = 1; + netcore_keywords["virtual"] = 1; + netcore_keywords["void"] = 1; + netcore_keywords["volatile"] = 1; + netcore_keywords["while"] = 1; + + // C# contextual keywords + netcore_keywords["add"] = 1; + netcore_keywords["alias"] = 1; + netcore_keywords["ascending"] = 1; + netcore_keywords["async"] = 1; + netcore_keywords["await"] = 1; + netcore_keywords["descending"] = 1; + netcore_keywords["dynamic"] = 1; + netcore_keywords["from"] = 1; + netcore_keywords["get"] = 1; + netcore_keywords["global"] = 1; + netcore_keywords["group"] = 1; + netcore_keywords["into"] = 1; + netcore_keywords["join"] = 1; + netcore_keywords["let"] = 1; + netcore_keywords["orderby"] = 1; + netcore_keywords["partial"] = 1; + netcore_keywords["remove"] = 1; + netcore_keywords["select"] = 1; + netcore_keywords["set"] = 1; + netcore_keywords["value"] = 1; + netcore_keywords["var"] = 1; + netcore_keywords["where"] = 1; + netcore_keywords["yield"] = 1; +} + +void t_netcore_generator::start_netcore_namespace(ofstream& out) +{ + if (!namespace_name_.empty()) + { + out << "namespace " << namespace_name_ << endl; + scope_up(out); + } +} + +void t_netcore_generator::end_netcore_namespace(ofstream& out) +{ + if (!namespace_name_.empty()) + { + scope_down(out); + } +} + +string t_netcore_generator::netcore_type_usings() const +{ + string namespaces = + "using System;\n" + "using System.Collections;\n" + "using System.Collections.Generic;\n" + "using System.Text;\n" + "using System.IO;\n" + "using System.Threading;\n" + "using System.Threading.Tasks;\n" + "using Thrift;\n" + "using Thrift.Collections;\n"; + + if (wcf_) + { + namespaces += "using System.ServiceModel;\n"; + namespaces += "using System.Runtime.Serialization;\n"; + } + + return namespaces + endl; +} + +string t_netcore_generator::netcore_thrift_usings() const +{ + string namespaces = + "using Thrift.Protocols;\n" + "using Thrift.Protocols.Entities;\n" + "using Thrift.Protocols.Utilities;\n" + "using Thrift.Transports;\n" + "using Thrift.Transports.Client;\n" + "using Thrift.Transports.Server;\n"; + + return namespaces + endl; +} + +void t_netcore_generator::close_generator() +{ +} + +void t_netcore_generator::generate_typedef(t_typedef* ttypedef) +{ + (void)ttypedef; +} + +void t_netcore_generator::generate_enum(t_enum* tenum) +{ + int ic = indent_count(); + + string f_enum_name = namespace_dir_ + "/" + tenum->get_name() + ".cs"; + + ofstream f_enum; + f_enum.open(f_enum_name.c_str()); + f_enum << autogen_comment() << endl; + + start_netcore_namespace(f_enum); + generate_netcore_doc(f_enum, tenum); + + f_enum << indent() << "public enum " << tenum->get_name() << endl; + scope_up(f_enum); + + vector constants = tenum->get_constants(); + vector::iterator c_iter; + + for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) + { + generate_netcore_doc(f_enum, *c_iter); + int value = (*c_iter)->get_value(); + f_enum << indent() << (*c_iter)->get_name() << " = " << value << "," << endl; + } + + scope_down(f_enum); + end_netcore_namespace(f_enum); + f_enum.close(); + + if (indent_count() != ic) { pverbose("Wrong indent count in generate_enum. Difference: %i \n", (ic - indent_count())); } +} + +void t_netcore_generator::generate_consts(vector consts) +{ + if (consts.empty()) + { + return; + } + + string f_consts_name = namespace_dir_ + '/' + program_name_ + ".Constants.cs"; + ofstream f_consts; + f_consts.open(f_consts_name.c_str()); + + f_consts << autogen_comment() << netcore_type_usings() << endl; + + start_netcore_namespace(f_consts); + + f_consts << indent() << "public static class " << make_valid_csharp_identifier(program_name_) << "Constants" << endl; + + scope_up(f_consts); + + vector::iterator c_iter; + bool need_static_constructor = false; + for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) + { + generate_netcore_doc(f_consts, *c_iter); + if (print_const_value(f_consts, (*c_iter)->get_name(), (*c_iter)->get_type(), (*c_iter)->get_value(), false)) + { + need_static_constructor = true; + } + } + + if (need_static_constructor) + { + print_const_constructor(f_consts, consts); + } + + scope_down(f_consts); + end_netcore_namespace(f_consts); + f_consts.close(); +} + +void t_netcore_generator::print_const_def_value(ofstream& out, string name, t_type* type, t_const_value* value) +{ + if (type->is_struct() || type->is_xception()) + { + const vector& fields = static_cast(type)->get_members(); + const map& val = value->get_map(); + vector::const_iterator f_iter; + map::const_iterator v_iter; + prepare_member_name_mapping(static_cast(type)); + + for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) + { + t_field* field = NULL; + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if ((*f_iter)->get_name() == v_iter->first->get_string()) + { + field = *f_iter; + } + } + + if (field == NULL) + { + throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string(); + } + + t_type* field_type = field->get_type(); + + string val = render_const_value(out, name, field_type, v_iter->second); + out << indent() << name << "." << prop_name(field) << " = " << val << ";" << endl; + } + + cleanup_member_name_mapping(static_cast(type)); + } + else if (type->is_map()) + { + t_type* ktype = static_cast(type)->get_key_type(); + t_type* vtype = static_cast(type)->get_val_type(); + const map& val = value->get_map(); + map::const_iterator v_iter; + for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) + { + string key = render_const_value(out, name, ktype, v_iter->first); + string val = render_const_value(out, name, vtype, v_iter->second); + out << indent() << name << "[" << key << "]" << " = " << val << ";" << endl; + } + } + else if (type->is_list() || type->is_set()) + { + t_type* etype; + if (type->is_list()) + { + etype = static_cast(type)->get_elem_type(); + } + else + { + etype = static_cast(type)->get_elem_type(); + } + + const vector& val = value->get_list(); + vector::const_iterator v_iter; + for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) + { + string val = render_const_value(out, name, etype, *v_iter); + out << indent() << name << ".Add(" << val << ");" << endl; + } + } +} + +void t_netcore_generator::print_const_constructor(ofstream& out, vector consts) +{ + out << indent() << "static " << make_valid_csharp_identifier(program_name_).c_str() << "Constants()" << endl; + scope_up(out); + + vector::iterator c_iter; + for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) + { + string name = (*c_iter)->get_name(); + t_type* type = (*c_iter)->get_type(); + t_const_value* value = (*c_iter)->get_value(); + + print_const_def_value(out, name, type, value); + } + scope_down(out); +} + +bool t_netcore_generator::print_const_value(ofstream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval, bool needtype) +{ + out << indent(); + bool need_static_construction = !in_static; + while (type->is_typedef()) + { + type = static_cast(type)->get_type(); + } + + if (!defval || needtype) + { + out << (in_static ? "" : type->is_base_type() ? "public const " : "public static ") << type_name(type) << " "; + } + + if (type->is_base_type()) + { + string v2 = render_const_value(out, name, type, value); + out << name << " = " << v2 << ";" << endl; + need_static_construction = false; + } + else if (type->is_enum()) + { + out << name << " = " << type_name(type, false, true) << "." << value->get_identifier_name() << ";" << endl; + need_static_construction = false; + } + else if (type->is_struct() || type->is_xception()) + { + out << name << " = new " << type_name(type) << "();" << endl; + } + else if (type->is_map()) + { + out << name << " = new " << type_name(type, true, true) << "();" << endl; + } + else if (type->is_list() || type->is_set()) + { + out << name << " = new " << type_name(type) << "();" << endl; + } + + if (defval && !type->is_base_type() && !type->is_enum()) + { + print_const_def_value(out, name, type, value); + } + + return need_static_construction; +} + +string t_netcore_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) +{ + (void)name; + ostringstream render; + + if (type->is_base_type()) + { + t_base_type::t_base tbase = static_cast(type)->get_base(); + switch (tbase) + { + case t_base_type::TYPE_STRING: + render << '"' << get_escaped_string(value) << '"'; + break; + case t_base_type::TYPE_BOOL: + render << ((value->get_integer() > 0) ? "true" : "false"); + break; + case t_base_type::TYPE_I8: + case t_base_type::TYPE_I16: + case t_base_type::TYPE_I32: + case t_base_type::TYPE_I64: + render << value->get_integer(); + break; + case t_base_type::TYPE_DOUBLE: + if (value->get_type() == t_const_value::CV_INTEGER) + { + render << value->get_integer(); + } + else + { + render << value->get_double(); + } + break; + default: + throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase); + } + } + else if (type->is_enum()) + { + render << type->get_name() << "." << value->get_identifier_name(); + } + else + { + string t = tmp("tmp"); + print_const_value(out, t, type, value, true, true, true); + render << t; + } + + return render.str(); +} + +void t_netcore_generator::generate_struct(t_struct* tstruct) +{ + if (union_ && tstruct->is_union()) + { + generate_netcore_union(tstruct); + } + else + { + generate_netcore_struct(tstruct, false); + } +} + +void t_netcore_generator::generate_xception(t_struct* txception) +{ + generate_netcore_struct(txception, true); +} + +void t_netcore_generator::generate_netcore_struct(t_struct* tstruct, bool is_exception) +{ + int ic = indent_count(); + + string f_struct_name = namespace_dir_ + "/" + (tstruct->get_name()) + ".cs"; + ofstream f_struct; + + f_struct.open(f_struct_name.c_str()); + + f_struct << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl; + + generate_netcore_struct_definition(f_struct, tstruct, is_exception); + + f_struct.close(); + + if (indent_count() != ic) { pverbose("Wrong indent count in generate_netcore_struct. Difference: %i \n", (ic - indent_count())); } +} + +void t_netcore_generator::generate_netcore_struct_definition(ofstream& out, t_struct* tstruct, bool is_exception, bool in_class, bool is_result) +{ + if (!in_class) + { + start_netcore_namespace(out); + } + + out << endl; + + generate_netcore_doc(out, tstruct); + prepare_member_name_mapping(tstruct); + + if ((serialize_ || wcf_) && !is_exception) + { + out << indent() << "[DataContract(Namespace=\"" << wcf_namespace_ << "\")]" << endl; + } + + bool is_final = tstruct->annotations_.find("final") != tstruct->annotations_.end(); + + string sharp_struct_name = check_and_correct_struct_name(normalize_name(tstruct->get_name())); + + out << indent() << "public " << (is_final ? "sealed " : "") << "partial class " << sharp_struct_name << " : "; + + if (is_exception) + { + out << "TException, "; + } + + out << "TBase" << endl + << indent() << "{" << endl; + indent_up(); + + const vector& members = tstruct->get_members(); + vector::const_iterator m_iter; + + // make private members with public Properties + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + // if the field is requied, then we use auto-properties + if (!field_is_required((*m_iter)) && (!nullable_ || field_has_default((*m_iter)))) + { + out << indent() << "private " << declare_field(*m_iter, false, "_") << endl; + } + } + out << endl; + + bool has_non_required_fields = false; + bool has_non_required_default_value_fields = false; + bool has_required_fields = false; + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + generate_netcore_doc(out, *m_iter); + generate_property(out, *m_iter, true, true); + bool is_required = field_is_required((*m_iter)); + bool has_default = field_has_default((*m_iter)); + if (is_required) + { + has_required_fields = true; + } + else + { + if (has_default) + { + has_non_required_default_value_fields = true; + } + has_non_required_fields = true; + } + } + + bool generate_isset = (nullable_ && has_non_required_default_value_fields) || (!nullable_ && has_non_required_fields); + if (generate_isset) + { + out << endl; + if (serialize_ || wcf_) + { + out << indent() << "[DataMember(Order = 1)]" << endl; + } + out << indent() << "public Isset __isset;" << endl; + if (serialize_ || wcf_) + { + out << indent() << "[DataContract]" << endl; + } + + out << indent() << "public struct Isset" << endl + << indent() << "{" << endl; + indent_up(); + + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + bool is_required = field_is_required((*m_iter)); + bool has_default = field_has_default((*m_iter)); + // if it is required, don't need Isset for that variable + // if it is not required, if it has a default value, we need to generate Isset + // if we are not nullable, then we generate Isset + if (!is_required && (!nullable_ || has_default)) + { + if (serialize_ || wcf_) + { + out << indent() << "[DataMember]" << endl; + } + out << indent() << "public bool " << normalize_name((*m_iter)->get_name()) << ";" << endl; + } + } + + indent_down(); + out << indent() << "}" << endl << endl; + + if (generate_isset && (serialize_ || wcf_)) + { + out << indent() << "#region XmlSerializer support" << endl << endl; + + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + bool is_required = field_is_required(*m_iter); + bool has_default = field_has_default(*m_iter); + // if it is required, don't need Isset for that variable + // if it is not required, if it has a default value, we need to generate Isset + // if we are not nullable, then we generate Isset + if (!is_required && (!nullable_ || has_default)) + { + out << indent() << "public bool ShouldSerialize" << prop_name(*m_iter) << "()" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return __isset." << normalize_name((*m_iter)->get_name()) << ";" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + } + } + + out << indent() << "#endregion XmlSerializer support" << endl << endl; + } + } + + // We always want a default, no argument constructor for Reading + out << indent() << "public " << sharp_struct_name << "()" << endl + << indent() << "{" << endl; + indent_up(); + + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + t_type* t = (*m_iter)->get_type(); + while (t->is_typedef()) + { + t = static_cast(t)->get_type(); + } + if ((*m_iter)->get_value() != NULL) + { + if (field_is_required((*m_iter))) + { + print_const_value(out, "this." + prop_name(*m_iter), t, (*m_iter)->get_value(), true, true); + } + else + { + print_const_value(out, "this._" + (*m_iter)->get_name(), t, (*m_iter)->get_value(), true, true); + // Optionals with defaults are marked set + out << indent() << "this.__isset." << normalize_name((*m_iter)->get_name()) << " = true;" << endl; + } + } + } + indent_down(); + out << indent() << "}" << endl << endl; + + if (has_required_fields) + { + out << indent() << "public " << sharp_struct_name << "("; + bool first = true; + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + if (field_is_required(*m_iter)) + { + if (first) + { + first = false; + } + else + { + out << ", "; + } + out << type_name((*m_iter)->get_type()) << " " << (*m_iter)->get_name(); + } + } + out << ") : this()" << endl + << indent() << "{" << endl; + indent_up(); + + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + if (field_is_required(*m_iter)) + { + out << indent() << "this." << prop_name(*m_iter) << " = " << (*m_iter)->get_name() << ";" << endl; + } + } + + indent_down(); + out << indent() << "}" << endl << endl; + } + + generate_netcore_struct_reader(out, tstruct); + if (is_result) + { + generate_netcore_struct_result_writer(out, tstruct); + } + else + { + generate_netcore_struct_writer(out, tstruct); + } + if (hashcode_) + { + generate_netcore_struct_equals(out, tstruct); + generate_netcore_struct_hashcode(out, tstruct); + } + generate_netcore_struct_tostring(out, tstruct); + + indent_down(); + out << indent() << "}" << endl << endl; + + // generate a corresponding WCF fault to wrap the exception + if ((serialize_ || wcf_) && is_exception) + { + generate_netcore_wcffault(out, tstruct); + } + + cleanup_member_name_mapping(tstruct); + if (!in_class) + { + end_netcore_namespace(out); + } +} + +void t_netcore_generator::generate_netcore_wcffault(ofstream& out, t_struct* tstruct) +{ + out << endl; + out << indent() << "[DataContract]" << endl; + + bool is_final = tstruct->annotations_.find("final") != tstruct->annotations_.end(); + + out << indent() << "public " << (is_final ? "sealed " : "") << "partial class " << tstruct->get_name() << "Fault" << endl + << indent() << "{" << endl; + indent_up(); + + const vector& members = tstruct->get_members(); + vector::const_iterator m_iter; + + // make private members with public Properties + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + out << indent() << "private " << declare_field(*m_iter, false, "_") << endl; + } + out << endl; + + for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) + { + generate_property(out, *m_iter, true, false); + } + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_reader(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "iprot.IncrementRecursionDepth();" << endl + << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + + const vector& fields = tstruct->get_members(); + vector::const_iterator f_iter; + + // Required variables aren't in __isset, so we need tmp vars to check them + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (field_is_required(*f_iter)) + { + out << indent() << "bool isset_" << (*f_iter)->get_name() << " = false;" << endl; + } + } + + out << indent() << "TField field;" << endl + << indent() << "await iprot.ReadStructBeginAsync(cancellationToken);" << endl + << indent() << "while (true)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "field = await iprot.ReadFieldBeginAsync(cancellationToken);" << endl + << indent() << "if (field.Type == TType.Stop)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "break;" << endl; + indent_down(); + out << indent() << "}" << endl << endl + << indent() << "switch (field.ID)" << endl + << indent() << "{" << endl; + indent_up(); + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + bool is_required = field_is_required(*f_iter); + out << indent() << "case " << (*f_iter)->get_key() << ":" << endl; + indent_up(); + out << indent() << "if (field.Type == " << type_to_enum((*f_iter)->get_type()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + + generate_deserialize_field(out, *f_iter); + if (is_required) + { + out << indent() << "isset_" << (*f_iter)->get_name() << " = true;" << endl; + } + + indent_down(); + out << indent() << "}" << endl + << indent() << "else" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);" << endl; + indent_down(); + out << indent() << "}" << endl + << indent() << "break;" << endl; + indent_down(); + } + + out << indent() << "default: " << endl; + indent_up(); + out << indent() << "await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);" << endl + << indent() << "break;" << endl; + indent_down(); + indent_down(); + out << indent() << "}" << endl + << endl + << indent() << "await iprot.ReadFieldEndAsync(cancellationToken);" << endl; + indent_down(); + out << indent() << "}" << endl + << endl + << indent() << "await iprot.ReadStructEndAsync(cancellationToken);" << endl; + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (field_is_required((*f_iter))) + { + out << indent() << "if (!isset_" << (*f_iter)->get_name() << ")" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "throw new TProtocolException(TProtocolException.INVALID_DATA);" << endl; + indent_down(); + out << indent() << "}" << endl; + } + } + + indent_down(); + out << indent() << "}" << endl; + out << indent() << "finally" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "iprot.DecrementRecursionDepth();" << endl; + indent_down(); + out << indent() << "}" << endl; + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_writer(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "oprot.IncrementRecursionDepth();" << endl + << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + + string name = tstruct->get_name(); + const vector& fields = tstruct->get_sorted_members(); + vector::const_iterator f_iter; + + out << indent() << "var struc = new TStruct(\"" << name << "\");" << endl + << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl; + + if (fields.size() > 0) + { + out << indent() << "var field = new TField();" << endl; + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + bool is_required = field_is_required(*f_iter); + bool has_default = field_has_default(*f_iter); + if (nullable_ && !has_default && !is_required) + { + out << indent() << "if (" << prop_name(*f_iter) << " != null)" << endl + << indent() << "{" << endl; + indent_up(); + } + else if (!is_required) + { + bool null_allowed = type_can_be_null((*f_iter)->get_type()); + if (null_allowed) + { + out << indent() << "if (" << prop_name(*f_iter) << " != null && __isset." << normalize_name((*f_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + } + else + { + out << indent() << "if (__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + } + } + out << indent() << "field.Name = \"" << (*f_iter)->get_name() << "\";" << endl + << indent() << "field.Type = " << type_to_enum((*f_iter)->get_type()) << ";" << endl + << indent() << "field.ID = " << (*f_iter)->get_key() << ";" << endl + << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl; + + generate_serialize_field(out, *f_iter); + + out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl; + if (!is_required) + { + indent_down(); + out << indent() << "}" << endl; + } + } + } + + out << indent() << "await oprot.WriteFieldStopAsync(cancellationToken);" << endl + << indent() << "await oprot.WriteStructEndAsync(cancellationToken);" << endl; + indent_down(); + out << indent() << "}" << endl + << indent() << "finally" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "oprot.DecrementRecursionDepth();" << endl; + indent_down(); + out << indent() << "}" << endl; + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_result_writer(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "oprot.IncrementRecursionDepth();" << endl + << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + + string name = tstruct->get_name(); + const vector& fields = tstruct->get_sorted_members(); + vector::const_iterator f_iter; + + out << indent() << "var struc = new TStruct(\"" << name << "\");" << endl + << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl; + + if (fields.size() > 0) + { + out << indent() << "var field = new TField();" << endl; + bool first = true; + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (first) + { + first = false; + out << endl << indent() << "if"; + } + else + { + out << indent() << "else if"; + } + + if (nullable_) + { + out << "(this." << prop_name((*f_iter)) << " != null)" << endl + << indent() << "{" << endl; + } + else + { + out << "(this.__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + } + indent_up(); + + bool null_allowed = !nullable_ && type_can_be_null((*f_iter)->get_type()); + if (null_allowed) + { + out << indent() << "if (" << prop_name(*f_iter) << " != null)" << endl + << indent() << "{" << endl; + indent_up(); + } + + out << indent() << "field.Name = \"" << prop_name(*f_iter) << "\";" << endl + << indent() << "field.Type = " << type_to_enum((*f_iter)->get_type()) << ";" << endl + << indent() << "field.ID = " << (*f_iter)->get_key() << ";" << endl + << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl; + + generate_serialize_field(out, *f_iter); + + out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl; + + if (null_allowed) + { + indent_down(); + out << indent() << "}" << endl; + } + + indent_down(); + out << indent() << "}" << endl; + } + } + + out << indent() << "await oprot.WriteFieldStopAsync(cancellationToken);" << endl + << indent() << "await oprot.WriteStructEndAsync(cancellationToken);" << endl; + indent_down(); + out << indent() << "}" << endl + << indent() << "finally" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "oprot.DecrementRecursionDepth();" << endl; + indent_down(); + out << indent() << "}" << endl; + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_tostring(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public override string ToString()" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "var sb = new StringBuilder(\"" << tstruct->get_name() << "(\");" << endl; + + const vector& fields = tstruct->get_members(); + vector::const_iterator f_iter; + + bool useFirstFlag = false; + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (!field_is_required((*f_iter))) + { + out << indent() << "bool __first = true;" << endl; + useFirstFlag = true; + } + break; + } + + bool had_required = false; // set to true after first required field has been processed + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + bool is_required = field_is_required((*f_iter)); + bool has_default = field_has_default((*f_iter)); + if (nullable_ && !has_default && !is_required) + { + out << indent() << "if (" << prop_name((*f_iter)) << " != null)" << endl + << indent() << "{" << endl; + indent_up(); + } + else if (!is_required) + { + bool null_allowed = type_can_be_null((*f_iter)->get_type()); + if (null_allowed) + { + out << indent() << "if (" << prop_name((*f_iter)) << " != null && __isset." << normalize_name((*f_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + } + else + { + out << indent() << "if (__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + } + } + + if (useFirstFlag && (!had_required)) + { + out << indent() << "if(!__first) { sb.Append(\", \"); }" << endl; + if (!is_required) + { + out << indent() << "__first = false;" << endl; + } + out << indent() << "sb.Append(\"" << prop_name(*f_iter) << ": \");" << endl; + } + else + { + out << indent() << "sb.Append(\", " << prop_name(*f_iter) << ": \");" << endl; + } + + t_type* ttype = (*f_iter)->get_type(); + if (ttype->is_xception() || ttype->is_struct()) + { + out << indent() << "sb.Append(" << prop_name(*f_iter) << "== null ? \"\" : " << prop_name(*f_iter) << ".ToString());" << endl; + } + else + { + out << indent() << "sb.Append(" << prop_name(*f_iter) << ");" << endl; + } + + if (!is_required) + { + indent_down(); + out << indent() << "}" << endl; + } + else + { + had_required = true; // now __first must be false, so we don't need to check it anymore + } + } + + out << indent() << "sb.Append(\")\");" << endl + << indent() << "return sb.ToString();" << endl; + indent_down(); + out << indent() << "}" << endl; +} + +void t_netcore_generator::generate_netcore_union(t_struct* tunion) +{ + int ic = indent_count(); + + string f_union_name = namespace_dir_ + "/" + (tunion->get_name()) + ".cs"; + ofstream f_union; + + f_union.open(f_union_name.c_str()); + + f_union << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl; + + generate_netcore_union_definition(f_union, tunion); + + f_union.close(); + + if (indent_count() != ic) { pverbose("Wrong indent count in generate_netcore_union. Difference: %i \n", (ic - indent_count())); } +} + +void t_netcore_generator::generate_netcore_union_definition(ofstream& out, t_struct* tunion) +{ + // Let's define the class first + start_netcore_namespace(out); + + out << indent() << "public abstract partial class " << tunion->get_name() << " : TAbstractBase" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "public abstract void Write(TProtocol protocol);" << endl + << indent() << "public readonly bool Isset;" << endl + << indent() << "public abstract object Data { get; }" << endl + << indent() << "protected " << tunion->get_name() << "(bool isset)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "Isset = isset;" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + + out << indent() << "public class ___undefined : " << tunion->get_name() << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "public override object Data { get { return null; } }" << endl + << indent() << "public ___undefined() : base(false) {}" << endl << endl; + + out << indent() << "public override void Write(TProtocol protocol)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "throw new TProtocolException( TProtocolException.INVALID_DATA, \"Cannot persist an union type which is not set.\");" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + indent_down(); + out << indent() << "}" << endl << endl; + + const vector& fields = tunion->get_members(); + vector::const_iterator f_iter; + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + generate_netcore_union_class(out, tunion, (*f_iter)); + } + + generate_netcore_union_reader(out, tunion); + + indent_down(); + out << indent() << "}" << endl << endl; + + end_netcore_namespace(out); +} + +void t_netcore_generator::generate_netcore_union_class(ofstream& out, t_struct* tunion, t_field* tfield) +{ + out << indent() << "public class " << tfield->get_name() << " : " << tunion->get_name() << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "private " << type_name(tfield->get_type()) << " _data;" << endl + << indent() << "public override object Data { get { return _data; } }" << endl + << indent() << "public " << tfield->get_name() << "(" << type_name(tfield->get_type()) << " data) : base(true)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "this._data = data;" << endl; + indent_down(); + out << indent() << "}" << endl; + + out << indent() << "public override async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) {" << endl; + indent_up(); + + out << indent() << "oprot.IncrementRecursionDepth();" << endl + << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "var struc = new TStruct(\"" << tunion->get_name() << "\");" << endl + << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl; + + out << indent() << "var field = new TField();" << endl + << indent() << "field.Name = \"" << tfield->get_name() << "\";" << endl + << indent() << "field.Type = " << type_to_enum(tfield->get_type()) << ";" << endl + << indent() << "field.ID = " << tfield->get_key() << ";" << endl + << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl; + + generate_serialize_field(out, tfield, "_data", true, true); + + out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl + << indent() << "await oprot.WriteFieldStop(cancellationToken);" << endl + << indent() << "await oprot.WriteStructEnd(cancellationToken);" << endl; + indent_down(); + out << indent() << "}" << endl + << indent() << "finally" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "oprot.DecrementRecursionDepth();" << endl; + indent_down(); + out << indent() << "}" << endl; + out << indent() << "}" << endl; + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_equals(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public override bool Equals(object that)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "var other = that as " << type_name(tstruct) << ";" << endl + << indent() << "if (other == null) return false;" << endl + << indent() << "if (ReferenceEquals(this, other)) return true;" << endl; + + const vector& fields = tstruct->get_members(); + vector::const_iterator f_iter; + + bool first = true; + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (first) + { + first = false; + out << indent() << "return "; + indent_up(); + } + else + { + out << endl; + out << indent() << "&& "; + } + if (!field_is_required((*f_iter)) && !(nullable_ && !field_has_default((*f_iter)))) + { + out << "((__isset." << normalize_name((*f_iter)->get_name()) << " == other.__isset." + << normalize_name((*f_iter)->get_name()) << ") && ((!__isset." + << normalize_name((*f_iter)->get_name()) << ") || ("; + } + t_type* ttype = (*f_iter)->get_type(); + if (ttype->is_container() || (ttype->is_base_type() && (((t_base_type*)ttype)->is_binary()))) + { + out << "TCollections.Equals("; + } + else + { + out << "System.Object.Equals("; + } + out << prop_name((*f_iter)) << ", other." << prop_name((*f_iter)) << ")"; + if (!field_is_required((*f_iter)) && !(nullable_ && !field_has_default((*f_iter)))) + { + out << ")))"; + } + } + if (first) + { + out << indent() << "return true;" << endl; + } + else + { + out << ";" << endl; + indent_down(); + } + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_struct_hashcode(ofstream& out, t_struct* tstruct) +{ + out << indent() << "public override int GetHashCode() {" << endl; + indent_up(); + + out << indent() << "int hashcode = 0;" << endl; + out << indent() << "unchecked {" << endl; + indent_up(); + + const vector& fields = tstruct->get_members(); + vector::const_iterator f_iter; + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + t_type* ttype = (*f_iter)->get_type(); + out << indent() << "hashcode = (hashcode * 397) ^ "; + if (field_is_required((*f_iter))) + { + out << "("; + } + else if (nullable_) + { + out << "(" << prop_name((*f_iter)) << " == null ? 0 : "; + } + else + { + out << "(!__isset." << normalize_name((*f_iter)->get_name()) << " ? 0 : "; + } + if (ttype->is_container()) + { + out << "(TCollections.GetHashCode(" << prop_name((*f_iter)) << "))"; + } + else + { + out << "(" << prop_name((*f_iter)) << ".GetHashCode())"; + } + out << ");" << endl; + } + + indent_down(); + out << indent() << "}" << endl; + out << indent() << "return hashcode;" << endl; + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_service(t_service* tservice) +{ + int ic = indent_count(); + + string f_service_name = namespace_dir_ + "/" + service_name_ + ".cs"; + ofstream f_service; + f_service.open(f_service_name.c_str()); + + f_service << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl; + + reset_indent(); + + start_netcore_namespace(f_service); + + f_service << indent() << "public partial class " << normalize_name(service_name_) << endl + << indent() << "{" << endl; + indent_up(); + + generate_service_interface(f_service, tservice); + generate_service_client(f_service, tservice); + generate_service_server(f_service, tservice); + generate_service_helpers(f_service, tservice); + + indent_down(); + f_service << indent() << "}" << endl; + + end_netcore_namespace(f_service); + f_service.close(); + + if (indent_count() != ic) { pverbose("Wrong indent count in generate_service. Difference: %i \n", (ic - indent_count())); } +} + +void t_netcore_generator::generate_service_interface(ofstream& out, t_service* tservice) +{ + string extends = ""; + string extends_iface = ""; + if (tservice->get_extends() != NULL) + { + extends = type_name(tservice->get_extends()); + extends_iface = " : " + extends + ".IAsync"; + } + + //out << endl << endl; + + generate_netcore_doc(out, tservice); + + if (wcf_) + { + out << indent() << "[ServiceContract(Namespace=\"" << wcf_namespace_ << "\")]" << endl; + } + + out << indent() << "public interface IAsync" << extends_iface << endl + << indent() << "{" << endl; + + indent_up(); + vector functions = tservice->get_functions(); + vector::iterator f_iter; + for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) + { + generate_netcore_doc(out, *f_iter); + + // if we're using WCF, add the corresponding attributes + if (wcf_) + { + out << indent() << "[OperationContract]" << endl; + + const vector& xceptions = (*f_iter)->get_xceptions()->get_members(); + vector::const_iterator x_iter; + for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) + { + out << indent() << "[FaultContract(typeof(" + type_name((*x_iter)->get_type(), false, false) + "Fault))]" << endl; + } + } + + out << indent() << function_signature_async(*f_iter) << ";" << endl << endl; + } + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_service_helpers(ofstream& out, t_service* tservice) +{ + vector functions = tservice->get_functions(); + vector::iterator f_iter; + + for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) + { + t_struct* ts = (*f_iter)->get_arglist(); + generate_netcore_struct_definition(out, ts, false, true); + generate_function_helpers(out, *f_iter); + } +} + +void t_netcore_generator::generate_service_client(ofstream& out, t_service* tservice) +{ + string extends = ""; + string extends_client = ""; + if (tservice->get_extends() != NULL) + { + extends = type_name(tservice->get_extends()); + extends_client = extends + ".Client, "; + } + else + { + extends_client = "TBaseClient, IDisposable, "; + } + + out << endl; + + generate_netcore_doc(out, tservice); + + out << indent() << "public class Client : " << extends_client << "IAsync" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "public Client(TProtocol protocol) : this(protocol, protocol)" << endl + << indent() << "{" << endl + << indent() << "}" << endl + << endl + << indent() << "public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol)" + << indent() << "{" << endl + << indent() << "}" << endl; + + vector functions = tservice->get_functions(); + vector::const_iterator functions_iterator; + + for (functions_iterator = functions.begin(); functions_iterator != functions.end(); ++functions_iterator) + { + string function_name = correct_function_name_for_async((*functions_iterator)->get_name()); + + // async + out << indent() << "public async " << function_signature_async(*functions_iterator, "") << endl + << indent() << "{" << endl; + indent_up(); + + string argsname = (*functions_iterator)->get_name() + "Args"; + + out << indent() << "await OutputProtocol.WriteMessageBeginAsync(new TMessage(\"" << function_name + << "\", " << ((*functions_iterator)->is_oneway() ? "TMessageType.Oneway" : "TMessageType.Call") << ", SeqId), cancellationToken);" << endl + << indent() << endl + << indent() << "var args = new " << argsname << "();" << endl; + + t_struct* arg_struct = (*functions_iterator)->get_arglist(); + prepare_member_name_mapping(arg_struct); + const vector& fields = arg_struct->get_members(); + vector::const_iterator fld_iter; + + for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) + { + out << indent() << "args." << prop_name(*fld_iter) << " = " << normalize_name((*fld_iter)->get_name()) << ";" << endl; + } + + out << indent() << endl + << indent() << "await args.WriteAsync(OutputProtocol, cancellationToken);" << endl + << indent() << "await OutputProtocol.WriteMessageEndAsync(cancellationToken);" << endl + << indent() << "await OutputProtocol.Transport.FlushAsync(cancellationToken);" << endl; + + if (!(*functions_iterator)->is_oneway()) + { + string resultname = (*functions_iterator)->get_name() + "Result"; + t_struct noargs(program_); + t_struct* xs = (*functions_iterator)->get_xceptions(); + prepare_member_name_mapping(xs, xs->get_members(), resultname); + + out << indent() << endl + << indent() << "var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);" << endl + << indent() << "if (msg.Type == TMessageType.Exception)" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);" << endl + << indent() << "await InputProtocol.ReadMessageEndAsync(cancellationToken);" << endl + << indent() << "throw x;" << endl; + indent_down(); + + out << indent() << "}" << endl + << endl + << indent() << "var result = new " << resultname << "();" << endl + << indent() << "await result.ReadAsync(InputProtocol, cancellationToken);" << endl + << indent() << "await InputProtocol.ReadMessageEndAsync(cancellationToken);" << endl; + + if (!(*functions_iterator)->get_returntype()->is_void()) + { + if (nullable_) + { + if (type_can_be_null((*functions_iterator)->get_returntype())) + { + out << indent() << "if (result.Success != null)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return result.Success;" << endl; + indent_down(); + out << indent() << "}" << endl; + } + else + { + out << indent() << "if (result.Success.HasValue)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return result.Success.Value;" << endl; + indent_down(); + out << indent() << "}" << endl; + } + } + else + { + out << indent() << "if (result.__isset.success)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return result.Success;" << endl; + indent_down(); + out << indent() << "}" << endl; + } + } + + const vector& xceptions = xs->get_members(); + vector::const_iterator x_iter; + for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) + { + if (nullable_) + { + out << indent() << "if (result." << prop_name(*x_iter) << " != null)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "throw result." << prop_name(*x_iter) << ";" << endl; + indent_down(); + out << indent() << "}" << endl; + } + else + { + out << indent() << "if (result.__isset." << normalize_name((*x_iter)->get_name()) << ")" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "throw result." << prop_name(*x_iter) << ";" << endl; + indent_down(); + out << indent() << "}" << endl; + } + } + + if ((*functions_iterator)->get_returntype()->is_void()) + { + out << indent() << "return;" << endl; + } + else + { + out << indent() << "throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, \"" + << function_name << " failed: unknown result\");" << endl; + } + + cleanup_member_name_mapping((*functions_iterator)->get_xceptions()); + indent_down(); + out << indent() << "}" << endl << endl; + } + else + { + indent_down(); + out << indent() << "}" << endl; + } + } + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_service_server(ofstream& out, t_service* tservice) +{ + vector functions = tservice->get_functions(); + vector::iterator f_iter; + + string extends = ""; + string extends_processor = ""; + if (tservice->get_extends() != NULL) + { + extends = type_name(tservice->get_extends()); + extends_processor = extends + ".AsyncProcessor, "; + } + + out << indent() << "public class AsyncProcessor : " << extends_processor << "ITAsyncProcessor" << endl + << indent() << "{" << endl; + + indent_up(); + + out << indent() << "private IAsync _iAsync;" << endl + << endl + << indent() << "public AsyncProcessor(IAsync iAsync)"; + + if (!extends.empty()) + { + out << " : base(iAsync)"; + } + + out << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "if (iAsync == null) throw new ArgumentNullException(nameof(iAsync));" << endl + << endl + << indent() << "_iAsync = iAsync;" << endl; + + for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) + { + string function_name = (*f_iter)->get_name(); + out << indent() << "processMap_[\"" << correct_function_name_for_async(function_name) << "\"] = " << function_name << "_ProcessAsync;" << endl; + } + + indent_down(); + out << indent() << "}" << endl + << endl; + + if (extends.empty()) + { + out << indent() << "protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken);" << endl; + } + + if (extends.empty()) + { + out << indent() << "protected Dictionary processMap_ = new Dictionary();" << endl; + } + + out << endl; + + if (extends.empty()) + { + out << indent() << "public async Task ProcessAsync(TProtocol iprot, TProtocol oprot)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return await ProcessAsync(iprot, oprot, CancellationToken.None);" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + + out << indent() << "public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl; + } + else + { + out << indent() << "public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return await ProcessAsync(iprot, oprot, CancellationToken.None);" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + + out << indent() << "public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl; + } + + out << indent() << "{" << endl; + indent_up(); + out << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "var msg = await iprot.ReadMessageBeginAsync(cancellationToken);" << endl + << endl + << indent() << "ProcessFunction fn;" << endl + << indent() << "processMap_.TryGetValue(msg.Name, out fn);" << endl + << endl + << indent() << "if (fn == null)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken);" << endl + << indent() << "await iprot.ReadMessageEndAsync(cancellationToken);" << endl + << indent() << "var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, \"Invalid method name: '\" + msg.Name + \"'\");" << endl + << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken);" << endl + << indent() << "await x.WriteAsync(oprot, cancellationToken);" << endl + << indent() << "await oprot.WriteMessageEndAsync(cancellationToken);" << endl + << indent() << "await oprot.Transport.FlushAsync(cancellationToken);" << endl + << indent() << "return true;" << endl; + indent_down(); + out << indent() << "}" << endl + << endl + << indent() << "await fn(msg.SeqID, iprot, oprot, cancellationToken);" << endl + << endl; + indent_down(); + out << indent() << "}" << endl; + out << indent() << "catch (IOException)" << endl + << indent() << "{" << endl; + indent_up(); + out << indent() << "return false;" << endl; + indent_down(); + out << indent() << "}" << endl + << endl + << indent() << "return true;" << endl; + indent_down(); + out << indent() << "}" << endl << endl; + + for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) + { + generate_process_function_async(out, tservice, *f_iter); + } + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_function_helpers(ofstream& out, t_function* tfunction) +{ + if (tfunction->is_oneway()) + { + return; + } + + t_struct result(program_, tfunction->get_name() + "_result"); + t_field success(tfunction->get_returntype(), "success", 0); + if (!tfunction->get_returntype()->is_void()) + { + result.append(&success); + } + + t_struct* xs = tfunction->get_xceptions(); + const vector& fields = xs->get_members(); + vector::const_iterator f_iter; + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + result.append(*f_iter); + } + + generate_netcore_struct_definition(out, &result, false, true, true); +} + +void t_netcore_generator::generate_process_function_async(ofstream& out, t_service* tservice, t_function* tfunction) +{ + (void)tservice; + out << indent() << "public async Task " << tfunction->get_name() + << "_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl + << indent() << "{" << endl; + indent_up(); + + string argsname = tfunction->get_name() + "Args"; + string resultname = tfunction->get_name() + "Result"; + + out << indent() << "var args = new " << argsname << "();" << endl + << indent() << "await args.ReadAsync(iprot, cancellationToken);" << endl + << indent() << "await iprot.ReadMessageEndAsync(cancellationToken);" << endl; + + if (!tfunction->is_oneway()) + { + out << indent() << "var result = new " << resultname << "();" << endl; + } + + out << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + + t_struct* xs = tfunction->get_xceptions(); + const vector& xceptions = xs->get_members(); + + if (xceptions.size() > 0) + { + out << indent() << "try" << endl + << indent() << "{" << endl; + indent_up(); + } + + t_struct* arg_struct = tfunction->get_arglist(); + const vector& fields = arg_struct->get_members(); + vector::const_iterator f_iter; + + out << indent(); + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) + { + out << "result.Success = "; + } + + out << "await _iAsync." << normalize_name(tfunction->get_name()) << "Async("; + + bool first = true; + prepare_member_name_mapping(arg_struct); + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (first) + { + first = false; + } + else + { + out << ", "; + } + + out << "args." << prop_name(*f_iter); + if (nullable_ && !type_can_be_null((*f_iter)->get_type())) + { + out << ".Value"; + } + } + + cleanup_member_name_mapping(arg_struct); + + if (!first) + { + out << ", "; + } + + out << "cancellationToken);" << endl; + + vector::const_iterator x_iter; + + prepare_member_name_mapping(xs, xs->get_members(), resultname); + if (xceptions.size() > 0) + { + indent_down(); + out << indent() << "}" << endl; + + for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) + { + out << indent() << "catch (" << type_name((*x_iter)->get_type(), false, false) << " " << (*x_iter)->get_name() << ")" << endl + << indent() << "{" << endl; + + if (!tfunction->is_oneway()) + { + indent_up(); + out << indent() << "result." << prop_name(*x_iter) << " = " << (*x_iter)->get_name() << ";" << endl; + indent_down(); + } + out << indent() << "}" << endl; + } + } + + if (!tfunction->is_oneway()) + { + out << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(\"" + << correct_function_name_for_async(tfunction->get_name()) << "\", TMessageType.Reply, seqid), cancellationToken); " << endl + << indent() << "await result.WriteAsync(oprot, cancellationToken);" << endl; + } + indent_down(); + + cleanup_member_name_mapping(xs); + + out << indent() << "}" << endl + << indent() << "catch (TTransportException)" << endl + << indent() << "{" << endl + << indent() << " throw;" << endl + << indent() << "}" << endl + << indent() << "catch (Exception ex)" << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "Console.Error.WriteLine(\"Error occurred in processor:\");" << endl + << indent() << "Console.Error.WriteLine(ex.ToString());" << endl; + + if (tfunction->is_oneway()) + { + indent_down(); + out << indent() << "}" << endl; + } + else + { + out << indent() << "var x = new TApplicationException(TApplicationException.ExceptionType.InternalError,\" Internal error.\");" << endl + << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(\"" << correct_function_name_for_async(tfunction->get_name()) + << "\", TMessageType.Exception, seqid), cancellationToken);" << endl + << indent() << "await x.WriteAsync(oprot, cancellationToken);" << endl; + indent_down(); + + out << indent() << "}" << endl + << indent() << "await oprot.WriteMessageEndAsync(cancellationToken);" << endl + << indent() << "await oprot.Transport.FlushAsync(cancellationToken);" << endl; + } + + indent_down(); + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_netcore_union_reader(ofstream& out, t_struct* tunion) +{ + // Thanks to THRIFT-1768, we don't need to check for required fields in the union + const vector& fields = tunion->get_members(); + vector::const_iterator f_iter; + + out << indent() << "public static " << tunion->get_name() << " Read(TProtocol iprot)" << endl; + scope_up(out); + + out << indent() << "iprot.IncrementRecursionDepth();" << endl; + out << indent() << "try" << endl; + scope_up(out); + + out << indent() << tunion->get_name() << " retval;" << endl; + out << indent() << "iprot.ReadStructBegin();" << endl; + out << indent() << "TField field = iprot.ReadFieldBegin();" << endl; + // we cannot have the first field be a stop -- we must have a single field defined + out << indent() << "if (field.Type == TType.Stop)" << endl; + scope_up(out); + out << indent() << "iprot.ReadFieldEnd();" << endl; + out << indent() << "retval = new ___undefined();" << endl; + scope_down(out); + out << indent() << "else" << endl; + scope_up(out); + out << indent() << "switch (field.ID)" << endl; + scope_up(out); + + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + out << indent() << "case " << (*f_iter)->get_key() << ":" << endl; + indent_up(); + out << indent() << "if (field.Type == " << type_to_enum((*f_iter)->get_type()) << ") {" << endl; + indent_up(); + + out << indent() << type_name((*f_iter)->get_type()) << " temp;" << endl; + generate_deserialize_field(out, (*f_iter), "temp", true); + out << indent() << "retval = new " << (*f_iter)->get_name() << "(temp);" << endl; + + indent_down(); + out << indent() << "} else { " << endl << indent() << " TProtocolUtil.Skip(iprot, field.Type);" + << endl << indent() << " retval = new ___undefined();" << endl << indent() << "}" << endl + << indent() << "break;" << endl; + indent_down(); + } + + out << indent() << "default: " << endl; + indent_up(); + out << indent() << "TProtocolUtil.Skip(iprot, field.Type);" << endl << indent() + << "retval = new ___undefined();" << endl; + out << indent() << "break;" << endl; + indent_down(); + + scope_down(out); + + out << indent() << "iprot.ReadFieldEnd();" << endl; + + out << indent() << "if (iprot.ReadFieldBegin().Type != TType.Stop)" << endl; + scope_up(out); + out << indent() << "throw new TProtocolException(TProtocolException.INVALID_DATA);" << endl; + scope_down(out); + + // end of else for TStop + scope_down(out); + out << indent() << "iprot.ReadStructEnd();" << endl; + out << indent() << "return retval;" << endl; + indent_down(); + + scope_down(out); + out << indent() << "finally" << endl; + scope_up(out); + out << indent() << "iprot.DecrementRecursionDepth();" << endl; + scope_down(out); + + out << indent() << "}" << endl << endl; +} + +void t_netcore_generator::generate_deserialize_field(ofstream& out, t_field* tfield, string prefix, bool is_propertyless) +{ + t_type* type = tfield->get_type(); + while (type->is_typedef()) + { + type = static_cast(type)->get_type(); + } + + if (type->is_void()) + { + throw "CANNOT GENERATE DESERIALIZE CODE FOR void TYPE: " + prefix + tfield->get_name(); + } + + string name = prefix + (is_propertyless ? "" : prop_name(tfield)); + + if (type->is_struct() || type->is_xception()) + { + generate_deserialize_struct(out, static_cast(type), name); + } + else if (type->is_container()) + { + generate_deserialize_container(out, type, name); + } + else if (type->is_base_type() || type->is_enum()) + { + out << indent() << name << " = "; + + if (type->is_enum()) + { + out << "(" << type_name(type, false, true) << ")"; + } + + out << "await iprot."; + + if (type->is_base_type()) + { + t_base_type::t_base tbase = static_cast(type)->get_base(); + switch (tbase) + { + case t_base_type::TYPE_VOID: + throw "compiler error: cannot serialize void field in a struct: " + name; + break; + case t_base_type::TYPE_STRING: + if (static_cast(type)->is_binary()) + { + out << "ReadBinaryAsync(cancellationToken);"; + } + else + { + out << "ReadStringAsync(cancellationToken);"; + } + break; + case t_base_type::TYPE_BOOL: + out << "ReadBoolAsync(cancellationToken);"; + break; + case t_base_type::TYPE_I8: + out << "ReadByteAsync(cancellationToken);"; + break; + case t_base_type::TYPE_I16: + out << "ReadI16Async(cancellationToken);"; + break; + case t_base_type::TYPE_I32: + out << "ReadI32Async(cancellationToken);"; + break; + case t_base_type::TYPE_I64: + out << "ReadI64Async(cancellationToken);"; + break; + case t_base_type::TYPE_DOUBLE: + out << "ReadDoubleAsync(cancellationToken);"; + break; + default: + throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase); + } + } + else if (type->is_enum()) + { + out << "ReadI32Async(cancellationToken);"; + } + out << endl; + } + else + { + printf("DO NOT KNOW HOW TO DESERIALIZE FIELD '%s' TYPE '%s'\n", tfield->get_name().c_str(), type_name(type).c_str()); + } +} + +void t_netcore_generator::generate_deserialize_struct(ofstream& out, t_struct* tstruct, string prefix) +{ + if (union_ && tstruct->is_union()) + { + out << indent() << prefix << " = await " << type_name(tstruct) << ".ReadAsync(iprot, cancellationToken);" << endl; + } + else + { + out << indent() << prefix << " = new " << type_name(tstruct) << "();" << endl + << indent() << "await " << prefix << ".ReadAsync(iprot, cancellationToken);" << endl; + } +} + +void t_netcore_generator::generate_deserialize_container(ofstream& out, t_type* ttype, string prefix) +{ + out << indent() << "{" << endl; + indent_up(); + + string obj; + + if (ttype->is_map()) + { + obj = tmp("_map"); + } + else if (ttype->is_set()) + { + obj = tmp("_set"); + } + else if (ttype->is_list()) + { + obj = tmp("_list"); + } + + out << indent() << prefix << " = new " << type_name(ttype, false, true) << "();" << endl; + if (ttype->is_map()) + { + out << indent() << "TMap " << obj << " = await iprot.ReadMapBeginAsync(cancellationToken);" << endl; + } + else if (ttype->is_set()) + { + out << indent() << "TSet " << obj << " = await iprot.ReadSetBeginAsync(cancellationToken);" << endl; + } + else if (ttype->is_list()) + { + out << indent() << "TList " << obj << " = await iprot.ReadListBeginAsync(cancellationToken);" << endl; + } + + string i = tmp("_i"); + out << indent() << "for(int " << i << " = 0; " << i << " < " << obj << ".Count; ++" << i << ")" << endl + << indent() << "{" << endl; + indent_up(); + + if (ttype->is_map()) + { + generate_deserialize_map_element(out, static_cast(ttype), prefix); + } + else if (ttype->is_set()) + { + generate_deserialize_set_element(out, static_cast(ttype), prefix); + } + else if (ttype->is_list()) + { + generate_deserialize_list_element(out, static_cast(ttype), prefix); + } + + indent_down(); + out << indent() << "}" << endl; + + if (ttype->is_map()) + { + out << indent() << "await iprot.ReadMapEndAsync(cancellationToken);" << endl; + } + else if (ttype->is_set()) + { + out << indent() << "await iprot.ReadSetEndAsync(cancellationToken);" << endl; + } + else if (ttype->is_list()) + { + out << indent() << "await iprot.ReadListEndAsync(cancellationToken);" << endl; + } + + indent_down(); + out << indent() << "}" << endl; +} + +void t_netcore_generator::generate_deserialize_map_element(ofstream& out, t_map* tmap, string prefix) +{ + string key = tmp("_key"); + string val = tmp("_val"); + + t_field fkey(tmap->get_key_type(), key); + t_field fval(tmap->get_val_type(), val); + + out << indent() << declare_field(&fkey) << endl; + out << indent() << declare_field(&fval) << endl; + + generate_deserialize_field(out, &fkey); + generate_deserialize_field(out, &fval); + + out << indent() << prefix << "[" << key << "] = " << val << ";" << endl; +} + +void t_netcore_generator::generate_deserialize_set_element(ofstream& out, t_set* tset, string prefix) +{ + string elem = tmp("_elem"); + t_field felem(tset->get_elem_type(), elem); + + out << indent() << declare_field(&felem) << endl; + + generate_deserialize_field(out, &felem); + + out << indent() << prefix << ".Add(" << elem << ");" << endl; +} + +void t_netcore_generator::generate_deserialize_list_element(ofstream& out, t_list* tlist, string prefix) +{ + string elem = tmp("_elem"); + t_field felem(tlist->get_elem_type(), elem); + + out << indent() << declare_field(&felem) << endl; + + generate_deserialize_field(out, &felem); + + out << indent() << prefix << ".Add(" << elem << ");" << endl; +} + +void t_netcore_generator::generate_serialize_field(ofstream& out, t_field* tfield, string prefix, bool is_element, bool is_propertyless) +{ + t_type* type = tfield->get_type(); + while (type->is_typedef()) + { + type = static_cast(type)->get_type(); + } + + string name = prefix + (is_propertyless ? "" : prop_name(tfield)); + + if (type->is_void()) + { + throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + name; + } + + if (type->is_struct() || type->is_xception()) + { + generate_serialize_struct(out, static_cast(type), name); + } + else if (type->is_container()) + { + generate_serialize_container(out, type, name); + } + else if (type->is_base_type() || type->is_enum()) + { + out << indent() << "await oprot."; + + string nullable_name = nullable_ && !is_element && !field_is_required(tfield) ? name + ".Value" : name; + + if (type->is_base_type()) + { + t_base_type::t_base tbase = static_cast(type)->get_base(); + switch (tbase) + { + case t_base_type::TYPE_VOID: + throw "compiler error: cannot serialize void field in a struct: " + name; + case t_base_type::TYPE_STRING: + if (static_cast(type)->is_binary()) + { + out << "WriteBinaryAsync("; + } + else + { + out << "WriteStringAsync("; + } + out << name << ", cancellationToken);"; + break; + case t_base_type::TYPE_BOOL: + out << "WriteBoolAsync(" << nullable_name << ", cancellationToken);"; + break; + case t_base_type::TYPE_I8: + out << "WriteByteAsync(" << nullable_name << ", cancellationToken);"; + break; + case t_base_type::TYPE_I16: + out << "WriteI16Async(" << nullable_name << ", cancellationToken);"; + break; + case t_base_type::TYPE_I32: + out << "WriteI32Async(" << nullable_name << ", cancellationToken);"; + break; + case t_base_type::TYPE_I64: + out << "WriteI64Async(" << nullable_name << ", cancellationToken);"; + break; + case t_base_type::TYPE_DOUBLE: + out << "WriteDoubleAsync(" << nullable_name << ", cancellationToken);"; + break; + default: + throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase); + } + } + else if (type->is_enum()) + { + out << "WriteI32Async((int)" << nullable_name << ", cancellationToken);"; + } + out << endl; + } + else + { + printf("DO NOT KNOW HOW TO SERIALIZE '%s%s' TYPE '%s'\n", prefix.c_str(), tfield->get_name().c_str(), type_name(type).c_str()); + } +} + +void t_netcore_generator::generate_serialize_struct(ofstream& out, t_struct* tstruct, string prefix) +{ + (void)tstruct; + out << indent() << "await " << prefix << ".WriteAsync(oprot, cancellationToken);" << endl; +} + +void t_netcore_generator::generate_serialize_container(ofstream& out, t_type* ttype, string prefix) +{ + out << indent() << "{" << endl; + indent_up(); + + if (ttype->is_map()) + { + out << indent() << "await oprot.WriteMapBeginAsync(new TMap(" << type_to_enum(static_cast(ttype)->get_key_type()) + << ", " << type_to_enum(static_cast(ttype)->get_val_type()) << ", " << prefix + << ".Count), cancellationToken);" << endl; + } + else if (ttype->is_set()) + { + out << indent() << "await oprot.WriteSetBeginAsync(new TSet(" << type_to_enum(static_cast(ttype)->get_elem_type()) + << ", " << prefix << ".Count), cancellationToken);" << endl; + } + else if (ttype->is_list()) + { + out << indent() << "await oprot.WriteListBeginAsync(new TList(" + << type_to_enum(static_cast(ttype)->get_elem_type()) << ", " << prefix << ".Count), cancellationToken);" + << endl; + } + + string iter = tmp("_iter"); + if (ttype->is_map()) + { + out << indent() << "foreach (" << type_name(static_cast(ttype)->get_key_type()) << " " << iter + << " in " << prefix << ".Keys)"; + } + else if (ttype->is_set()) + { + out << indent() << "foreach (" << type_name(static_cast(ttype)->get_elem_type()) << " " << iter + << " in " << prefix << ")"; + } + else if (ttype->is_list()) + { + out << indent() << "foreach (" << type_name(static_cast(ttype)->get_elem_type()) << " " << iter + << " in " << prefix << ")"; + } + + out << endl; + out << indent() << "{" << endl; + indent_up(); + + if (ttype->is_map()) + { + generate_serialize_map_element(out, static_cast(ttype), iter, prefix); + } + else if (ttype->is_set()) + { + generate_serialize_set_element(out, static_cast(ttype), iter); + } + else if (ttype->is_list()) + { + generate_serialize_list_element(out, static_cast(ttype), iter); + } + + indent_down(); + out << indent() << "}" << endl; + + if (ttype->is_map()) + { + out << indent() << "await oprot.WriteMapEndAsync(cancellationToken);" << endl; + } + else if (ttype->is_set()) + { + out << indent() << "await oprot.WriteSetEndAsync(cancellationToken);" << endl; + } + else if (ttype->is_list()) + { + out << indent() << "await oprot.WriteListEndAsync(cancellationToken);" << endl; + } + + indent_down(); + out << indent() << "}" << endl; +} + +void t_netcore_generator::generate_serialize_map_element(ofstream& out, t_map* tmap, string iter, string map) +{ + t_field kfield(tmap->get_key_type(), iter); + generate_serialize_field(out, &kfield, "", true); + t_field vfield(tmap->get_val_type(), map + "[" + iter + "]"); + generate_serialize_field(out, &vfield, "", true); +} + +void t_netcore_generator::generate_serialize_set_element(ofstream& out, t_set* tset, string iter) +{ + t_field efield(tset->get_elem_type(), iter); + generate_serialize_field(out, &efield, "", true); +} + +void t_netcore_generator::generate_serialize_list_element(ofstream& out, t_list* tlist, string iter) +{ + t_field efield(tlist->get_elem_type(), iter); + generate_serialize_field(out, &efield, "", true); +} + +void t_netcore_generator::generate_property(ofstream& out, t_field* tfield, bool isPublic, bool generateIsset) +{ + generate_netcore_property(out, tfield, isPublic, generateIsset, "_"); +} + +void t_netcore_generator::generate_netcore_property(ofstream& out, t_field* tfield, bool isPublic, bool generateIsset, string fieldPrefix) +{ + if ((serialize_ || wcf_) && isPublic) + { + out << indent() << "[DataMember(Order = 0)]" << endl; + } + bool has_default = field_has_default(tfield); + bool is_required = field_is_required(tfield); + if (nullable_ && !has_default || is_required) + { + out << indent() << (isPublic ? "public " : "private ") << type_name(tfield->get_type(), false, false, true, is_required) << " " << prop_name(tfield) << " { get; set; }" << endl; + } + else + { + out << indent() << (isPublic ? "public " : "private ") << type_name(tfield->get_type(), false, false, true) << " " << prop_name(tfield) << endl + << indent() << "{" << endl; + indent_up(); + + out << indent() << "get" << endl + << indent() << "{" << endl; + indent_up(); + + bool use_nullable = false; + if (nullable_) + { + t_type* ttype = tfield->get_type(); + while (ttype->is_typedef()) + { + ttype = static_cast(ttype)->get_type(); + } + if (ttype->is_base_type()) + { + use_nullable = static_cast(ttype)->get_base() != t_base_type::TYPE_STRING; + } + } + + out << indent() << "return " << fieldPrefix + tfield->get_name() << ";" << endl; + indent_down(); + out << indent() << "}" << endl + << indent() << "set" << endl + << indent() << "{" << endl; + indent_up(); + + if (use_nullable) + { + if (generateIsset) + { + out << indent() << "__isset." << normalize_name(tfield->get_name()) << " = value.HasValue;" << endl; + } + out << indent() << "if (value.HasValue) this." << fieldPrefix + tfield->get_name() << " = value.Value;" << endl; + } + else + { + if (generateIsset) + { + out << indent() << "__isset." << normalize_name(tfield->get_name()) << " = true;" << endl; + } + out << indent() << "this." << fieldPrefix + tfield->get_name() << " = value;" << endl; + } + + indent_down(); + out << indent() << "}" << endl; + indent_down(); + out << indent() << "}" << endl; + } + out << endl; +} + +string t_netcore_generator::make_valid_csharp_identifier(string const& fromName) +{ + string str = fromName; + if (str.empty()) + { + return str; + } + + // tests rely on this + assert(('A' < 'Z') && ('a' < 'z') && ('0' < '9')); + + // if the first letter is a number, we add an additional underscore in front of it + char c = str.at(0); + if (('0' <= c) && (c <= '9')) + { + str = "_" + str; + } + + // following chars: letter, number or underscore + for (size_t i = 0; i < str.size(); ++i) + { + c = str.at(i); + if (('A' > c || c > 'Z') && ('a' > c || c > 'z') && ('0' > c || c > '9') && '_' != c) + { + str.replace(i, 1, "_"); + } + } + + return str; +} + +void t_netcore_generator::cleanup_member_name_mapping(void* scope) +{ + if (member_mapping_scopes.empty()) + { + throw "internal error: cleanup_member_name_mapping() no scope active"; + } + + member_mapping_scope& active = member_mapping_scopes.back(); + if (active.scope_member != scope) + { + throw "internal error: cleanup_member_name_mapping() called for wrong struct"; + } + + member_mapping_scopes.pop_back(); +} + +string t_netcore_generator::get_mapped_member_name(string name) +{ + if (!member_mapping_scopes.empty()) + { + member_mapping_scope& active = member_mapping_scopes.back(); + map::iterator iter = active.mapping_table.find(name); + if (active.mapping_table.end() != iter) + { + return iter->second; + } + } + + pverbose("no mapping for member %s\n", name.c_str()); + return name; +} + +void t_netcore_generator::prepare_member_name_mapping(t_struct* tstruct) +{ + prepare_member_name_mapping(tstruct, tstruct->get_members(), tstruct->get_name()); +} + +void t_netcore_generator::prepare_member_name_mapping(void* scope, const vector& members, const string& structname) +{ + // begin new scope + member_mapping_scope dummy; + member_mapping_scopes.push_back(dummy); + member_mapping_scope& active = member_mapping_scopes.back(); + active.scope_member = scope; + + // current C# generator policy: + // - prop names are always rendered with an Uppercase first letter + // - struct names are used as given + std::set used_member_names; + vector::const_iterator iter; + + // prevent name conflicts with struct (CS0542 error) + used_member_names.insert(structname); + + // prevent name conflicts with known methods (THRIFT-2942) + used_member_names.insert("Read"); + used_member_names.insert("Write"); + + for (iter = members.begin(); iter != members.end(); ++iter) + { + string oldname = (*iter)->get_name(); + string newname = prop_name(*iter, true); + while (true) + { + // new name conflicts with another member + if (used_member_names.find(newname) != used_member_names.end()) + { + pverbose("struct %s: member %s conflicts with another member\n", structname.c_str(), newname.c_str()); + newname += '_'; + continue; + } + + // add always, this helps us to detect edge cases like + // different spellings ("foo" and "Foo") within the same struct + pverbose("struct %s: member mapping %s => %s\n", structname.c_str(), oldname.c_str(), newname.c_str()); + active.mapping_table[oldname] = newname; + used_member_names.insert(newname); + break; + } + } +} + +string t_netcore_generator::prop_name(t_field* tfield, bool suppress_mapping) +{ + string name(tfield->get_name()); + if (suppress_mapping) + { + name[0] = toupper(name[0]); + } + else + { + name = get_mapped_member_name(name); + } + return name; +} + +string t_netcore_generator::type_name(t_type* ttype, bool in_container, bool in_init, bool in_param, bool is_required) +{ + (void)in_init; + + while (ttype->is_typedef()) + { + ttype = static_cast(ttype)->get_type(); + } + + if (ttype->is_base_type()) + { + return base_type_name(static_cast(ttype), in_container, in_param, is_required); + } + + if (ttype->is_map()) + { + t_map* tmap = static_cast(ttype); + return "Dictionary<" + type_name(tmap->get_key_type(), true) + ", " + type_name(tmap->get_val_type(), true) + ">"; + } + + if (ttype->is_set()) + { + t_set* tset = static_cast(ttype); + return "THashSet<" + type_name(tset->get_elem_type(), true) + ">"; + } + + if (ttype->is_list()) + { + t_list* tlist = static_cast(ttype); + return "List<" + type_name(tlist->get_elem_type(), true) + ">"; + } + + t_program* program = ttype->get_program(); + string postfix = (!is_required && nullable_ && in_param && ttype->is_enum()) ? "?" : ""; + if (program != NULL && program != program_) + { + string ns = program->get_namespace("netcore"); + if (!ns.empty()) + { + return ns + "." + normalize_name(ttype->get_name()) + postfix; + } + } + + return normalize_name(ttype->get_name()) + postfix; +} + +string t_netcore_generator::base_type_name(t_base_type* tbase, bool in_container, bool in_param, bool is_required) +{ + (void)in_container; + string postfix = (!is_required && nullable_ && in_param) ? "?" : ""; + switch (tbase->get_base()) + { + case t_base_type::TYPE_VOID: + return "void"; + case t_base_type::TYPE_STRING: + { + if (tbase->is_binary()) + { + return "byte[]"; + } + return "string"; + } + case t_base_type::TYPE_BOOL: + return "bool" + postfix; + case t_base_type::TYPE_I8: + return "sbyte" + postfix; + case t_base_type::TYPE_I16: + return "short" + postfix; + case t_base_type::TYPE_I32: + return "int" + postfix; + case t_base_type::TYPE_I64: + return "long" + postfix; + case t_base_type::TYPE_DOUBLE: + return "double" + postfix; + default: + throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase->get_base()); + } +} + +string t_netcore_generator::declare_field(t_field* tfield, bool init, string prefix) +{ + string result = type_name(tfield->get_type()) + " " + prefix + tfield->get_name(); + if (init) + { + t_type* ttype = tfield->get_type(); + while (ttype->is_typedef()) + { + ttype = static_cast(ttype)->get_type(); + } + if (ttype->is_base_type() && field_has_default(tfield)) + { + ofstream dummy; + result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value()); + } + else if (ttype->is_base_type()) + { + t_base_type::t_base tbase = static_cast(ttype)->get_base(); + switch (tbase) + { + case t_base_type::TYPE_VOID: + throw "NO T_VOID CONSTRUCT"; + case t_base_type::TYPE_STRING: + result += " = null"; + break; + case t_base_type::TYPE_BOOL: + result += " = false"; + break; + case t_base_type::TYPE_I8: + case t_base_type::TYPE_I16: + case t_base_type::TYPE_I32: + case t_base_type::TYPE_I64: + result += " = 0"; + break; + case t_base_type::TYPE_DOUBLE: + result += " = (double)0"; + break; + } + } + else if (ttype->is_enum()) + { + result += " = (" + type_name(ttype, false, true) + ")0"; + } + else if (ttype->is_container()) + { + result += " = new " + type_name(ttype, false, true) + "()"; + } + else + { + result += " = new " + type_name(ttype, false, true) + "()"; + } + } + return result + ";"; +} + +string t_netcore_generator::function_signature(t_function* tfunction, string prefix) +{ + t_type* ttype = tfunction->get_returntype(); + return type_name(ttype) + " " + normalize_name(prefix + tfunction->get_name()) + "(" + argument_list(tfunction->get_arglist()) + ")"; +} + +string t_netcore_generator::function_signature_async(t_function* tfunction, string prefix) +{ + t_type* ttype = tfunction->get_returntype(); + string task = "Task"; + if (!ttype->is_void()) + { + task += "<" + type_name(ttype) + ">"; + } + + string result = task + " " + normalize_name(prefix + tfunction->get_name()) + "Async("; + string args = argument_list(tfunction->get_arglist()); + result += args; + if (!args.empty()) + { + result += ", "; + } + result += "CancellationToken cancellationToken)"; + + return result; +} + +string t_netcore_generator::argument_list(t_struct* tstruct) +{ + string result = ""; + const vector& fields = tstruct->get_members(); + vector::const_iterator f_iter; + bool first = true; + for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) + { + if (first) + { + first = false; + } + else + { + result += ", "; + } + result += type_name((*f_iter)->get_type()) + " " + normalize_name((*f_iter)->get_name()); + } + return result; +} + +string t_netcore_generator::type_to_enum(t_type* type) +{ + while (type->is_typedef()) + { + type = static_cast(type)->get_type(); + } + + if (type->is_base_type()) + { + t_base_type::t_base tbase = static_cast(type)->get_base(); + switch (tbase) + { + case t_base_type::TYPE_VOID: + throw "NO T_VOID CONSTRUCT"; + case t_base_type::TYPE_STRING: + return "TType.String"; + case t_base_type::TYPE_BOOL: + return "TType.Bool"; + case t_base_type::TYPE_I8: + return "TType.Byte"; + case t_base_type::TYPE_I16: + return "TType.I16"; + case t_base_type::TYPE_I32: + return "TType.I32"; + case t_base_type::TYPE_I64: + return "TType.I64"; + case t_base_type::TYPE_DOUBLE: + return "TType.Double"; + } + } + else if (type->is_enum()) + { + return "TType.I32"; + } + else if (type->is_struct() || type->is_xception()) + { + return "TType.Struct"; + } + else if (type->is_map()) + { + return "TType.Map"; + } + else if (type->is_set()) + { + return "TType.Set"; + } + else if (type->is_list()) + { + return "TType.List"; + } + + throw "INVALID TYPE IN type_to_enum: " + type->get_name(); +} + +void t_netcore_generator::generate_netcore_docstring_comment(ofstream& out, string contents) +{ + docstring_comment(out, "/// " + endl, "/// ", contents, "/// " + endl); +} + +void t_netcore_generator::generate_netcore_doc(ofstream& out, t_field* field) +{ + if (field->get_type()->is_enum()) + { + string combined_message = field->get_doc() + endl + "get_type()) + "\"/>"; + generate_netcore_docstring_comment(out, combined_message); + } + else + { + generate_netcore_doc(out, static_cast(field)); + } +} + +void t_netcore_generator::generate_netcore_doc(ofstream& out, t_doc* tdoc) +{ + if (tdoc->has_doc()) + { + generate_netcore_docstring_comment(out, tdoc->get_doc()); + } +} + +void t_netcore_generator::generate_netcore_doc(ofstream& out, t_function* tfunction) +{ + if (tfunction->has_doc()) + { + stringstream ps; + const vector& fields = tfunction->get_arglist()->get_members(); + vector::const_iterator p_iter; + for (p_iter = fields.begin(); p_iter != fields.end(); ++p_iter) + { + t_field* p = *p_iter; + ps << endl << "get_name() << "\">"; + if (p->has_doc()) + { + string str = p->get_doc(); + str.erase(remove(str.begin(), str.end(), '\n'), str.end()); + ps << str; + } + ps << ""; + } + + docstring_comment(out, + "", + "/// ", + "" + endl + tfunction->get_doc() + "" + ps.str(), + ""); + } +} + +void t_netcore_generator::docstring_comment(ofstream& out, const string& comment_start, const string& line_prefix, const string& contents, const string& comment_end) +{ + if (comment_start != "") + { + out << indent() << comment_start; + } + + stringstream docs(contents, std::ios_base::in); + + while (!(docs.eof() || docs.fail())) + { + char line[1024]; + docs.getline(line, 1024); + + // Just prnt a newline when the line & prefix are empty. + if (strlen(line) == 0 && line_prefix == "" && !docs.eof()) + { + out << endl; + } + else if (strlen(line) > 0 || !docs.eof()) + { // skip the empty last line + out << indent() << line_prefix << line << endl; + } + } + if (comment_end != "") + { + out << indent() << comment_end; + } +} + +string t_netcore_generator::get_enum_class_name(t_type* type) +{ + string package = ""; + t_program* program = type->get_program(); + if (program != NULL && program != program_) + { + package = program->get_namespace("netcore") + "."; + } + return package + type->get_name(); +} + +THRIFT_REGISTER_GENERATOR( + netcore, + "C#", + " wcf: Adds bindings for WCF to generated classes.\n" + " serial: Add serialization support to generated classes.\n" + " nullable: Use nullable types for properties.\n" + " hashcode: Generate a hashcode and equals implementation for classes.\n" + " union: Use new union typing, which includes a static read function for union types.\n" +) diff --git a/compiler/cpp/src/thrift/thriftl.ll b/compiler/cpp/src/thrift/thriftl.ll index bf7e8a56ca7..10710361943 100644 --- a/compiler/cpp/src/thrift/thriftl.ll +++ b/compiler/cpp/src/thrift/thriftl.ll @@ -208,6 +208,7 @@ literal_begin (['\"]) "java_package" { error_unsupported_namespace_decl("java_package", "java"); /* do nothing */ } "cocoa_prefix" { error_unsupported_namespace_decl("cocoa_prefix", "cocoa"); /* do nothing */ } "csharp_namespace" { error_unsupported_namespace_decl("csharp"); /* do nothing */ } +"netcore_namespace" { error_unsupported_namespace_decl("netcore"); /* do nothing */ } "delphi_namespace" { error_unsupported_namespace_decl("delphi"); /* do nothing */ } "php_namespace" { error_unsupported_namespace_decl("php"); /* do nothing */ } "py_module" { error_unsupported_namespace_decl("py_module", "py"); /* do nothing */ } diff --git a/lib/netcore/.gitignore b/lib/netcore/.gitignore new file mode 100644 index 00000000000..f2b52a3deed --- /dev/null +++ b/lib/netcore/.gitignore @@ -0,0 +1,249 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +.idea.*/ + +.DS_Store + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +[Xx]64/ +[Xx]86/ +[Bb]uild/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml + +# TODO: Un-comment the next line if you do not want to checkin +# your web sitey settings because they may include unencrypted +# passwords +#*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# LightSwitch generated files +GeneratedArtifacts/ +ModelManifest.xml + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ diff --git a/lib/netcore/README.md b/lib/netcore/README.md new file mode 100644 index 00000000000..0fe5f9d14e9 --- /dev/null +++ b/lib/netcore/README.md @@ -0,0 +1,12 @@ +# Apache Thrift net-core-lib + +Thrift client library ported to Microsoft .Net Core + +Notes: Removed support of Silverlight (as it no longer supported by Microsoft) + +# How to build +* Download the latest version of dotnet from https://www.microsoft.com/net/core (it can be https://go.microsoft.com/fwlink/?LinkID=809122 in case of VS Code) +* Install downloaded version of dotnet +* Clone repo +* Run **build.sh** or **build.cmd** from the root of cloned repository +* Check samples in **src/Samples** folder diff --git a/lib/netcore/build.cmd b/lib/netcore/build.cmd new file mode 100644 index 00000000000..3a4b7505b92 --- /dev/null +++ b/lib/netcore/build.cmd @@ -0,0 +1,7 @@ +dotnet --info + +dotnet restore + +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 \ No newline at end of file diff --git a/lib/netcore/build.sh b/lib/netcore/build.sh new file mode 100755 index 00000000000..45982fc06af --- /dev/null +++ b/lib/netcore/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +#exit if any command fails +#set -e + +dotnet --info + +dotnet restore + +# dotnet test ./test/TEST_PROJECT_NAME -c Release -f netcoreapp1.0 + +# Instead, run directly with mono for the full .net version +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 + +#revision=${TRAVIS_JOB_ID:=1} +#revision=$(printf "%04d" $revision) + +#dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift new file mode 100644 index 00000000000..5da035efaa0 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift @@ -0,0 +1,705 @@ +#!/usr/local/bin/thrift --java --php --py +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# *** PLEASE REMEMBER TO EDIT THE VERSION CONSTANT WHEN MAKING CHANGES *** +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# +# Interface definition for Cassandra Service +# + +namespace csharp Apache.Cassandra.Test + +# Thrift.rb has a bug where top-level modules that include modules +# with the same name are not properly referenced, so we can't do +# Cassandra::Cassandra::Client. +namespace rb CassandraThrift + +# The API version (NOT the product version), composed as a dot delimited +# string with major, minor, and patch level components. +# +# - Major: Incremented for backward incompatible changes. An example would +# be changes to the number or disposition of method arguments. +# - Minor: Incremented for backward compatible changes. An example would +# be the addition of a new (optional) method. +# - Patch: Incremented for bug fixes. The patch level should be increased +# for every edit that doesn't result in a change to major/minor. +# +# See the Semantic Versioning Specification (SemVer) http://semver.org. +const string VERSION = "19.24.0" + + +# +# data structures +# + +/** Basic unit of data within a ColumnFamily. + * @param name, the name by which this column is set and retrieved. Maximum 64KB long. + * @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it). + * @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared. + * @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted. + */ +struct Column { + 1: required binary name, + 2: optional binary value, + 3: optional i64 timestamp, + 4: optional i32 ttl, +} + +/** A named list of columns. + * @param name. see Column.name. + * @param columns. A collection of standard Columns. The columns within a super column are defined in an adhoc manner. + * Columns within a super column do not have to have matching structures (similarly named child columns). + */ +struct SuperColumn { + 1: required binary name, + 2: required list columns, +} + +struct CounterColumn { + 1: required binary name, + 2: required i64 value +} + +struct CounterSuperColumn { + 1: required binary name, + 2: required list columns +} + +/** + Methods for fetching rows/records from Cassandra will return either a single instance of ColumnOrSuperColumn or a list + of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn (or list of SuperColumns) then the resulting + instances of ColumnOrSuperColumn will have the requested SuperColumn in the attribute super_column. For queries resulting + in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize on + single query methods that may return either a SuperColumn or Column. + + If the query was on a counter column family, you will either get a counter_column (instead of a column) or a + counter_super_column (instead of a super_column) + + @param column. The Column returned by get() or get_slice(). + @param super_column. The SuperColumn returned by get() or get_slice(). + @param counter_column. The Counterolumn returned by get() or get_slice(). + @param counter_super_column. The CounterSuperColumn returned by get() or get_slice(). + */ +struct ColumnOrSuperColumn { + 1: optional Column column, + 2: optional SuperColumn super_column, + 3: optional CounterColumn counter_column, + 4: optional CounterSuperColumn counter_super_column +} + + +# +# Exceptions +# (note that internal server errors will raise a TApplicationException, courtesy of Thrift) +# + +/** A specific column was requested that does not exist. */ +exception NotFoundException { +} + +/** Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a parameter is malformed. + why contains an associated error message. +*/ +exception InvalidRequestException { + 1: required string why +} + +/** Not all the replicas required could be created and/or read. */ +exception UnavailableException { +} + +/** RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too large. */ +exception TimedOutException { +} + +/** invalid authentication request (invalid keyspace, user does not exist, or credentials invalid) */ +exception AuthenticationException { + 1: required string why +} + +/** invalid authorization request (user does not have access to keyspace) */ +exception AuthorizationException { + 1: required string why +} + +/** schemas are not in agreement across all nodes */ +exception SchemaDisagreementException { +} + + +# +# service api +# +/** + * The ConsistencyLevel is an enum that controls both read and write + * behavior based on the ReplicationFactor of the keyspace. The + * different consistency levels have different meanings, depending on + * if you're doing a write or read operation. + * + * If W + R > ReplicationFactor, where W is the number of nodes to + * block for on write, and R the number to block for on reads, you + * will have strongly consistent behavior; that is, readers will + * always see the most recent write. Of these, the most interesting is + * to do QUORUM reads and writes, which gives you consistency while + * still allowing availability in the face of node failures up to half + * of . Of course if latency is more important than + * consistency then you can use lower values for either or both. + * + * Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number + * of replicas rather than a logical concept that adjusts + * automatically with the replication factor. Of these, only ONE is + * commonly used; TWO and (even more rarely) THREE are only useful + * when you care more about guaranteeing a certain level of + * durability, than consistency. + * + * Write consistency levels make the following guarantees before reporting success to the client: + * ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. + * ONE Ensure that the write has been written to at least 1 node's commit log and memory table + * TWO Ensure that the write has been written to at least 2 node's commit log and memory table + * THREE Ensure that the write has been written to at least 3 node's commit log and memory table + * QUORUM Ensure that the write has been written to / 2 + 1 nodes + * LOCAL_QUORUM Ensure that the write has been written to / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + * EACH_QUORUM Ensure that the write has been written to / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) + * ALL Ensure that the write is written to <ReplicationFactor> nodes before responding to the client. + * + * Read consistency levels make the following guarantees before returning successful results to the client: + * ANY Not supported. You probably want ONE instead. + * ONE Returns the record obtained from a single replica. + * TWO Returns the record with the most recent timestamp once two replicas have replied. + * THREE Returns the record with the most recent timestamp once three replicas have replied. + * QUORUM Returns the record with the most recent timestamp once a majority of replicas have replied. + * LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. + * EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. + * ALL Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down).. +*/ +enum ConsistencyLevel { + ONE = 1, + QUORUM = 2, + LOCAL_QUORUM = 3, + EACH_QUORUM = 4, + ALL = 5, + ANY = 6, + TWO = 7, + THREE = 8, +} + +/** + ColumnParent is used when selecting groups of columns from the same ColumnFamily. In directory structure terms, imagine + ColumnParent as ColumnPath + '/../'. + + See also ColumnPath + */ +struct ColumnParent { + 3: required string column_family, + 4: optional binary super_column, +} + +/** The ColumnPath is the path to a single column in Cassandra. It might make sense to think of ColumnPath and + * ColumnParent in terms of a directory structure. + * + * ColumnPath is used to looking up a single column. + * + * @param column_family. The name of the CF of the column being looked up. + * @param super_column. The super column name. + * @param column. The column name. + */ +struct ColumnPath { + 3: required string column_family, + 4: optional binary super_column, + 5: optional binary column, +} + +/** + A slice range is a structure that stores basic range, ordering and limit information for a query that will return + multiple columns. It could be thought of as Cassandra's version of LIMIT and ORDER BY + + @param start. The column name to start the slice with. This attribute is not required, though there is no default value, + and can be safely set to '', i.e., an empty byte array, to start with the first column name. Otherwise, it + must a valid value under the rules of the Comparator defined for the given ColumnFamily. + @param finish. The column name to stop the slice at. This attribute is not required, though there is no default value, + and can be safely set to an empty byte array to not stop until 'count' results are seen. Otherwise, it + must also be a valid value to the ColumnFamily Comparator. + @param reversed. Whether the results should be ordered in reversed order. Similar to ORDER BY blah DESC in SQL. + @param count. How many columns to return. Similar to LIMIT in SQL. May be arbitrarily large, but Thrift will + materialize the whole result into memory before returning it to the client, so be aware that you may + be better served by iterating through slices by passing the last value of one call in as the 'start' + of the next instead of increasing 'count' arbitrarily large. + */ +struct SliceRange { + 1: required binary start, + 2: required binary finish, + 3: required bool reversed=0, + 4: required i32 count=100, +} + +/** + A SlicePredicate is similar to a mathematic predicate (see http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)), + which is described as "a property that the elements of a set have in common." + + SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange. If column_names is + specified, slice_range is ignored. + + @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature + to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack', + and 'Jim' you can pass those column names as a list to fetch all three at once. + @param slice_range. A SliceRange describing how to range, order, and/or limit the slice. + */ +struct SlicePredicate { + 1: optional list column_names, + 2: optional SliceRange slice_range, +} + +enum IndexOperator { + EQ, + GTE, + GT, + LTE, + LT +} + +struct IndexExpression { + 1: required binary column_name, + 2: required IndexOperator op, + 3: required binary value, +} + +struct IndexClause { + 1: required list expressions + 2: required binary start_key, + 3: required i32 count=100, +} + +/** +The semantics of start keys and tokens are slightly different. +Keys are start-inclusive; tokens are start-exclusive. Token +ranges may also wrap -- that is, the end token may be less +than the start one. Thus, a range from keyX to keyX is a +one-element range, but a range from tokenY to tokenY is the +full ring. +*/ +struct KeyRange { + 1: optional binary start_key, + 2: optional binary end_key, + 3: optional string start_token, + 4: optional string end_token, + 5: required i32 count=100 +} + +/** + A KeySlice is key followed by the data it maps to. A collection of KeySlice is returned by the get_range_slice operation. + + @param key. a row key + @param columns. List of data represented by the key. Typically, the list is pared down to only the columns specified by + a SlicePredicate. + */ +struct KeySlice { + 1: required binary key, + 2: required list columns, +} + +struct KeyCount { + 1: required binary key, + 2: required i32 count +} + +/** + * Note that the timestamp is only optional in case of counter deletion. + */ +struct Deletion { + 1: optional i64 timestamp, + 2: optional binary super_column, + 3: optional SlicePredicate predicate, +} + +/** + A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling the deletion attribute). + @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn) + @param deletion. A deletion of a column or supercolumn +*/ +struct Mutation { + 1: optional ColumnOrSuperColumn column_or_supercolumn, + 2: optional Deletion deletion, +} + +struct EndpointDetails { + 1: string host, + 2: string datacenter, + 3: optional string rack +} + +/** + A TokenRange describes part of the Cassandra ring, it is a mapping from a range to + endpoints responsible for that range. + @param start_token The first token in the range + @param end_token The last token in the range + @param endpoints The endpoints responsible for the range (listed by their configured listen_address) + @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address) +*/ +struct TokenRange { + 1: required string start_token, + 2: required string end_token, + 3: required list endpoints, + 4: optional list rpc_endpoints + 5: optional list endpoint_details, +} + +/** + Authentication requests can contain any data, dependent on the IAuthenticator used +*/ +struct AuthenticationRequest { + 1: required map credentials +} + +enum IndexType { + KEYS, + CUSTOM +} + +/* describes a column in a column family. */ +struct ColumnDef { + 1: required binary name, + 2: required string validation_class, + 3: optional IndexType index_type, + 4: optional string index_name, + 5: optional map index_options +} + + +/* describes a column family. */ +struct CfDef { + 1: required string keyspace, + 2: required string name, + 3: optional string column_type="Standard", + 5: optional string comparator_type="BytesType", + 6: optional string subcomparator_type, + 8: optional string comment, + 12: optional double read_repair_chance=1.0, + 13: optional list column_metadata, + 14: optional i32 gc_grace_seconds, + 15: optional string default_validation_class, + 16: optional i32 id, + 17: optional i32 min_compaction_threshold, + 18: optional i32 max_compaction_threshold, + 24: optional bool replicate_on_write, + 25: optional double merge_shards_chance, + 26: optional string key_validation_class, + 28: optional binary key_alias, + 29: optional string compaction_strategy, + 30: optional map compaction_strategy_options, + 32: optional map compression_options, + 33: optional double bloom_filter_fp_chance, +} + +/* describes a keyspace. */ +struct KsDef { + 1: required string name, + 2: required string strategy_class, + 3: optional map strategy_options, + + /** @deprecated */ + 4: optional i32 replication_factor, + + 5: required list cf_defs, + 6: optional bool durable_writes=1, +} + +/** CQL query compression */ +enum Compression { + GZIP = 1, + NONE = 2 +} + +enum CqlResultType { + ROWS = 1, + VOID = 2, + INT = 3 +} + +/** Row returned from a CQL query */ +struct CqlRow { + 1: required binary key, + 2: required list columns +} + +struct CqlMetadata { + 1: required map name_types, + 2: required map value_types, + 3: required string default_name_type, + 4: required string default_value_type +} + +struct CqlResult { + 1: required CqlResultType type, + 2: optional list rows, + 3: optional i32 num, + 4: optional CqlMetadata schema +} + +struct CqlPreparedResult { + 1: required i32 itemId, + 2: required i32 count +} + + +service Cassandra { + # auth methods + void login(1: required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx), + + # set keyspace + void set_keyspace(1: required string keyspace) throws (1:InvalidRequestException ire), + + # retrieval methods + + /** + Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is + the only method that can throw an exception under non-failure conditions.) + */ + ColumnOrSuperColumn get(1:required binary key, + 2:required ColumnPath column_path, + 3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:NotFoundException nfe, 3:UnavailableException ue, 4:TimedOutException te), + + /** + Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name + pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned. + */ + list get_slice(1:required binary key, + 2:required ColumnParent column_parent, + 3:required SlicePredicate predicate, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + returns the number of columns matching predicate for a particular key, + ColumnFamily and optionally SuperColumn. + */ + i32 get_count(1:required binary key, + 2:required ColumnParent column_parent, + 3:required SlicePredicate predicate, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + Performs a get_slice for column_parent and predicate for the given keys in parallel. + */ + map> multiget_slice(1:required list keys, + 2:required ColumnParent column_parent, + 3:required SlicePredicate predicate, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + Perform a get_count in parallel on the given list keys. The return value maps keys to the count found. + */ + map multiget_count(1:required list keys, + 2:required ColumnParent column_parent, + 3:required SlicePredicate predicate, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + returns a subset of columns for a contiguous range of keys. + */ + list get_range_slices(1:required ColumnParent column_parent, + 2:required SlicePredicate predicate, + 3:required KeyRange range, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause */ + list get_indexed_slices(1:required ColumnParent column_parent, + 2:required IndexClause index_clause, + 3:required SlicePredicate column_predicate, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + # modification methods + + /** + * Insert a Column at the given column_parent.column_family and optional column_parent.super_column. + */ + void insert(1:required binary key, + 2:required ColumnParent column_parent, + 3:required Column column, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + * Increment or decrement a counter. + */ + void add(1:required binary key, + 2:required ColumnParent column_parent, + 3:required CounterColumn column, + 4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note + that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire + row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those levels too. + */ + void remove(1:required binary key, + 2:required ColumnPath column_path, + 3:required i64 timestamp, + 4:ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + * Remove a counter at the specified location. + * Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following update + * until the delete has reached all the nodes and all of them have been fully compacted. + */ + void remove_counter(1:required binary key, + 2:required ColumnPath path, + 3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + + /** + Mutate many columns or super columns for many row keys. See also: Mutation. + + mutation_map maps key to column family to a list of Mutation objects to take place at that scope. + **/ + void batch_mutate(1:required map>> mutation_map, + 2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE) + throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te), + + /** + Truncate will mark and entire column family as deleted. + From the user's perspective a successful call to truncate will result complete data deletion from cfname. + Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one + only marks the data as deleted. + The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if + some hosts are down. + */ + void truncate(1:required string cfname) + throws (1: InvalidRequestException ire, 2: UnavailableException ue, 3: TimedOutException te), + + + + // Meta-APIs -- APIs to get information about the node or cluster, + // rather than user data. The nodeprobe program provides usage examples. + + /** + * for each schema version present in the cluster, returns a list of nodes at that version. + * hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. + * the cluster is all on the same version if the size of the map is 1. + */ + map> describe_schema_versions() + throws (1: InvalidRequestException ire), + + /** list the defined keyspaces in this cluster */ + list describe_keyspaces() + throws (1:InvalidRequestException ire), + + /** get the cluster name */ + string describe_cluster_name(), + + /** get the thrift api version */ + string describe_version(), + + /** get the token ring: a map of ranges to host addresses, + represented as a set of TokenRange instead of a map from range + to list of endpoints, because you can't use Thrift structs as + map keys: + https://issues.apache.org/jira/browse/THRIFT-162 + + for the same reason, we can't return a set here, even though + order is neither important nor predictable. */ + list describe_ring(1:required string keyspace) + throws (1:InvalidRequestException ire), + + /** returns the partitioner used by this cluster */ + string describe_partitioner(), + + /** returns the snitch used by this cluster */ + string describe_snitch(), + + /** describe specified keyspace */ + KsDef describe_keyspace(1:required string keyspace) + throws (1:NotFoundException nfe, 2:InvalidRequestException ire), + + /** experimental API for hadoop/parallel query support. + may change violently and without warning. + + returns list of token strings such that first subrange is (list[0], list[1]], + next is (list[1], list[2]], etc. */ + list describe_splits(1:required string cfName, + 2:required string start_token, + 3:required string end_token, + 4:required i32 keys_per_split) + throws (1:InvalidRequestException ire), + + /** adds a column family. returns the new schema id. */ + string system_add_column_family(1:required CfDef cf_def) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** drops a column family. returns the new schema id. */ + string system_drop_column_family(1:required string column_family) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** adds a keyspace and any column families that are part of it. returns the new schema id. */ + string system_add_keyspace(1:required KsDef ks_def) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** drops a keyspace and any column families that are part of it. returns the new schema id. */ + string system_drop_keyspace(1:required string keyspace) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** updates properties of a keyspace. returns the new schema id. */ + string system_update_keyspace(1:required KsDef ks_def) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** updates properties of a column family. returns the new schema id. */ + string system_update_column_family(1:required CfDef cf_def) + throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), + + /** + * Executes a CQL (Cassandra Query Language) statement and returns a + * CqlResult containing the results. + */ + CqlResult execute_cql_query(1:required binary query, 2:required Compression compression) + throws (1:InvalidRequestException ire, + 2:UnavailableException ue, + 3:TimedOutException te, + 4:SchemaDisagreementException sde) + + + /** + * Prepare a CQL (Cassandra Query Language) statement by compiling and returning + * - the type of CQL statement + * - an id token of the compiled CQL stored on the server side. + * - a count of the discovered bound markers in the statement + */ + CqlPreparedResult prepare_cql_query(1:required binary query, 2:required Compression compression) + throws (1:InvalidRequestException ire) + + + /** + * Executes a prepared CQL (Cassandra Query Language) statement by passing an id token and a list of variables + * to bind and returns a CqlResult containing the results. + */ + CqlResult execute_prepared_cql_query(1:required i32 itemId, 2:required list values) + throws (1:InvalidRequestException ire, + 2:UnavailableException ue, + 3:TimedOutException te, + 4:SchemaDisagreementException sde) + + +} diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift new file mode 100644 index 00000000000..7ac937be98b --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * fb303.thrift + */ + +namespace csharp Facebook.FB303.Test + +/** + * Common status reporting mechanism across all services + */ +enum fb_status { + DEAD = 0, + STARTING = 1, + ALIVE = 2, + STOPPING = 3, + STOPPED = 4, + WARNING = 5, +} + +/** + * Standard base service + */ +service FacebookService { + + /** + * Returns a descriptive name of the service + */ + string getName(), + + /** + * Returns the version of the service + */ + string getVersion(), + + /** + * Gets the status of this service + */ + fb_status getStatus(), + + /** + * User friendly description of status, such as why the service is in + * the dead or warning state, or what is being started or stopped. + */ + string getStatusDetails(), + + /** + * Gets the counters for this service + */ + map getCounters(), + + /** + * Gets the value of a single counter + */ + i64 getCounter(1: string key), + + /** + * Sets an option + */ + void setOption(1: string key, 2: string value), + + /** + * Gets an option + */ + string getOption(1: string key), + + /** + * Gets all options + */ + map getOptions(), + + /** + * Returns a CPU profile over the given time interval (client and server + * must agree on the profile format). + */ + string getCpuProfile(1: i32 profileDurationInSec), + + /** + * Returns the unix time that the server has been running since + */ + i64 aliveSince(), + + /** + * Tell the server to reload its configuration, reopen log files, etc + */ + oneway void reinitialize(), + + /** + * Suggest a shutdown to the server + */ + oneway void shutdown(), + +} diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs new file mode 100644 index 00000000000..9ec8ede23f5 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs @@ -0,0 +1,147 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// invalid authentication request (invalid keyspace, user does not exist, or credentials invalid) + /// + public partial class AuthenticationException : TException, TBase + { + public AuthenticationException() + { + } + + public AuthenticationException(string why) : this() + { + this.Why = why; + } + + [DataMember(Order = 0)] + public string Why { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_why = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Why = await iprot.ReadStringAsync(cancellationToken); + isset_why = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_why) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("AuthenticationException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "why"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Why, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("AuthenticationException("); + sb.Append(", Why: "); + sb.Append(Why); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class AuthenticationExceptionFault + { + private string _why; + + [DataMember(Order = 0)] + public string Why { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs new file mode 100644 index 00000000000..a96841cad0b --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Authentication requests can contain any data, dependent on the IAuthenticator used + /// + [DataContract(Namespace = "")] + public partial class AuthenticationRequest : TBase + { + public AuthenticationRequest() + { + } + + public AuthenticationRequest(Dictionary credentials) : this() + { + this.Credentials = credentials; + } + + [DataMember(Order = 0)] + public Dictionary Credentials { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_credentials = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Credentials = new Dictionary(); + TMap _map32 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i33 = 0; _i33 < _map32.Count; ++_i33) + { + string _key34; + string _val35; + _key34 = await iprot.ReadStringAsync(cancellationToken); + _val35 = await iprot.ReadStringAsync(cancellationToken); + Credentials[_key34] = _val35; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + isset_credentials = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_credentials) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("AuthenticationRequest"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "credentials"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Credentials.Count), + cancellationToken); + foreach (string _iter36 in Credentials.Keys) + { + await oprot.WriteStringAsync(_iter36, cancellationToken); + await oprot.WriteStringAsync(Credentials[_iter36], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("AuthenticationRequest("); + sb.Append(", Credentials: "); + sb.Append(Credentials); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs new file mode 100644 index 00000000000..f81e0ace864 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs @@ -0,0 +1,147 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// invalid authorization request (user does not have access to keyspace) + /// + public partial class AuthorizationException : TException, TBase + { + public AuthorizationException() + { + } + + public AuthorizationException(string why) : this() + { + this.Why = why; + } + + [DataMember(Order = 0)] + public string Why { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_why = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Why = await iprot.ReadStringAsync(cancellationToken); + isset_why = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_why) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("AuthorizationException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "why"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Why, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("AuthorizationException("); + sb.Append(", Why: "); + sb.Append(Why); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class AuthorizationExceptionFault + { + private string _why; + + [DataMember(Order = 0)] + public string Why { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs new file mode 100644 index 00000000000..ce992209c36 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs @@ -0,0 +1,15404 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + public partial class Cassandra + { + [ServiceContract(Namespace = "")] + public interface IAsync + { + [OperationContract] + [FaultContract(typeof(AuthenticationExceptionFault))] + [FaultContract(typeof(AuthorizationExceptionFault))] + Task loginAsync(AuthenticationRequest auth_request, CancellationToken cancellationToken); + + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task set_keyspaceAsync(string keyspace, CancellationToken cancellationToken); + + /// + /// Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This + /// is + /// the only method that can throw an exception under non-failure conditions.) + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(NotFoundExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task @getAsync(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level, + CancellationToken cancellationToken); + + /// + /// Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name + /// pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task> get_sliceAsync(byte[] key, ColumnParent column_parent, + SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// returns the number of columns matching predicate for a particular key, + /// ColumnFamily and optionally SuperColumn. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task get_countAsync(byte[] key, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// Performs a get_slice for column_parent and predicate for the given keys in parallel. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task>> multiget_sliceAsync(List keys, + ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level, + CancellationToken cancellationToken); + + /// + /// Perform a get_count in parallel on the given list keys. The return value maps keys to the count found. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task> multiget_countAsync(List keys, ColumnParent column_parent, + SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// returns a subset of columns for a contiguous range of keys. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task> get_range_slicesAsync(ColumnParent column_parent, SlicePredicate predicate, + KeyRange range, ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task> get_indexed_slicesAsync(ColumnParent column_parent, IndexClause index_clause, + SlicePredicate column_predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// Insert a Column at the given column_parent.column_family and optional column_parent.super_column. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task insertAsync(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level, + CancellationToken cancellationToken); + + /// + /// Increment or decrement a counter. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task @addAsync(byte[] key, ColumnParent column_parent, CounterColumn column, + ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. + /// Note + /// that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire + /// row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those + /// levels too. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task @removeAsync(byte[] key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level, + CancellationToken cancellationToken); + + /// + /// Remove a counter at the specified location. + /// Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following + /// update + /// until the delete has reached all the nodes and all of them have been fully compacted. + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task remove_counterAsync(byte[] key, ColumnPath path, ConsistencyLevel consistency_level, + CancellationToken cancellationToken); + + /// + /// Mutate many columns or super columns for many row keys. See also: Mutation. + /// mutation_map maps key to column family to a list of Mutation objects to take place at that scope. + /// * + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task batch_mutateAsync(Dictionary>> mutation_map, + ConsistencyLevel consistency_level, CancellationToken cancellationToken); + + /// + /// Truncate will mark and entire column family as deleted. + /// From the user's perspective a successful call to truncate will result complete data deletion from cfname. + /// Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one + /// only marks the data as deleted. + /// The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if + /// some hosts are down. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + Task truncateAsync(string cfname, CancellationToken cancellationToken); + + /// + /// for each schema version present in the cluster, returns a list of nodes at that version. + /// hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. + /// the cluster is all on the same version if the size of the map is 1. + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task>> describe_schema_versionsAsync(CancellationToken cancellationToken); + + /// + /// list the defined keyspaces in this cluster + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task> describe_keyspacesAsync(CancellationToken cancellationToken); + + /// + /// get the cluster name + /// + [OperationContract] + Task describe_cluster_nameAsync(CancellationToken cancellationToken); + + /// + /// get the thrift api version + /// + [OperationContract] + Task describe_versionAsync(CancellationToken cancellationToken); + + /// + /// get the token ring: a map of ranges to host addresses, + /// represented as a set of TokenRange instead of a map from range + /// to list of endpoints, because you can't use Thrift structs as + /// map keys: + /// https://issues.apache.org/jira/browse/THRIFT-162 + /// for the same reason, we can't return a set here, even though + /// order is neither important nor predictable. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task> describe_ringAsync(string keyspace, CancellationToken cancellationToken); + + /// + /// returns the partitioner used by this cluster + /// + [OperationContract] + Task describe_partitionerAsync(CancellationToken cancellationToken); + + /// + /// returns the snitch used by this cluster + /// + [OperationContract] + Task describe_snitchAsync(CancellationToken cancellationToken); + + /// + /// describe specified keyspace + /// + /// + [OperationContract] + [FaultContract(typeof(NotFoundExceptionFault))] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task describe_keyspaceAsync(string keyspace, CancellationToken cancellationToken); + + /// + /// experimental API for hadoop/parallel query support. + /// may change violently and without warning. + /// returns list of token strings such that first subrange is (list[0], list[1]], + /// next is (list[1], list[2]], etc. + /// + /// + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task> describe_splitsAsync(string cfName, string start_token, string end_token, + int keys_per_split, CancellationToken cancellationToken); + + /// + /// adds a column family. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_add_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken); + + /// + /// drops a column family. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_drop_column_familyAsync(string column_family, CancellationToken cancellationToken); + + /// + /// adds a keyspace and any column families that are part of it. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_add_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken); + + /// + /// drops a keyspace and any column families that are part of it. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_drop_keyspaceAsync(string keyspace, CancellationToken cancellationToken); + + /// + /// updates properties of a keyspace. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_update_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken); + + /// + /// updates properties of a column family. returns the new schema id. + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task system_update_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken); + + /// + /// Executes a CQL (Cassandra Query Language) statement and returns a + /// CqlResult containing the results. + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task execute_cql_queryAsync(byte[] query, Compression compression, + CancellationToken cancellationToken); + + /// + /// Prepare a CQL (Cassandra Query Language) statement by compiling and returning + /// - the type of CQL statement + /// - an id token of the compiled CQL stored on the server side. + /// - a count of the discovered bound markers in the statement + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + Task prepare_cql_queryAsync(byte[] query, Compression compression, + CancellationToken cancellationToken); + + /// + /// Executes a prepared CQL (Cassandra Query Language) statement by passing an id token and a list of variables + /// to bind and returns a CqlResult containing the results. + /// + /// + /// + [OperationContract] + [FaultContract(typeof(InvalidRequestExceptionFault))] + [FaultContract(typeof(UnavailableExceptionFault))] + [FaultContract(typeof(TimedOutExceptionFault))] + [FaultContract(typeof(SchemaDisagreementExceptionFault))] + Task execute_prepared_cql_queryAsync(int itemId, List values, + CancellationToken cancellationToken); + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task loginAsync(AuthenticationRequest auth_request, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("login", TMessageType.Call, SeqId), + cancellationToken); + + var args = new loginArgs(); + args.Auth_request = auth_request; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new loginResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.authnx) + { + throw result.Authnx; + } + if (result.__isset.authzx) + { + throw result.Authzx; + } + return; + } + + public async Task set_keyspaceAsync(string keyspace, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Call, SeqId), + cancellationToken); + + var args = new set_keyspaceArgs(); + args.Keyspace = keyspace; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new set_keyspaceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + return; + } + + public async Task @getAsync(byte[] key, ColumnPath column_path, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("get", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getArgs(); + args.Key = key; + args.Column_path = column_path; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.nfe) + { + throw result.Nfe; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "get failed: unknown result"); + } + + public async Task> get_sliceAsync(byte[] key, ColumnParent column_parent, + SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Call, SeqId), + cancellationToken); + + var args = new get_sliceArgs(); + args.Key = key; + args.Column_parent = column_parent; + args.Predicate = predicate; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new get_sliceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "get_slice failed: unknown result"); + } + + public async Task get_countAsync(byte[] key, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Call, SeqId), + cancellationToken); + + var args = new get_countArgs(); + args.Key = key; + args.Column_parent = column_parent; + args.Predicate = predicate; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new get_countResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "get_count failed: unknown result"); + } + + public async Task>> multiget_sliceAsync(List keys, + ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Call, SeqId), + cancellationToken); + + var args = new multiget_sliceArgs(); + args.Keys = keys; + args.Column_parent = column_parent; + args.Predicate = predicate; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new multiget_sliceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "multiget_slice failed: unknown result"); + } + + public async Task> multiget_countAsync(List keys, ColumnParent column_parent, + SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Call, SeqId), + cancellationToken); + + var args = new multiget_countArgs(); + args.Keys = keys; + args.Column_parent = column_parent; + args.Predicate = predicate; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new multiget_countResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "multiget_count failed: unknown result"); + } + + public async Task> get_range_slicesAsync(ColumnParent column_parent, SlicePredicate predicate, + KeyRange range, ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Call, SeqId), + cancellationToken); + + var args = new get_range_slicesArgs(); + args.Column_parent = column_parent; + args.Predicate = predicate; + args.Range = range; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new get_range_slicesResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "get_range_slices failed: unknown result"); + } + + public async Task> get_indexed_slicesAsync(ColumnParent column_parent, + IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Call, SeqId), + cancellationToken); + + var args = new get_indexed_slicesArgs(); + args.Column_parent = column_parent; + args.Index_clause = index_clause; + args.Column_predicate = column_predicate; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new get_indexed_slicesResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "get_indexed_slices failed: unknown result"); + } + + public async Task insertAsync(byte[] key, ColumnParent column_parent, Column column, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Call, SeqId), + cancellationToken); + + var args = new insertArgs(); + args.Key = key; + args.Column_parent = column_parent; + args.Column = column; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new insertResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task @addAsync(byte[] key, ColumnParent column_parent, CounterColumn column, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("add", TMessageType.Call, SeqId), + cancellationToken); + + var args = new addArgs(); + args.Key = key; + args.Column_parent = column_parent; + args.Column = column; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new addResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task @removeAsync(byte[] key, ColumnPath column_path, long timestamp, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Call, SeqId), + cancellationToken); + + var args = new removeArgs(); + args.Key = key; + args.Column_path = column_path; + args.Timestamp = timestamp; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new removeResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task remove_counterAsync(byte[] key, ColumnPath path, ConsistencyLevel consistency_level, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Call, SeqId), + cancellationToken); + + var args = new remove_counterArgs(); + args.Key = key; + args.Path = path; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new remove_counterResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task batch_mutateAsync(Dictionary>> mutation_map, + ConsistencyLevel consistency_level, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Call, SeqId), + cancellationToken); + + var args = new batch_mutateArgs(); + args.Mutation_map = mutation_map; + args.Consistency_level = consistency_level; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new batch_mutateResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task truncateAsync(string cfname, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Call, SeqId), + cancellationToken); + + var args = new truncateArgs(); + args.Cfname = cfname; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new truncateResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + return; + } + + public async Task>> describe_schema_versionsAsync( + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("describe_schema_versions", TMessageType.Call, SeqId), cancellationToken); + + var args = new describe_schema_versionsArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_schema_versionsResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_schema_versions failed: unknown result"); + } + + public async Task> describe_keyspacesAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_keyspacesArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_keyspacesResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_keyspaces failed: unknown result"); + } + + public async Task describe_cluster_nameAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("describe_cluster_name", TMessageType.Call, SeqId), cancellationToken); + + var args = new describe_cluster_nameArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_cluster_nameResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_cluster_name failed: unknown result"); + } + + public async Task describe_versionAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_versionArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_versionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_version failed: unknown result"); + } + + public async Task> describe_ringAsync(string keyspace, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_ringArgs(); + args.Keyspace = keyspace; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_ringResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_ring failed: unknown result"); + } + + public async Task describe_partitionerAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("describe_partitioner", TMessageType.Call, SeqId), cancellationToken); + + var args = new describe_partitionerArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_partitionerResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_partitioner failed: unknown result"); + } + + public async Task describe_snitchAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_snitchArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_snitchResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_snitch failed: unknown result"); + } + + public async Task describe_keyspaceAsync(string keyspace, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_keyspaceArgs(); + args.Keyspace = keyspace; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_keyspaceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.nfe) + { + throw result.Nfe; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_keyspace failed: unknown result"); + } + + public async Task> describe_splitsAsync(string cfName, string start_token, string end_token, + int keys_per_split, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Call, SeqId), + cancellationToken); + + var args = new describe_splitsArgs(); + args.CfName = cfName; + args.Start_token = start_token; + args.End_token = end_token; + args.Keys_per_split = keys_per_split; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new describe_splitsResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "describe_splits failed: unknown result"); + } + + public async Task system_add_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_add_column_family", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_add_column_familyArgs(); + args.Cf_def = cf_def; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_add_column_familyResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_add_column_family failed: unknown result"); + } + + public async Task system_drop_column_familyAsync(string column_family, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_drop_column_family", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_drop_column_familyArgs(); + args.Column_family = column_family; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_drop_column_familyResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_drop_column_family failed: unknown result"); + } + + public async Task system_add_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_add_keyspace", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_add_keyspaceArgs(); + args.Ks_def = ks_def; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_add_keyspaceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_add_keyspace failed: unknown result"); + } + + public async Task system_drop_keyspaceAsync(string keyspace, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_drop_keyspace", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_drop_keyspaceArgs(); + args.Keyspace = keyspace; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_drop_keyspaceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_drop_keyspace failed: unknown result"); + } + + public async Task system_update_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_update_keyspace", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_update_keyspaceArgs(); + args.Ks_def = ks_def; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_update_keyspaceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_update_keyspace failed: unknown result"); + } + + public async Task system_update_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("system_update_column_family", TMessageType.Call, SeqId), cancellationToken); + + var args = new system_update_column_familyArgs(); + args.Cf_def = cf_def; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new system_update_column_familyResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "system_update_column_family failed: unknown result"); + } + + public async Task execute_cql_queryAsync(byte[] query, Compression compression, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Call, SeqId), + cancellationToken); + + var args = new execute_cql_queryArgs(); + args.Query = query; + args.Compression = compression; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new execute_cql_queryResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "execute_cql_query failed: unknown result"); + } + + public async Task prepare_cql_queryAsync(byte[] query, Compression compression, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Call, SeqId), + cancellationToken); + + var args = new prepare_cql_queryArgs(); + args.Query = query; + args.Compression = compression; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new prepare_cql_queryResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "prepare_cql_query failed: unknown result"); + } + + public async Task execute_prepared_cql_queryAsync(int itemId, List values, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync( + new TMessage("execute_prepared_cql_query", TMessageType.Call, SeqId), cancellationToken); + + var args = new execute_prepared_cql_queryArgs(); + args.ItemId = itemId; + args.Values = values; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new execute_prepared_cql_queryResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ire) + { + throw result.Ire; + } + if (result.__isset.ue) + { + throw result.Ue; + } + if (result.__isset.te) + { + throw result.Te; + } + if (result.__isset.sde) + { + throw result.Sde; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "execute_prepared_cql_query failed: unknown result"); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + protected Dictionary processMap_ = new Dictionary(); + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["login"] = login_ProcessAsync; + processMap_["set_keyspace"] = set_keyspace_ProcessAsync; + processMap_["get"] = get_ProcessAsync; + processMap_["get_slice"] = get_slice_ProcessAsync; + processMap_["get_count"] = get_count_ProcessAsync; + processMap_["multiget_slice"] = multiget_slice_ProcessAsync; + processMap_["multiget_count"] = multiget_count_ProcessAsync; + processMap_["get_range_slices"] = get_range_slices_ProcessAsync; + processMap_["get_indexed_slices"] = get_indexed_slices_ProcessAsync; + processMap_["insert"] = insert_ProcessAsync; + processMap_["add"] = add_ProcessAsync; + processMap_["remove"] = remove_ProcessAsync; + processMap_["remove_counter"] = remove_counter_ProcessAsync; + processMap_["batch_mutate"] = batch_mutate_ProcessAsync; + processMap_["truncate"] = truncate_ProcessAsync; + processMap_["describe_schema_versions"] = describe_schema_versions_ProcessAsync; + processMap_["describe_keyspaces"] = describe_keyspaces_ProcessAsync; + processMap_["describe_cluster_name"] = describe_cluster_name_ProcessAsync; + processMap_["describe_version"] = describe_version_ProcessAsync; + processMap_["describe_ring"] = describe_ring_ProcessAsync; + processMap_["describe_partitioner"] = describe_partitioner_ProcessAsync; + processMap_["describe_snitch"] = describe_snitch_ProcessAsync; + processMap_["describe_keyspace"] = describe_keyspace_ProcessAsync; + processMap_["describe_splits"] = describe_splits_ProcessAsync; + processMap_["system_add_column_family"] = system_add_column_family_ProcessAsync; + processMap_["system_drop_column_family"] = system_drop_column_family_ProcessAsync; + processMap_["system_add_keyspace"] = system_add_keyspace_ProcessAsync; + processMap_["system_drop_keyspace"] = system_drop_keyspace_ProcessAsync; + processMap_["system_update_keyspace"] = system_update_keyspace_ProcessAsync; + processMap_["system_update_column_family"] = system_update_column_family_ProcessAsync; + processMap_["execute_cql_query"] = execute_cql_query_ProcessAsync; + processMap_["prepare_cql_query"] = prepare_cql_query_ProcessAsync; + processMap_["execute_prepared_cql_query"] = execute_prepared_cql_query_ProcessAsync; + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task login_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new loginArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new loginResult(); + try + { + try + { + await _iAsync.loginAsync(args.Auth_request, cancellationToken); + } + catch (AuthenticationException authnx) + { + result.Authnx = authnx; + } + catch (AuthorizationException authzx) + { + result.Authzx = authzx; + } + await + oprot.WriteMessageBeginAsync(new TMessage("login", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("login", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task set_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new set_keyspaceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new set_keyspaceResult(); + try + { + try + { + await _iAsync.set_keyspaceAsync(args.Keyspace, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task get_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getResult(); + try + { + try + { + result.Success = + await + _iAsync.@getAsync(args.Key, args.Column_path, args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (NotFoundException nfe) + { + result.Nfe = nfe; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("get", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("get", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task get_slice_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new get_sliceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new get_sliceResult(); + try + { + try + { + result.Success = + await + _iAsync.get_sliceAsync(args.Key, args.Column_parent, args.Predicate, + args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task get_count_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new get_countArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new get_countResult(); + try + { + try + { + result.Success = + await + _iAsync.get_countAsync(args.Key, args.Column_parent, args.Predicate, + args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task multiget_slice_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new multiget_sliceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new multiget_sliceResult(); + try + { + try + { + result.Success = + await + _iAsync.multiget_sliceAsync(args.Keys, args.Column_parent, args.Predicate, + args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task multiget_count_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new multiget_countArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new multiget_countResult(); + try + { + try + { + result.Success = + await + _iAsync.multiget_countAsync(args.Keys, args.Column_parent, args.Predicate, + args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task get_range_slices_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new get_range_slicesArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new get_range_slicesResult(); + try + { + try + { + result.Success = + await + _iAsync.get_range_slicesAsync(args.Column_parent, args.Predicate, args.Range, + args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task get_indexed_slices_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new get_indexed_slicesArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new get_indexed_slicesResult(); + try + { + try + { + result.Success = + await + _iAsync.get_indexed_slicesAsync(args.Column_parent, args.Index_clause, + args.Column_predicate, args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task insert_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new insertArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new insertResult(); + try + { + try + { + await + _iAsync.insertAsync(args.Key, args.Column_parent, args.Column, args.Consistency_level, + cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task add_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new addArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new addResult(); + try + { + try + { + await + _iAsync.@addAsync(args.Key, args.Column_parent, args.Column, args.Consistency_level, + cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("add", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("add", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task remove_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new removeArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new removeResult(); + try + { + try + { + await + _iAsync.@removeAsync(args.Key, args.Column_path, args.Timestamp, args.Consistency_level, + cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task remove_counter_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new remove_counterArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new remove_counterResult(); + try + { + try + { + await + _iAsync.remove_counterAsync(args.Key, args.Path, args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task batch_mutate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new batch_mutateArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new batch_mutateResult(); + try + { + try + { + await _iAsync.batch_mutateAsync(args.Mutation_map, args.Consistency_level, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task truncate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new truncateArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new truncateResult(); + try + { + try + { + await _iAsync.truncateAsync(args.Cfname, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + await + oprot.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_schema_versions_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_schema_versionsArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_schema_versionsResult(); + try + { + try + { + result.Success = await _iAsync.describe_schema_versionsAsync(cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync( + new TMessage("describe_schema_versions", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("describe_schema_versions", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_keyspaces_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_keyspacesArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_keyspacesResult(); + try + { + try + { + result.Success = await _iAsync.describe_keyspacesAsync(cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_cluster_name_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_cluster_nameArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_cluster_nameResult(); + try + { + result.Success = await _iAsync.describe_cluster_nameAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_cluster_name", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("describe_cluster_name", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_version_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_versionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_versionResult(); + try + { + result.Success = await _iAsync.describe_versionAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_ring_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_ringArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_ringResult(); + try + { + try + { + result.Success = await _iAsync.describe_ringAsync(args.Keyspace, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_partitioner_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_partitionerArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_partitionerResult(); + try + { + result.Success = await _iAsync.describe_partitionerAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_partitioner", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("describe_partitioner", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_snitch_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_snitchArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_snitchResult(); + try + { + result.Success = await _iAsync.describe_snitchAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_keyspaceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_keyspaceResult(); + try + { + try + { + result.Success = await _iAsync.describe_keyspaceAsync(args.Keyspace, cancellationToken); + } + catch (NotFoundException nfe) + { + result.Nfe = nfe; + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task describe_splits_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new describe_splitsArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new describe_splitsResult(); + try + { + try + { + result.Success = + await + _iAsync.describe_splitsAsync(args.CfName, args.Start_token, args.End_token, + args.Keys_per_split, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_add_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_add_column_familyArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_add_column_familyResult(); + try + { + try + { + result.Success = await _iAsync.system_add_column_familyAsync(args.Cf_def, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync( + new TMessage("system_add_column_family", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_add_column_family", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_drop_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_drop_column_familyArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_drop_column_familyResult(); + try + { + try + { + result.Success = + await _iAsync.system_drop_column_familyAsync(args.Column_family, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync( + new TMessage("system_drop_column_family", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_drop_column_family", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_add_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_add_keyspaceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_add_keyspaceResult(); + try + { + try + { + result.Success = await _iAsync.system_add_keyspaceAsync(args.Ks_def, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync(new TMessage("system_add_keyspace", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_add_keyspace", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_drop_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_drop_keyspaceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_drop_keyspaceResult(); + try + { + try + { + result.Success = await _iAsync.system_drop_keyspaceAsync(args.Keyspace, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync(new TMessage("system_drop_keyspace", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_drop_keyspace", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_update_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_update_keyspaceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_update_keyspaceResult(); + try + { + try + { + result.Success = await _iAsync.system_update_keyspaceAsync(args.Ks_def, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync(new TMessage("system_update_keyspace", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_update_keyspace", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task system_update_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new system_update_column_familyArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new system_update_column_familyResult(); + try + { + try + { + result.Success = await _iAsync.system_update_column_familyAsync(args.Cf_def, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync( + new TMessage("system_update_column_family", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("system_update_column_family", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task execute_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new execute_cql_queryArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new execute_cql_queryResult(); + try + { + try + { + result.Success = + await _iAsync.execute_cql_queryAsync(args.Query, args.Compression, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task prepare_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new prepare_cql_queryArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new prepare_cql_queryResult(); + try + { + try + { + result.Success = + await _iAsync.prepare_cql_queryAsync(args.Query, args.Compression, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + await + oprot.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task execute_prepared_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new execute_prepared_cql_queryArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new execute_prepared_cql_queryResult(); + try + { + try + { + result.Success = + await _iAsync.execute_prepared_cql_queryAsync(args.ItemId, args.Values, cancellationToken); + } + catch (InvalidRequestException ire) + { + result.Ire = ire; + } + catch (UnavailableException ue) + { + result.Ue = ue; + } + catch (TimedOutException te) + { + result.Te = te; + } + catch (SchemaDisagreementException sde) + { + result.Sde = sde; + } + await + oprot.WriteMessageBeginAsync( + new TMessage("execute_prepared_cql_query", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync( + new TMessage("execute_prepared_cql_query", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + protected delegate Task ProcessFunction( + int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } + + + [DataContract(Namespace = "")] + public partial class loginArgs : TBase + { + public loginArgs() + { + } + + public loginArgs(AuthenticationRequest auth_request) : this() + { + this.Auth_request = auth_request; + } + + [DataMember(Order = 0)] + public AuthenticationRequest Auth_request { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_auth_request = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Auth_request = new AuthenticationRequest(); + await Auth_request.ReadAsync(iprot, cancellationToken); + isset_auth_request = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_auth_request) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("login_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "auth_request"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Auth_request.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("login_args("); + sb.Append(", Auth_request: "); + sb.Append(Auth_request == null ? "" : Auth_request.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class loginResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private AuthenticationException _authnx; + private AuthorizationException _authzx; + + public loginResult() + { + } + + [DataMember(Order = 0)] + public AuthenticationException Authnx + { + get { return _authnx; } + set + { + __isset.authnx = true; + this._authnx = value; + } + } + + [DataMember(Order = 0)] + public AuthorizationException Authzx + { + get { return _authzx; } + set + { + __isset.authzx = true; + this._authzx = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Authnx = new AuthenticationException(); + await Authnx.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Authzx = new AuthorizationException(); + await Authzx.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("login_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.authnx) + { + if (Authnx != null) + { + field.Name = "Authnx"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Authnx.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.authzx) + { + if (Authzx != null) + { + field.Name = "Authzx"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Authzx.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("login_result("); + bool __first = true; + if (Authnx != null && __isset.authnx) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Authnx: "); + sb.Append(Authnx == null ? "" : Authnx.ToString()); + } + if (Authzx != null && __isset.authzx) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Authzx: "); + sb.Append(Authzx == null ? "" : Authzx.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool authnx; + [DataMember] public bool authzx; + } + + #region XmlSerializer support + + public bool ShouldSerializeAuthnx() + { + return __isset.authnx; + } + + public bool ShouldSerializeAuthzx() + { + return __isset.authzx; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class set_keyspaceArgs : TBase + { + public set_keyspaceArgs() + { + } + + public set_keyspaceArgs(string keyspace) : this() + { + this.Keyspace = keyspace; + } + + [DataMember(Order = 0)] + public string Keyspace { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keyspace = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Keyspace = await iprot.ReadStringAsync(cancellationToken); + isset_keyspace = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keyspace) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("set_keyspace_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keyspace"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Keyspace, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("set_keyspace_args("); + sb.Append(", Keyspace: "); + sb.Append(Keyspace); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class set_keyspaceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + + public set_keyspaceResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("set_keyspace_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("set_keyspace_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + } + } + + + [DataContract(Namespace = "")] + public partial class getArgs : TBase + { + public getArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public getArgs(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level) : this() + { + this.Key = key; + this.Column_path = column_path; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnPath Column_path { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_path = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_path = new ColumnPath(); + await Column_path.ReadAsync(iprot, cancellationToken); + isset_column_path = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_path) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_path"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_path.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_path: "); + sb.Append(Column_path == null ? "" : Column_path.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private NotFoundException _nfe; + private ColumnOrSuperColumn _success; + private TimedOutException _te; + private UnavailableException _ue; + + public getResult() + { + } + + [DataMember(Order = 0)] + public ColumnOrSuperColumn Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public NotFoundException Nfe + { + get { return _nfe; } + set + { + __isset.nfe = true; + this._nfe = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new ColumnOrSuperColumn(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Nfe = new NotFoundException(); + await Nfe.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.nfe) + { + if (Nfe != null) + { + field.Name = "Nfe"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Nfe.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Nfe != null && __isset.nfe) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Nfe: "); + sb.Append(Nfe == null ? "" : Nfe.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool nfe; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeNfe() + { + return __isset.nfe; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class get_sliceArgs : TBase + { + public get_sliceArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public get_sliceArgs(byte[] key, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level) : this() + { + this.Key = key; + this.Column_parent = column_parent; + this.Predicate = predicate; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Predicate { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + isset_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_slice_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_slice_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class get_sliceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + private TimedOutException _te; + private UnavailableException _ue; + + public get_sliceResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list83 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i84 = 0; _i84 < _list83.Count; ++_i84) + { + ColumnOrSuperColumn _elem85; + _elem85 = new ColumnOrSuperColumn(); + await _elem85.ReadAsync(iprot, cancellationToken); + Success.Add(_elem85); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_slice_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); + foreach (ColumnOrSuperColumn _iter86 in Success) + { + await _iter86.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_slice_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class get_countArgs : TBase + { + public get_countArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public get_countArgs(byte[] key, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level) : this() + { + this.Key = key; + this.Column_parent = column_parent; + this.Predicate = predicate; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Predicate { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + isset_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_count_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_count_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class get_countResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private int _success; + private TimedOutException _te; + private UnavailableException _ue; + + public get_countResult() + { + } + + [DataMember(Order = 0)] + public int Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_count_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_count_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class multiget_sliceArgs : TBase + { + public multiget_sliceArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public multiget_sliceArgs(List keys, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level) : this() + { + this.Keys = keys; + this.Column_parent = column_parent; + this.Predicate = predicate; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public List Keys { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Predicate { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keys = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Keys = new List(); + TList _list87 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i88 = 0; _i88 < _list87.Count; ++_i88) + { + byte[] _elem89; + _elem89 = await iprot.ReadBinaryAsync(cancellationToken); + Keys.Add(_elem89); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_keys = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + isset_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keys) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("multiget_slice_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keys"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Keys.Count), cancellationToken); + foreach (byte[] _iter90 in Keys) + { + await oprot.WriteBinaryAsync(_iter90, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("multiget_slice_args("); + sb.Append(", Keys: "); + sb.Append(Keys); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class multiget_sliceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private Dictionary> _success; + private TimedOutException _te; + private UnavailableException _ue; + + public multiget_sliceResult() + { + } + + [DataMember(Order = 0)] + public Dictionary> Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map91 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i92 = 0; _i92 < _map91.Count; ++_i92) + { + byte[] _key93; + List _val94; + _key93 = await iprot.ReadBinaryAsync(cancellationToken); + { + _val94 = new List(); + TList _list95 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i96 = 0; _i96 < _list95.Count; ++_i96) + { + ColumnOrSuperColumn _elem97; + _elem97 = new ColumnOrSuperColumn(); + await _elem97.ReadAsync(iprot, cancellationToken); + _val94.Add(_elem97); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Success[_key93] = _val94; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("multiget_slice_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.List, Success.Count), + cancellationToken); + foreach (byte[] _iter98 in Success.Keys) + { + await oprot.WriteBinaryAsync(_iter98, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success[_iter98].Count), + cancellationToken); + foreach (ColumnOrSuperColumn _iter99 in Success[_iter98]) + { + await _iter99.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("multiget_slice_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class multiget_countArgs : TBase + { + public multiget_countArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public multiget_countArgs(List keys, ColumnParent column_parent, SlicePredicate predicate, + ConsistencyLevel consistency_level) : this() + { + this.Keys = keys; + this.Column_parent = column_parent; + this.Predicate = predicate; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public List Keys { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Predicate { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keys = false; + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Keys = new List(); + TList _list100 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i101 = 0; _i101 < _list100.Count; ++_i101) + { + byte[] _elem102; + _elem102 = await iprot.ReadBinaryAsync(cancellationToken); + Keys.Add(_elem102); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_keys = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + isset_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keys) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("multiget_count_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keys"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Keys.Count), cancellationToken); + foreach (byte[] _iter103 in Keys) + { + await oprot.WriteBinaryAsync(_iter103, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("multiget_count_args("); + sb.Append(", Keys: "); + sb.Append(Keys); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class multiget_countResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private Dictionary _success; + private TimedOutException _te; + private UnavailableException _ue; + + public multiget_countResult() + { + } + + [DataMember(Order = 0)] + public Dictionary Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i105 = 0; _i105 < _map104.Count; ++_i105) + { + byte[] _key106; + int _val107; + _key106 = await iprot.ReadBinaryAsync(cancellationToken); + _val107 = await iprot.ReadI32Async(cancellationToken); + Success[_key106] = _val107; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("multiget_count_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.I32, Success.Count), + cancellationToken); + foreach (byte[] _iter108 in Success.Keys) + { + await oprot.WriteBinaryAsync(_iter108, cancellationToken); + await oprot.WriteI32Async(Success[_iter108], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("multiget_count_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class get_range_slicesArgs : TBase + { + public get_range_slicesArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public get_range_slicesArgs(ColumnParent column_parent, SlicePredicate predicate, KeyRange range, + ConsistencyLevel consistency_level) : this() + { + this.Column_parent = column_parent; + this.Predicate = predicate; + this.Range = range; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Predicate { get; set; } + + [DataMember(Order = 0)] + public KeyRange Range { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_parent = false; + bool isset_predicate = false; + bool isset_range = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + isset_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Range = new KeyRange(); + await Range.ReadAsync(iprot, cancellationToken); + isset_range = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_range) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_range_slices_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "range"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Range.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_range_slices_args("); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + sb.Append(", Range: "); + sb.Append(Range == null ? "" : Range.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class get_range_slicesResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + private TimedOutException _te; + private UnavailableException _ue; + + public get_range_slicesResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list109 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i110 = 0; _i110 < _list109.Count; ++_i110) + { + KeySlice _elem111; + _elem111 = new KeySlice(); + await _elem111.ReadAsync(iprot, cancellationToken); + Success.Add(_elem111); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_range_slices_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); + foreach (KeySlice _iter112 in Success) + { + await _iter112.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_range_slices_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class get_indexed_slicesArgs : TBase + { + public get_indexed_slicesArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public get_indexed_slicesArgs(ColumnParent column_parent, IndexClause index_clause, + SlicePredicate column_predicate, ConsistencyLevel consistency_level) : this() + { + this.Column_parent = column_parent; + this.Index_clause = index_clause; + this.Column_predicate = column_predicate; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public IndexClause Index_clause { get; set; } + + [DataMember(Order = 0)] + public SlicePredicate Column_predicate { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_parent = false; + bool isset_index_clause = false; + bool isset_column_predicate = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Index_clause = new IndexClause(); + await Index_clause.ReadAsync(iprot, cancellationToken); + isset_index_clause = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Column_predicate = new SlicePredicate(); + await Column_predicate.ReadAsync(iprot, cancellationToken); + isset_column_predicate = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_index_clause) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_predicate) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_indexed_slices_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "index_clause"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Index_clause.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_indexed_slices_args("); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Index_clause: "); + sb.Append(Index_clause == null ? "" : Index_clause.ToString()); + sb.Append(", Column_predicate: "); + sb.Append(Column_predicate == null ? "" : Column_predicate.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class get_indexed_slicesResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + private TimedOutException _te; + private UnavailableException _ue; + + public get_indexed_slicesResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list113 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i114 = 0; _i114 < _list113.Count; ++_i114) + { + KeySlice _elem115; + _elem115 = new KeySlice(); + await _elem115.ReadAsync(iprot, cancellationToken); + Success.Add(_elem115); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("get_indexed_slices_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); + foreach (KeySlice _iter116 in Success) + { + await _iter116.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("get_indexed_slices_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class insertArgs : TBase + { + public insertArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public insertArgs(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level) + : this() + { + this.Key = key; + this.Column_parent = column_parent; + this.Column = column; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public Column Column { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_parent = false; + bool isset_column = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Column = new Column(); + await Column.ReadAsync(iprot, cancellationToken); + isset_column = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("insert_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("insert_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Column: "); + sb.Append(Column == null ? "" : Column.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class insertResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public insertResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("insert_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("insert_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class addArgs : TBase + { + public addArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public addArgs(byte[] key, ColumnParent column_parent, CounterColumn column, + ConsistencyLevel consistency_level) : this() + { + this.Key = key; + this.Column_parent = column_parent; + this.Column = column; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnParent Column_parent { get; set; } + + [DataMember(Order = 0)] + public CounterColumn Column { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_parent = false; + bool isset_column = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_parent = new ColumnParent(); + await Column_parent.ReadAsync(iprot, cancellationToken); + isset_column_parent = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Column = new CounterColumn(); + await Column.ReadAsync(iprot, cancellationToken); + isset_column = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_parent) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("add_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_parent"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_parent.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("add_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_parent: "); + sb.Append(Column_parent == null ? "" : Column_parent.ToString()); + sb.Append(", Column: "); + sb.Append(Column == null ? "" : Column.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class addResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public addResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("add_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("add_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class removeArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private ConsistencyLevel _consistency_level; + + public removeArgs() + { + this._consistency_level = ConsistencyLevel.ONE; + this.__isset.consistency_level = true; + } + + public removeArgs(byte[] key, ColumnPath column_path, long timestamp) : this() + { + this.Key = key; + this.Column_path = column_path; + this.Timestamp = timestamp; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnPath Column_path { get; set; } + + [DataMember(Order = 0)] + public long Timestamp { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level + { + get { return _consistency_level; } + set + { + __isset.consistency_level = true; + this._consistency_level = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_column_path = false; + bool isset_timestamp = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Column_path = new ColumnPath(); + await Column_path.ReadAsync(iprot, cancellationToken); + isset_column_path = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I64) + { + Timestamp = await iprot.ReadI64Async(cancellationToken); + isset_timestamp = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_column_path) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_timestamp) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("remove_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "column_path"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_path.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "timestamp"; + field.Type = TType.I64; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Timestamp, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (__isset.consistency_level) + { + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeConsistency_level() + { + return __isset.consistency_level; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("remove_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Column_path: "); + sb.Append(Column_path == null ? "" : Column_path.ToString()); + sb.Append(", Timestamp: "); + sb.Append(Timestamp); + if (__isset.consistency_level) + { + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool consistency_level; + } + } + + + [DataContract(Namespace = "")] + public partial class removeResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public removeResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("remove_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("remove_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class remove_counterArgs : TBase + { + public remove_counterArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public remove_counterArgs(byte[] key, ColumnPath path, ConsistencyLevel consistency_level) : this() + { + this.Key = key; + this.Path = path; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public ColumnPath Path { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_path = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Path = new ColumnPath(); + await Path.ReadAsync(iprot, cancellationToken); + isset_path = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_path) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("remove_counter_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "path"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Path.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("remove_counter_args("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Path: "); + sb.Append(Path == null ? "" : Path.ToString()); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class remove_counterResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public remove_counterResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("remove_counter_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("remove_counter_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class batch_mutateArgs : TBase + { + public batch_mutateArgs() + { + this.Consistency_level = ConsistencyLevel.ONE; + } + + public batch_mutateArgs(Dictionary>> mutation_map, + ConsistencyLevel consistency_level) : this() + { + this.Mutation_map = mutation_map; + this.Consistency_level = consistency_level; + } + + [DataMember(Order = 0)] + public Dictionary>> Mutation_map { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public ConsistencyLevel Consistency_level { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_mutation_map = false; + bool isset_consistency_level = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Mutation_map = new Dictionary>>(); + TMap _map117 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i118 = 0; _i118 < _map117.Count; ++_i118) + { + byte[] _key119; + Dictionary> _val120; + _key119 = await iprot.ReadBinaryAsync(cancellationToken); + { + _val120 = new Dictionary>(); + TMap _map121 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i122 = 0; _i122 < _map121.Count; ++_i122) + { + string _key123; + List _val124; + _key123 = await iprot.ReadStringAsync(cancellationToken); + { + _val124 = new List(); + TList _list125 = + await iprot.ReadListBeginAsync(cancellationToken); + for (int _i126 = 0; _i126 < _list125.Count; ++_i126) + { + Mutation _elem127; + _elem127 = new Mutation(); + await _elem127.ReadAsync(iprot, cancellationToken); + _val124.Add(_elem127); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _val120[_key123] = _val124; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Mutation_map[_key119] = _val120; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + isset_mutation_map = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); + isset_consistency_level = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_mutation_map) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_consistency_level) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("batch_mutate_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "mutation_map"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.Map, Mutation_map.Count), + cancellationToken); + foreach (byte[] _iter128 in Mutation_map.Keys) + { + await oprot.WriteBinaryAsync(_iter128, cancellationToken); + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.String, TType.List, Mutation_map[_iter128].Count), + cancellationToken); + foreach (string _iter129 in Mutation_map[_iter128].Keys) + { + await oprot.WriteStringAsync(_iter129, cancellationToken); + { + await + oprot.WriteListBeginAsync( + new TList(TType.Struct, Mutation_map[_iter128][_iter129].Count), + cancellationToken); + foreach (Mutation _iter130 in Mutation_map[_iter128][_iter129]) + { + await _iter130.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "consistency_level"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Consistency_level, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("batch_mutate_args("); + sb.Append(", Mutation_map: "); + sb.Append(Mutation_map); + sb.Append(", Consistency_level: "); + sb.Append(Consistency_level); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class batch_mutateResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public batch_mutateResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("batch_mutate_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("batch_mutate_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class truncateArgs : TBase + { + public truncateArgs() + { + } + + public truncateArgs(string cfname) : this() + { + this.Cfname = cfname; + } + + [DataMember(Order = 0)] + public string Cfname { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_cfname = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Cfname = await iprot.ReadStringAsync(cancellationToken); + isset_cfname = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_cfname) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("truncate_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "cfname"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Cfname, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("truncate_args("); + sb.Append(", Cfname: "); + sb.Append(Cfname); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class truncateResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private TimedOutException _te; + private UnavailableException _ue; + + public truncateResult() + { + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("truncate_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("truncate_result("); + bool __first = true; + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + } + + #region XmlSerializer support + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class describe_schema_versionsArgs : TBase + { + public describe_schema_versionsArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_schema_versions_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_schema_versions_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_schema_versionsResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private Dictionary> _success; + + public describe_schema_versionsResult() + { + } + + [DataMember(Order = 0)] + public Dictionary> Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map131 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i132 = 0; _i132 < _map131.Count; ++_i132) + { + string _key133; + List _val134; + _key133 = await iprot.ReadStringAsync(cancellationToken); + { + _val134 = new List(); + TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i136 = 0; _i136 < _list135.Count; ++_i136) + { + string _elem137; + _elem137 = await iprot.ReadStringAsync(cancellationToken); + _val134.Add(_elem137); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Success[_key133] = _val134; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_schema_versions_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.List, Success.Count), + cancellationToken); + foreach (string _iter138 in Success.Keys) + { + await oprot.WriteStringAsync(_iter138, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.String, Success[_iter138].Count), + cancellationToken); + foreach (string _iter139 in Success[_iter138]) + { + await oprot.WriteStringAsync(_iter139, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_schema_versions_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class describe_keyspacesArgs : TBase + { + public describe_keyspacesArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_keyspaces_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_keyspaces_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_keyspacesResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + + public describe_keyspacesResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list140 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i141 = 0; _i141 < _list140.Count; ++_i141) + { + KsDef _elem142; + _elem142 = new KsDef(); + await _elem142.ReadAsync(iprot, cancellationToken); + Success.Add(_elem142); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_keyspaces_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); + foreach (KsDef _iter143 in Success) + { + await _iter143.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_keyspaces_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class describe_cluster_nameArgs : TBase + { + public describe_cluster_nameArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_cluster_name_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_cluster_name_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_cluster_nameResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public describe_cluster_nameResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_cluster_name_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("describe_cluster_name_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class describe_versionArgs : TBase + { + public describe_versionArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_version_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_version_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_versionResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public describe_versionResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_version_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("describe_version_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class describe_ringArgs : TBase + { + public describe_ringArgs() + { + } + + public describe_ringArgs(string keyspace) : this() + { + this.Keyspace = keyspace; + } + + [DataMember(Order = 0)] + public string Keyspace { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keyspace = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Keyspace = await iprot.ReadStringAsync(cancellationToken); + isset_keyspace = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keyspace) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_ring_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keyspace"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Keyspace, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_ring_args("); + sb.Append(", Keyspace: "); + sb.Append(Keyspace); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_ringResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + + public describe_ringResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list144 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i145 = 0; _i145 < _list144.Count; ++_i145) + { + TokenRange _elem146; + _elem146 = new TokenRange(); + await _elem146.ReadAsync(iprot, cancellationToken); + Success.Add(_elem146); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_ring_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); + foreach (TokenRange _iter147 in Success) + { + await _iter147.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_ring_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class describe_partitionerArgs : TBase + { + public describe_partitionerArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_partitioner_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_partitioner_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_partitionerResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public describe_partitionerResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_partitioner_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("describe_partitioner_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class describe_snitchArgs : TBase + { + public describe_snitchArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_snitch_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_snitch_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_snitchResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public describe_snitchResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_snitch_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("describe_snitch_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class describe_keyspaceArgs : TBase + { + public describe_keyspaceArgs() + { + } + + public describe_keyspaceArgs(string keyspace) : this() + { + this.Keyspace = keyspace; + } + + [DataMember(Order = 0)] + public string Keyspace { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keyspace = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Keyspace = await iprot.ReadStringAsync(cancellationToken); + isset_keyspace = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keyspace) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_keyspace_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keyspace"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Keyspace, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_keyspace_args("); + sb.Append(", Keyspace: "); + sb.Append(Keyspace); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_keyspaceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private NotFoundException _nfe; + private KsDef _success; + + public describe_keyspaceResult() + { + } + + [DataMember(Order = 0)] + public KsDef Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public NotFoundException Nfe + { + get { return _nfe; } + set + { + __isset.nfe = true; + this._nfe = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new KsDef(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Nfe = new NotFoundException(); + await Nfe.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_keyspace_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.nfe) + { + if (Nfe != null) + { + field.Name = "Nfe"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Nfe.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_keyspace_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Nfe != null && __isset.nfe) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Nfe: "); + sb.Append(Nfe == null ? "" : Nfe.ToString()); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool nfe; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeNfe() + { + return __isset.nfe; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class describe_splitsArgs : TBase + { + public describe_splitsArgs() + { + } + + public describe_splitsArgs(string cfName, string start_token, string end_token, int keys_per_split) : this() + { + this.CfName = cfName; + this.Start_token = start_token; + this.End_token = end_token; + this.Keys_per_split = keys_per_split; + } + + [DataMember(Order = 0)] + public string CfName { get; set; } + + [DataMember(Order = 0)] + public string Start_token { get; set; } + + [DataMember(Order = 0)] + public string End_token { get; set; } + + [DataMember(Order = 0)] + public int Keys_per_split { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_cfName = false; + bool isset_start_token = false; + bool isset_end_token = false; + bool isset_keys_per_split = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + CfName = await iprot.ReadStringAsync(cancellationToken); + isset_cfName = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Start_token = await iprot.ReadStringAsync(cancellationToken); + isset_start_token = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + End_token = await iprot.ReadStringAsync(cancellationToken); + isset_end_token = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Keys_per_split = await iprot.ReadI32Async(cancellationToken); + isset_keys_per_split = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_cfName) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_start_token) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_end_token) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_keys_per_split) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_splits_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "cfName"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(CfName, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "start_token"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Start_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "end_token"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(End_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "keys_per_split"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Keys_per_split, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_splits_args("); + sb.Append(", CfName: "); + sb.Append(CfName); + sb.Append(", Start_token: "); + sb.Append(Start_token); + sb.Append(", End_token: "); + sb.Append(End_token); + sb.Append(", Keys_per_split: "); + sb.Append(Keys_per_split); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class describe_splitsResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private List _success; + + public describe_splitsResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list148 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i149 = 0; _i149 < _list148.Count; ++_i149) + { + string _elem150; + _elem150 = await iprot.ReadStringAsync(cancellationToken); + Success.Add(_elem150); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("describe_splits_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.String, Success.Count), cancellationToken); + foreach (string _iter151 in Success) + { + await oprot.WriteStringAsync(_iter151, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("describe_splits_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_add_column_familyArgs : TBase + { + public system_add_column_familyArgs() + { + } + + public system_add_column_familyArgs(CfDef cf_def) : this() + { + this.Cf_def = cf_def; + } + + [DataMember(Order = 0)] + public CfDef Cf_def { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_cf_def = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Cf_def = new CfDef(); + await Cf_def.ReadAsync(iprot, cancellationToken); + isset_cf_def = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_cf_def) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_add_column_family_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "cf_def"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Cf_def.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_add_column_family_args("); + sb.Append(", Cf_def: "); + sb.Append(Cf_def == null ? "" : Cf_def.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_add_column_familyResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_add_column_familyResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_add_column_family_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_add_column_family_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_drop_column_familyArgs : TBase + { + public system_drop_column_familyArgs() + { + } + + public system_drop_column_familyArgs(string column_family) : this() + { + this.Column_family = column_family; + } + + [DataMember(Order = 0)] + public string Column_family { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_family = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Column_family = await iprot.ReadStringAsync(cancellationToken); + isset_column_family = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_family) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_drop_column_family_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_family"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Column_family, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_drop_column_family_args("); + sb.Append(", Column_family: "); + sb.Append(Column_family); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_drop_column_familyResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_drop_column_familyResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_drop_column_family_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_drop_column_family_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_add_keyspaceArgs : TBase + { + public system_add_keyspaceArgs() + { + } + + public system_add_keyspaceArgs(KsDef ks_def) : this() + { + this.Ks_def = ks_def; + } + + [DataMember(Order = 0)] + public KsDef Ks_def { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_ks_def = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ks_def = new KsDef(); + await Ks_def.ReadAsync(iprot, cancellationToken); + isset_ks_def = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_ks_def) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_add_keyspace_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "ks_def"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ks_def.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_add_keyspace_args("); + sb.Append(", Ks_def: "); + sb.Append(Ks_def == null ? "" : Ks_def.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_add_keyspaceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_add_keyspaceResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_add_keyspace_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_add_keyspace_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_drop_keyspaceArgs : TBase + { + public system_drop_keyspaceArgs() + { + } + + public system_drop_keyspaceArgs(string keyspace) : this() + { + this.Keyspace = keyspace; + } + + [DataMember(Order = 0)] + public string Keyspace { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keyspace = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Keyspace = await iprot.ReadStringAsync(cancellationToken); + isset_keyspace = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keyspace) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_drop_keyspace_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keyspace"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Keyspace, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_drop_keyspace_args("); + sb.Append(", Keyspace: "); + sb.Append(Keyspace); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_drop_keyspaceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_drop_keyspaceResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_drop_keyspace_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_drop_keyspace_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_update_keyspaceArgs : TBase + { + public system_update_keyspaceArgs() + { + } + + public system_update_keyspaceArgs(KsDef ks_def) : this() + { + this.Ks_def = ks_def; + } + + [DataMember(Order = 0)] + public KsDef Ks_def { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_ks_def = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Ks_def = new KsDef(); + await Ks_def.ReadAsync(iprot, cancellationToken); + isset_ks_def = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_ks_def) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_update_keyspace_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "ks_def"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ks_def.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_update_keyspace_args("); + sb.Append(", Ks_def: "); + sb.Append(Ks_def == null ? "" : Ks_def.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_update_keyspaceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_update_keyspaceResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_update_keyspace_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_update_keyspace_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class system_update_column_familyArgs : TBase + { + public system_update_column_familyArgs() + { + } + + public system_update_column_familyArgs(CfDef cf_def) : this() + { + this.Cf_def = cf_def; + } + + [DataMember(Order = 0)] + public CfDef Cf_def { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_cf_def = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Cf_def = new CfDef(); + await Cf_def.ReadAsync(iprot, cancellationToken); + isset_cf_def = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_cf_def) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_update_column_family_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "cf_def"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Cf_def.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_update_column_family_args("); + sb.Append(", Cf_def: "); + sb.Append(Cf_def == null ? "" : Cf_def.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class system_update_column_familyResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private string _success; + + public system_update_column_familyResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("system_update_column_family_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("system_update_column_family_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class execute_cql_queryArgs : TBase + { + public execute_cql_queryArgs() + { + } + + public execute_cql_queryArgs(byte[] query, Compression compression) : this() + { + this.Query = query; + this.Compression = compression; + } + + [DataMember(Order = 0)] + public byte[] Query { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public Compression Compression { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_query = false; + bool isset_compression = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Query = await iprot.ReadBinaryAsync(cancellationToken); + isset_query = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Compression = (Compression) await iprot.ReadI32Async(cancellationToken); + isset_compression = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_query) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_compression) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("execute_cql_query_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "query"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Query, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "compression"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Compression, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("execute_cql_query_args("); + sb.Append(", Query: "); + sb.Append(Query); + sb.Append(", Compression: "); + sb.Append(Compression); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class execute_cql_queryResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private CqlResult _success; + private TimedOutException _te; + private UnavailableException _ue; + + public execute_cql_queryResult() + { + } + + [DataMember(Order = 0)] + public CqlResult Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new CqlResult(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("execute_cql_query_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("execute_cql_query_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class prepare_cql_queryArgs : TBase + { + public prepare_cql_queryArgs() + { + } + + public prepare_cql_queryArgs(byte[] query, Compression compression) : this() + { + this.Query = query; + this.Compression = compression; + } + + [DataMember(Order = 0)] + public byte[] Query { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public Compression Compression { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_query = false; + bool isset_compression = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Query = await iprot.ReadBinaryAsync(cancellationToken); + isset_query = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Compression = (Compression) await iprot.ReadI32Async(cancellationToken); + isset_compression = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_query) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_compression) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("prepare_cql_query_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "query"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Query, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "compression"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Compression, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("prepare_cql_query_args("); + sb.Append(", Query: "); + sb.Append(Query); + sb.Append(", Compression: "); + sb.Append(Compression); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class prepare_cql_queryResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private CqlPreparedResult _success; + + public prepare_cql_queryResult() + { + } + + [DataMember(Order = 0)] + public CqlPreparedResult Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new CqlPreparedResult(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("prepare_cql_query_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("prepare_cql_query_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class execute_prepared_cql_queryArgs : TBase + { + public execute_prepared_cql_queryArgs() + { + } + + public execute_prepared_cql_queryArgs(int itemId, List values) : this() + { + this.ItemId = itemId; + this.Values = values; + } + + [DataMember(Order = 0)] + public int ItemId { get; set; } + + [DataMember(Order = 0)] + public List Values { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_itemId = false; + bool isset_values = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ItemId = await iprot.ReadI32Async(cancellationToken); + isset_itemId = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Values = new List(); + TList _list152 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i153 = 0; _i153 < _list152.Count; ++_i153) + { + string _elem154; + _elem154 = await iprot.ReadStringAsync(cancellationToken); + Values.Add(_elem154); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_values = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_itemId) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_values) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("execute_prepared_cql_query_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "itemId"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ItemId, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "values"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Values.Count), cancellationToken); + foreach (string _iter155 in Values) + { + await oprot.WriteStringAsync(_iter155, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("execute_prepared_cql_query_args("); + sb.Append(", ItemId: "); + sb.Append(ItemId); + sb.Append(", Values: "); + sb.Append(Values); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class execute_prepared_cql_queryResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidRequestException _ire; + private SchemaDisagreementException _sde; + private CqlResult _success; + private TimedOutException _te; + private UnavailableException _ue; + + public execute_prepared_cql_queryResult() + { + } + + [DataMember(Order = 0)] + public CqlResult Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidRequestException Ire + { + get { return _ire; } + set + { + __isset.ire = true; + this._ire = value; + } + } + + [DataMember(Order = 0)] + public UnavailableException Ue + { + get { return _ue; } + set + { + __isset.ue = true; + this._ue = value; + } + } + + [DataMember(Order = 0)] + public TimedOutException Te + { + get { return _te; } + set + { + __isset.te = true; + this._te = value; + } + } + + [DataMember(Order = 0)] + public SchemaDisagreementException Sde + { + get { return _sde; } + set + { + __isset.sde = true; + this._sde = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new CqlResult(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ire = new InvalidRequestException(); + await Ire.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ue = new UnavailableException(); + await Ue.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Te = new TimedOutException(); + await Te.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Struct) + { + Sde = new SchemaDisagreementException(); + await Sde.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("execute_prepared_cql_query_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ire) + { + if (Ire != null) + { + field.Name = "Ire"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ire.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.ue) + { + if (Ue != null) + { + field.Name = "Ue"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ue.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.te) + { + if (Te != null) + { + field.Name = "Te"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Te.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.sde) + { + if (Sde != null) + { + field.Name = "Sde"; + field.Type = TType.Struct; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Sde.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("execute_prepared_cql_query_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Ire != null && __isset.ire) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ire: "); + sb.Append(Ire == null ? "" : Ire.ToString()); + } + if (Ue != null && __isset.ue) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ue: "); + sb.Append(Ue == null ? "" : Ue.ToString()); + } + if (Te != null && __isset.te) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Te: "); + sb.Append(Te == null ? "" : Te.ToString()); + } + if (Sde != null && __isset.sde) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Sde: "); + sb.Append(Sde == null ? "" : Sde.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ire; + [DataMember] public bool ue; + [DataMember] public bool te; + [DataMember] public bool sde; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeIre() + { + return __isset.ire; + } + + public bool ShouldSerializeUe() + { + return __isset.ue; + } + + public bool ShouldSerializeTe() + { + return __isset.te; + } + + public bool ShouldSerializeSde() + { + return __isset.sde; + } + + #endregion XmlSerializer support + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs new file mode 100644 index 00000000000..c580141e9be --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; + + +namespace Apache.Cassandra.Test +{ + public static class CassandraTestConstants + { + public const string VERSION = "19.24.0"; + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs new file mode 100644 index 00000000000..cd75c9b5198 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs @@ -0,0 +1,1043 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CfDef : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private double _bloom_filter_fp_chance; + private List _column_metadata; + private string _column_type; + private string _comment; + private string _compaction_strategy; + private Dictionary _compaction_strategy_options; + private string _comparator_type; + private Dictionary _compression_options; + private string _default_validation_class; + private int _gc_grace_seconds; + private int _id; + private byte[] _key_alias; + private string _key_validation_class; + private int _max_compaction_threshold; + private double _merge_shards_chance; + private int _min_compaction_threshold; + private double _read_repair_chance; + private bool _replicate_on_write; + private string _subcomparator_type; + + public CfDef() + { + this._column_type = "Standard"; + this.__isset.column_type = true; + this._comparator_type = "BytesType"; + this.__isset.comparator_type = true; + this._read_repair_chance = 1; + this.__isset.read_repair_chance = true; + } + + public CfDef(string keyspace, string name) : this() + { + this.Keyspace = keyspace; + this.Name = name; + } + + [DataMember(Order = 0)] + public string Keyspace { get; set; } + + [DataMember(Order = 0)] + public string Name { get; set; } + + [DataMember(Order = 0)] + public string Column_type + { + get { return _column_type; } + set + { + __isset.column_type = true; + this._column_type = value; + } + } + + [DataMember(Order = 0)] + public string Comparator_type + { + get { return _comparator_type; } + set + { + __isset.comparator_type = true; + this._comparator_type = value; + } + } + + [DataMember(Order = 0)] + public string Subcomparator_type + { + get { return _subcomparator_type; } + set + { + __isset.subcomparator_type = true; + this._subcomparator_type = value; + } + } + + [DataMember(Order = 0)] + public string Comment + { + get { return _comment; } + set + { + __isset.comment = true; + this._comment = value; + } + } + + [DataMember(Order = 0)] + public double Read_repair_chance + { + get { return _read_repair_chance; } + set + { + __isset.read_repair_chance = true; + this._read_repair_chance = value; + } + } + + [DataMember(Order = 0)] + public List Column_metadata + { + get { return _column_metadata; } + set + { + __isset.column_metadata = true; + this._column_metadata = value; + } + } + + [DataMember(Order = 0)] + public int Gc_grace_seconds + { + get { return _gc_grace_seconds; } + set + { + __isset.gc_grace_seconds = true; + this._gc_grace_seconds = value; + } + } + + [DataMember(Order = 0)] + public string Default_validation_class + { + get { return _default_validation_class; } + set + { + __isset.default_validation_class = true; + this._default_validation_class = value; + } + } + + [DataMember(Order = 0)] + public int Id + { + get { return _id; } + set + { + __isset.id = true; + this._id = value; + } + } + + [DataMember(Order = 0)] + public int Min_compaction_threshold + { + get { return _min_compaction_threshold; } + set + { + __isset.min_compaction_threshold = true; + this._min_compaction_threshold = value; + } + } + + [DataMember(Order = 0)] + public int Max_compaction_threshold + { + get { return _max_compaction_threshold; } + set + { + __isset.max_compaction_threshold = true; + this._max_compaction_threshold = value; + } + } + + [DataMember(Order = 0)] + public bool Replicate_on_write + { + get { return _replicate_on_write; } + set + { + __isset.replicate_on_write = true; + this._replicate_on_write = value; + } + } + + [DataMember(Order = 0)] + public double Merge_shards_chance + { + get { return _merge_shards_chance; } + set + { + __isset.merge_shards_chance = true; + this._merge_shards_chance = value; + } + } + + [DataMember(Order = 0)] + public string Key_validation_class + { + get { return _key_validation_class; } + set + { + __isset.key_validation_class = true; + this._key_validation_class = value; + } + } + + [DataMember(Order = 0)] + public byte[] Key_alias + { + get { return _key_alias; } + set + { + __isset.key_alias = true; + this._key_alias = value; + } + } + + [DataMember(Order = 0)] + public string Compaction_strategy + { + get { return _compaction_strategy; } + set + { + __isset.compaction_strategy = true; + this._compaction_strategy = value; + } + } + + [DataMember(Order = 0)] + public Dictionary Compaction_strategy_options + { + get { return _compaction_strategy_options; } + set + { + __isset.compaction_strategy_options = true; + this._compaction_strategy_options = value; + } + } + + [DataMember(Order = 0)] + public Dictionary Compression_options + { + get { return _compression_options; } + set + { + __isset.compression_options = true; + this._compression_options = value; + } + } + + [DataMember(Order = 0)] + public double Bloom_filter_fp_chance + { + get { return _bloom_filter_fp_chance; } + set + { + __isset.bloom_filter_fp_chance = true; + this._bloom_filter_fp_chance = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_keyspace = false; + bool isset_name = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Keyspace = await iprot.ReadStringAsync(cancellationToken); + isset_keyspace = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Name = await iprot.ReadStringAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Column_type = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.String) + { + Comparator_type = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.String) + { + Subcomparator_type = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 8: + if (field.Type == TType.String) + { + Comment = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 12: + if (field.Type == TType.Double) + { + Read_repair_chance = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 13: + if (field.Type == TType.List) + { + { + Column_metadata = new List(); + TList _list42 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i43 = 0; _i43 < _list42.Count; ++_i43) + { + ColumnDef _elem44; + _elem44 = new ColumnDef(); + await _elem44.ReadAsync(iprot, cancellationToken); + Column_metadata.Add(_elem44); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 14: + if (field.Type == TType.I32) + { + Gc_grace_seconds = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 15: + if (field.Type == TType.String) + { + Default_validation_class = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 16: + if (field.Type == TType.I32) + { + Id = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 17: + if (field.Type == TType.I32) + { + Min_compaction_threshold = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 18: + if (field.Type == TType.I32) + { + Max_compaction_threshold = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 24: + if (field.Type == TType.Bool) + { + Replicate_on_write = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 25: + if (field.Type == TType.Double) + { + Merge_shards_chance = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 26: + if (field.Type == TType.String) + { + Key_validation_class = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 28: + if (field.Type == TType.String) + { + Key_alias = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 29: + if (field.Type == TType.String) + { + Compaction_strategy = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 30: + if (field.Type == TType.Map) + { + { + Compaction_strategy_options = new Dictionary(); + TMap _map45 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i46 = 0; _i46 < _map45.Count; ++_i46) + { + string _key47; + string _val48; + _key47 = await iprot.ReadStringAsync(cancellationToken); + _val48 = await iprot.ReadStringAsync(cancellationToken); + Compaction_strategy_options[_key47] = _val48; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 32: + if (field.Type == TType.Map) + { + { + Compression_options = new Dictionary(); + TMap _map49 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i50 = 0; _i50 < _map49.Count; ++_i50) + { + string _key51; + string _val52; + _key51 = await iprot.ReadStringAsync(cancellationToken); + _val52 = await iprot.ReadStringAsync(cancellationToken); + Compression_options[_key51] = _val52; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 33: + if (field.Type == TType.Double) + { + Bloom_filter_fp_chance = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_keyspace) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CfDef"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "keyspace"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Keyspace, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "name"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Column_type != null && __isset.column_type) + { + field.Name = "column_type"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Column_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Comparator_type != null && __isset.comparator_type) + { + field.Name = "comparator_type"; + field.Type = TType.String; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Comparator_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Subcomparator_type != null && __isset.subcomparator_type) + { + field.Name = "subcomparator_type"; + field.Type = TType.String; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Subcomparator_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Comment != null && __isset.comment) + { + field.Name = "comment"; + field.Type = TType.String; + field.ID = 8; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Comment, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.read_repair_chance) + { + field.Name = "read_repair_chance"; + field.Type = TType.Double; + field.ID = 12; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Read_repair_chance, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Column_metadata != null && __isset.column_metadata) + { + field.Name = "column_metadata"; + field.Type = TType.List; + field.ID = 13; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Column_metadata.Count), cancellationToken); + foreach (ColumnDef _iter53 in Column_metadata) + { + await _iter53.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.gc_grace_seconds) + { + field.Name = "gc_grace_seconds"; + field.Type = TType.I32; + field.ID = 14; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Gc_grace_seconds, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Default_validation_class != null && __isset.default_validation_class) + { + field.Name = "default_validation_class"; + field.Type = TType.String; + field.ID = 15; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Default_validation_class, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.id) + { + field.Name = "id"; + field.Type = TType.I32; + field.ID = 16; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Id, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.min_compaction_threshold) + { + field.Name = "min_compaction_threshold"; + field.Type = TType.I32; + field.ID = 17; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Min_compaction_threshold, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.max_compaction_threshold) + { + field.Name = "max_compaction_threshold"; + field.Type = TType.I32; + field.ID = 18; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Max_compaction_threshold, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.replicate_on_write) + { + field.Name = "replicate_on_write"; + field.Type = TType.Bool; + field.ID = 24; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Replicate_on_write, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.merge_shards_chance) + { + field.Name = "merge_shards_chance"; + field.Type = TType.Double; + field.ID = 25; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Merge_shards_chance, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Key_validation_class != null && __isset.key_validation_class) + { + field.Name = "key_validation_class"; + field.Type = TType.String; + field.ID = 26; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Key_validation_class, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Key_alias != null && __isset.key_alias) + { + field.Name = "key_alias"; + field.Type = TType.String; + field.ID = 28; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key_alias, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Compaction_strategy != null && __isset.compaction_strategy) + { + field.Name = "compaction_strategy"; + field.Type = TType.String; + field.ID = 29; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Compaction_strategy, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Compaction_strategy_options != null && __isset.compaction_strategy_options) + { + field.Name = "compaction_strategy_options"; + field.Type = TType.Map; + field.ID = 30; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.String, TType.String, Compaction_strategy_options.Count), + cancellationToken); + foreach (string _iter54 in Compaction_strategy_options.Keys) + { + await oprot.WriteStringAsync(_iter54, cancellationToken); + await oprot.WriteStringAsync(Compaction_strategy_options[_iter54], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Compression_options != null && __isset.compression_options) + { + field.Name = "compression_options"; + field.Type = TType.Map; + field.ID = 32; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Compression_options.Count), + cancellationToken); + foreach (string _iter55 in Compression_options.Keys) + { + await oprot.WriteStringAsync(_iter55, cancellationToken); + await oprot.WriteStringAsync(Compression_options[_iter55], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.bloom_filter_fp_chance) + { + field.Name = "bloom_filter_fp_chance"; + field.Type = TType.Double; + field.ID = 33; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Bloom_filter_fp_chance, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CfDef("); + sb.Append(", Keyspace: "); + sb.Append(Keyspace); + sb.Append(", Name: "); + sb.Append(Name); + if (Column_type != null && __isset.column_type) + { + sb.Append(", Column_type: "); + sb.Append(Column_type); + } + if (Comparator_type != null && __isset.comparator_type) + { + sb.Append(", Comparator_type: "); + sb.Append(Comparator_type); + } + if (Subcomparator_type != null && __isset.subcomparator_type) + { + sb.Append(", Subcomparator_type: "); + sb.Append(Subcomparator_type); + } + if (Comment != null && __isset.comment) + { + sb.Append(", Comment: "); + sb.Append(Comment); + } + if (__isset.read_repair_chance) + { + sb.Append(", Read_repair_chance: "); + sb.Append(Read_repair_chance); + } + if (Column_metadata != null && __isset.column_metadata) + { + sb.Append(", Column_metadata: "); + sb.Append(Column_metadata); + } + if (__isset.gc_grace_seconds) + { + sb.Append(", Gc_grace_seconds: "); + sb.Append(Gc_grace_seconds); + } + if (Default_validation_class != null && __isset.default_validation_class) + { + sb.Append(", Default_validation_class: "); + sb.Append(Default_validation_class); + } + if (__isset.id) + { + sb.Append(", Id: "); + sb.Append(Id); + } + if (__isset.min_compaction_threshold) + { + sb.Append(", Min_compaction_threshold: "); + sb.Append(Min_compaction_threshold); + } + if (__isset.max_compaction_threshold) + { + sb.Append(", Max_compaction_threshold: "); + sb.Append(Max_compaction_threshold); + } + if (__isset.replicate_on_write) + { + sb.Append(", Replicate_on_write: "); + sb.Append(Replicate_on_write); + } + if (__isset.merge_shards_chance) + { + sb.Append(", Merge_shards_chance: "); + sb.Append(Merge_shards_chance); + } + if (Key_validation_class != null && __isset.key_validation_class) + { + sb.Append(", Key_validation_class: "); + sb.Append(Key_validation_class); + } + if (Key_alias != null && __isset.key_alias) + { + sb.Append(", Key_alias: "); + sb.Append(Key_alias); + } + if (Compaction_strategy != null && __isset.compaction_strategy) + { + sb.Append(", Compaction_strategy: "); + sb.Append(Compaction_strategy); + } + if (Compaction_strategy_options != null && __isset.compaction_strategy_options) + { + sb.Append(", Compaction_strategy_options: "); + sb.Append(Compaction_strategy_options); + } + if (Compression_options != null && __isset.compression_options) + { + sb.Append(", Compression_options: "); + sb.Append(Compression_options); + } + if (__isset.bloom_filter_fp_chance) + { + sb.Append(", Bloom_filter_fp_chance: "); + sb.Append(Bloom_filter_fp_chance); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool column_type; + [DataMember] public bool comparator_type; + [DataMember] public bool subcomparator_type; + [DataMember] public bool comment; + [DataMember] public bool read_repair_chance; + [DataMember] public bool column_metadata; + [DataMember] public bool gc_grace_seconds; + [DataMember] public bool default_validation_class; + [DataMember] public bool id; + [DataMember] public bool min_compaction_threshold; + [DataMember] public bool max_compaction_threshold; + [DataMember] public bool replicate_on_write; + [DataMember] public bool merge_shards_chance; + [DataMember] public bool key_validation_class; + [DataMember] public bool key_alias; + [DataMember] public bool compaction_strategy; + [DataMember] public bool compaction_strategy_options; + [DataMember] public bool compression_options; + [DataMember] public bool bloom_filter_fp_chance; + } + + #region XmlSerializer support + + public bool ShouldSerializeColumn_type() + { + return __isset.column_type; + } + + public bool ShouldSerializeComparator_type() + { + return __isset.comparator_type; + } + + public bool ShouldSerializeSubcomparator_type() + { + return __isset.subcomparator_type; + } + + public bool ShouldSerializeComment() + { + return __isset.comment; + } + + public bool ShouldSerializeRead_repair_chance() + { + return __isset.read_repair_chance; + } + + public bool ShouldSerializeColumn_metadata() + { + return __isset.column_metadata; + } + + public bool ShouldSerializeGc_grace_seconds() + { + return __isset.gc_grace_seconds; + } + + public bool ShouldSerializeDefault_validation_class() + { + return __isset.default_validation_class; + } + + public bool ShouldSerializeId() + { + return __isset.id; + } + + public bool ShouldSerializeMin_compaction_threshold() + { + return __isset.min_compaction_threshold; + } + + public bool ShouldSerializeMax_compaction_threshold() + { + return __isset.max_compaction_threshold; + } + + public bool ShouldSerializeReplicate_on_write() + { + return __isset.replicate_on_write; + } + + public bool ShouldSerializeMerge_shards_chance() + { + return __isset.merge_shards_chance; + } + + public bool ShouldSerializeKey_validation_class() + { + return __isset.key_validation_class; + } + + public bool ShouldSerializeKey_alias() + { + return __isset.key_alias; + } + + public bool ShouldSerializeCompaction_strategy() + { + return __isset.compaction_strategy; + } + + public bool ShouldSerializeCompaction_strategy_options() + { + return __isset.compaction_strategy_options; + } + + public bool ShouldSerializeCompression_options() + { + return __isset.compression_options; + } + + public bool ShouldSerializeBloom_filter_fp_chance() + { + return __isset.bloom_filter_fp_chance; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs new file mode 100644 index 00000000000..dfa7c3ed4ee --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs @@ -0,0 +1,282 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Basic unit of data within a ColumnFamily. + /// @param name, the name by which this column is set and retrieved. Maximum 64KB long. + /// @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small + /// numbers of MB (since Thrift must read the full value into memory to operate on it). + /// @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to + /// be compared. + /// @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted. + /// + [DataContract(Namespace = "")] + public partial class Column : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _timestamp; + private int _ttl; + private byte[] _value; + + public Column() + { + } + + public Column(byte[] name) : this() + { + this.Name = name; + } + + [DataMember(Order = 0)] + public byte[] Name { get; set; } + + [DataMember(Order = 0)] + public byte[] Value + { + get { return _value; } + set + { + __isset.@value = true; + this._value = value; + } + } + + [DataMember(Order = 0)] + public long Timestamp + { + get { return _timestamp; } + set + { + __isset.timestamp = true; + this._timestamp = value; + } + } + + [DataMember(Order = 0)] + public int Ttl + { + get { return _ttl; } + set + { + __isset.ttl = true; + this._ttl = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadBinaryAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Value = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I64) + { + Timestamp = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Ttl = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Column"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Value != null && __isset.@value) + { + field.Name = "value"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Value, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.timestamp) + { + field.Name = "timestamp"; + field.Type = TType.I64; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Timestamp, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.ttl) + { + field.Name = "ttl"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Ttl, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Column("); + sb.Append(", Name: "); + sb.Append(Name); + if (Value != null && __isset.@value) + { + sb.Append(", Value: "); + sb.Append(Value); + } + if (__isset.timestamp) + { + sb.Append(", Timestamp: "); + sb.Append(Timestamp); + } + if (__isset.ttl) + { + sb.Append(", Ttl: "); + sb.Append(Ttl); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool @value; + [DataMember] public bool timestamp; + [DataMember] public bool ttl; + } + + #region XmlSerializer support + + public bool ShouldSerializeValue() + { + return __isset.@value; + } + + public bool ShouldSerializeTimestamp() + { + return __isset.timestamp; + } + + public bool ShouldSerializeTtl() + { + return __isset.ttl; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs new file mode 100644 index 00000000000..ef2a0e41bbc --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs @@ -0,0 +1,326 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class ColumnDef : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _index_name; + private Dictionary _index_options; + private IndexType _index_type; + + public ColumnDef() + { + } + + public ColumnDef(byte[] name, string validation_class) : this() + { + this.Name = name; + this.Validation_class = validation_class; + } + + [DataMember(Order = 0)] + public byte[] Name { get; set; } + + [DataMember(Order = 0)] + public string Validation_class { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public IndexType Index_type + { + get { return _index_type; } + set + { + __isset.index_type = true; + this._index_type = value; + } + } + + [DataMember(Order = 0)] + public string Index_name + { + get { return _index_name; } + set + { + __isset.index_name = true; + this._index_name = value; + } + } + + [DataMember(Order = 0)] + public Dictionary Index_options + { + get { return _index_options; } + set + { + __isset.index_options = true; + this._index_options = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_validation_class = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadBinaryAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Validation_class = await iprot.ReadStringAsync(cancellationToken); + isset_validation_class = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Index_type = (IndexType) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Index_name = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.Map) + { + { + Index_options = new Dictionary(); + TMap _map37 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i38 = 0; _i38 < _map37.Count; ++_i38) + { + string _key39; + string _val40; + _key39 = await iprot.ReadStringAsync(cancellationToken); + _val40 = await iprot.ReadStringAsync(cancellationToken); + Index_options[_key39] = _val40; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_validation_class) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ColumnDef"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "validation_class"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Validation_class, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (__isset.index_type) + { + field.Name = "index_type"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Index_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Index_name != null && __isset.index_name) + { + field.Name = "index_name"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Index_name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Index_options != null && __isset.index_options) + { + field.Name = "index_options"; + field.Type = TType.Map; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Index_options.Count), + cancellationToken); + foreach (string _iter41 in Index_options.Keys) + { + await oprot.WriteStringAsync(_iter41, cancellationToken); + await oprot.WriteStringAsync(Index_options[_iter41], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ColumnDef("); + sb.Append(", Name: "); + sb.Append(Name); + sb.Append(", Validation_class: "); + sb.Append(Validation_class); + if (__isset.index_type) + { + sb.Append(", Index_type: "); + sb.Append(Index_type); + } + if (Index_name != null && __isset.index_name) + { + sb.Append(", Index_name: "); + sb.Append(Index_name); + } + if (Index_options != null && __isset.index_options) + { + sb.Append(", Index_options: "); + sb.Append(Index_options); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool index_type; + [DataMember] public bool index_name; + [DataMember] public bool index_options; + } + + #region XmlSerializer support + + public bool ShouldSerializeIndex_type() + { + return __isset.index_type; + } + + public bool ShouldSerializeIndex_name() + { + return __isset.index_name; + } + + public bool ShouldSerializeIndex_options() + { + return __isset.index_options; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs new file mode 100644 index 00000000000..f57a816e4ba --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs @@ -0,0 +1,325 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Methods for fetching rows/records from Cassandra will return either a single instance of ColumnOrSuperColumn or a + /// list + /// of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn (or list of SuperColumns) then the + /// resulting + /// instances of ColumnOrSuperColumn will have the requested SuperColumn in the attribute super_column. For queries + /// resulting + /// in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize + /// on + /// single query methods that may return either a SuperColumn or Column. + /// If the query was on a counter column family, you will either get a counter_column (instead of a column) or a + /// counter_super_column (instead of a super_column) + /// @param column. The Column returned by get() or get_slice(). + /// @param super_column. The SuperColumn returned by get() or get_slice(). + /// @param counter_column. The Counterolumn returned by get() or get_slice(). + /// @param counter_super_column. The CounterSuperColumn returned by get() or get_slice(). + /// + [DataContract(Namespace = "")] + public partial class ColumnOrSuperColumn : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Column _column; + private CounterColumn _counter_column; + private CounterSuperColumn _counter_super_column; + private SuperColumn _super_column; + + public ColumnOrSuperColumn() + { + } + + [DataMember(Order = 0)] + public Column Column + { + get { return _column; } + set + { + __isset.column = true; + this._column = value; + } + } + + [DataMember(Order = 0)] + public SuperColumn Super_column + { + get { return _super_column; } + set + { + __isset.super_column = true; + this._super_column = value; + } + } + + [DataMember(Order = 0)] + public CounterColumn Counter_column + { + get { return _counter_column; } + set + { + __isset.counter_column = true; + this._counter_column = value; + } + } + + [DataMember(Order = 0)] + public CounterSuperColumn Counter_super_column + { + get { return _counter_super_column; } + set + { + __isset.counter_super_column = true; + this._counter_super_column = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Column = new Column(); + await Column.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Super_column = new SuperColumn(); + await Super_column.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Counter_column = new CounterColumn(); + await Counter_column.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Struct) + { + Counter_super_column = new CounterSuperColumn(); + await Counter_super_column.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ColumnOrSuperColumn"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Column != null && __isset.column) + { + field.Name = "column"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Super_column != null && __isset.super_column) + { + field.Name = "super_column"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Super_column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Counter_column != null && __isset.counter_column) + { + field.Name = "counter_column"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Counter_column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Counter_super_column != null && __isset.counter_super_column) + { + field.Name = "counter_super_column"; + field.Type = TType.Struct; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Counter_super_column.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ColumnOrSuperColumn("); + bool __first = true; + if (Column != null && __isset.column) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Column: "); + sb.Append(Column == null ? "" : Column.ToString()); + } + if (Super_column != null && __isset.super_column) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Super_column: "); + sb.Append(Super_column == null ? "" : Super_column.ToString()); + } + if (Counter_column != null && __isset.counter_column) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Counter_column: "); + sb.Append(Counter_column == null ? "" : Counter_column.ToString()); + } + if (Counter_super_column != null && __isset.counter_super_column) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Counter_super_column: "); + sb.Append(Counter_super_column == null ? "" : Counter_super_column.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool column; + [DataMember] public bool super_column; + [DataMember] public bool counter_column; + [DataMember] public bool counter_super_column; + } + + #region XmlSerializer support + + public bool ShouldSerializeColumn() + { + return __isset.column; + } + + public bool ShouldSerializeSuper_column() + { + return __isset.super_column; + } + + public bool ShouldSerializeCounter_column() + { + return __isset.counter_column; + } + + public bool ShouldSerializeCounter_super_column() + { + return __isset.counter_super_column; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs new file mode 100644 index 00000000000..5386a035888 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs @@ -0,0 +1,195 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// ColumnParent is used when selecting groups of columns from the same ColumnFamily. In directory structure terms, + /// imagine + /// ColumnParent as ColumnPath + '/../'. + /// See also ColumnPath + /// + [DataContract(Namespace = "")] + public partial class ColumnParent : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _super_column; + + public ColumnParent() + { + } + + public ColumnParent(string column_family) : this() + { + this.Column_family = column_family; + } + + [DataMember(Order = 0)] + public string Column_family { get; set; } + + [DataMember(Order = 0)] + public byte[] Super_column + { + get { return _super_column; } + set + { + __isset.super_column = true; + this._super_column = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_family = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 3: + if (field.Type == TType.String) + { + Column_family = await iprot.ReadStringAsync(cancellationToken); + isset_column_family = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Super_column = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_family) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ColumnParent"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_family"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Column_family, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Super_column != null && __isset.super_column) + { + field.Name = "super_column"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Super_column, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuper_column() + { + return __isset.super_column; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("ColumnParent("); + sb.Append(", Column_family: "); + sb.Append(Column_family); + if (Super_column != null && __isset.super_column) + { + sb.Append(", Super_column: "); + sb.Append(Super_column); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool super_column; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs new file mode 100644 index 00000000000..8559713af8f --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs @@ -0,0 +1,239 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// The ColumnPath is the path to a single column in Cassandra. It might make sense to think of ColumnPath and + /// ColumnParent in terms of a directory structure. + /// ColumnPath is used to looking up a single column. + /// @param column_family. The name of the CF of the column being looked up. + /// @param super_column. The super column name. + /// @param column. The column name. + /// + [DataContract(Namespace = "")] + public partial class ColumnPath : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _column; + private byte[] _super_column; + + public ColumnPath() + { + } + + public ColumnPath(string column_family) : this() + { + this.Column_family = column_family; + } + + [DataMember(Order = 0)] + public string Column_family { get; set; } + + [DataMember(Order = 0)] + public byte[] Super_column + { + get { return _super_column; } + set + { + __isset.super_column = true; + this._super_column = value; + } + } + + [DataMember(Order = 0)] + public byte[] Column + { + get { return _column; } + set + { + __isset.column = true; + this._column = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_family = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 3: + if (field.Type == TType.String) + { + Column_family = await iprot.ReadStringAsync(cancellationToken); + isset_column_family = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Super_column = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.String) + { + Column = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_family) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ColumnPath"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_family"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Column_family, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Super_column != null && __isset.super_column) + { + field.Name = "super_column"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Super_column, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Column != null && __isset.column) + { + field.Name = "column"; + field.Type = TType.String; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Column, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ColumnPath("); + sb.Append(", Column_family: "); + sb.Append(Column_family); + if (Super_column != null && __isset.super_column) + { + sb.Append(", Super_column: "); + sb.Append(Super_column); + } + if (Column != null && __isset.column) + { + sb.Append(", Column: "); + sb.Append(Column); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool super_column; + [DataMember] public bool column; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuper_column() + { + return __isset.super_column; + } + + public bool ShouldSerializeColumn() + { + return __isset.column; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs new file mode 100644 index 00000000000..b67775c7c0d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Apache.Cassandra.Test +{ + /// + /// CQL query compression + /// + public enum Compression + { + GZIP = 1, + NONE = 2, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs new file mode 100644 index 00000000000..1aa244bbf90 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs @@ -0,0 +1,84 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Apache.Cassandra.Test +{ + /// + /// The ConsistencyLevel is an enum that controls both read and write + /// behavior based on the ReplicationFactor of the keyspace. The + /// different consistency levels have different meanings, depending on + /// if you're doing a write or read operation. + /// If W + R > ReplicationFactor, where W is the number of nodes to + /// block for on write, and R the number to block for on reads, you + /// will have strongly consistent behavior; that is, readers will + /// always see the most recent write. Of these, the most interesting is + /// to do QUORUM reads and writes, which gives you consistency while + /// still allowing availability in the face of node failures up to half + /// of + /// + /// . Of course if latency is more important than + /// consistency then you can use lower values for either or both. + /// Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number + /// of replicas rather than a logical concept that adjusts + /// automatically with the replication factor. Of these, only ONE is + /// commonly used; TWO and (even more rarely) THREE are only useful + /// when you care more about guaranteeing a certain level of + /// durability, than consistency. + /// Write consistency levels make the following guarantees before reporting success to the client: + /// ANY Ensure that the write has been written once somewhere, including possibly being hinted in a + /// non-target node. + /// ONE Ensure that the write has been written to at least 1 node's commit log and memory table + /// TWO Ensure that the write has been written to at least 2 node's commit log and memory table + /// THREE Ensure that the write has been written to at least 3 node's commit log and memory table + /// QUORUM Ensure that the write has been written to + /// + /// / 2 + 1 nodes + /// LOCAL_QUORUM Ensure that the write has been written to + /// + /// / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + /// EACH_QUORUM Ensure that the write has been written to + /// + /// / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) + /// ALL Ensure that the write is written to <ReplicationFactor> nodes + /// before responding to the client. + /// Read consistency levels make the following guarantees before returning successful results to the + /// client: + /// ANY Not supported. You probably want ONE instead. + /// ONE Returns the record obtained from a single replica. + /// TWO Returns the record with the most recent timestamp once two replicas have replied. + /// THREE Returns the record with the most recent timestamp once three replicas have replied. + /// QUORUM Returns the record with the most recent timestamp once a majority of replicas have + /// replied. + /// LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within + /// the local datacenter have replied. + /// EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within + /// each datacenter have replied. + /// ALL Returns the record with the most recent timestamp once all replicas have replied + /// (implies no replica may be down).. + /// + public enum ConsistencyLevel + { + ONE = 1, + QUORUM = 2, + LOCAL_QUORUM = 3, + EACH_QUORUM = 4, + ALL = 5, + ANY = 6, + TWO = 7, + THREE = 8, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs new file mode 100644 index 00000000000..cf2a88405b0 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs @@ -0,0 +1,163 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CounterColumn : TBase + { + public CounterColumn() + { + } + + public CounterColumn(byte[] name, long value) : this() + { + this.Name = name; + this.Value = value; + } + + [DataMember(Order = 0)] + public byte[] Name { get; set; } + + [DataMember(Order = 0)] + public long Value { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_value = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadBinaryAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I64) + { + Value = await iprot.ReadI64Async(cancellationToken); + isset_value = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_value) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CounterColumn"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "value"; + field.Type = TType.I64; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Value, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CounterColumn("); + sb.Append(", Name: "); + sb.Append(Name); + sb.Append(", Value: "); + sb.Append(Value); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs new file mode 100644 index 00000000000..ceeb5db03fa --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs @@ -0,0 +1,181 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CounterSuperColumn : TBase + { + public CounterSuperColumn() + { + } + + public CounterSuperColumn(byte[] name, List columns) : this() + { + this.Name = name; + this.Columns = columns; + } + + [DataMember(Order = 0)] + public byte[] Name { get; set; } + + [DataMember(Order = 0)] + public List Columns { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_columns = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadBinaryAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Columns = new List(); + TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i5 = 0; _i5 < _list4.Count; ++_i5) + { + CounterColumn _elem6; + _elem6 = new CounterColumn(); + await _elem6.ReadAsync(iprot, cancellationToken); + Columns.Add(_elem6); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_columns = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_columns) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CounterSuperColumn"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "columns"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); + foreach (CounterColumn _iter7 in Columns) + { + await _iter7.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CounterSuperColumn("); + sb.Append(", Name: "); + sb.Append(Name); + sb.Append(", Columns: "); + sb.Append(Columns); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs new file mode 100644 index 00000000000..8a3157bfda1 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs @@ -0,0 +1,264 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CqlMetadata : TBase + { + public CqlMetadata() + { + } + + public CqlMetadata(Dictionary name_types, Dictionary value_types, + string default_name_type, string default_value_type) : this() + { + this.Name_types = name_types; + this.Value_types = value_types; + this.Default_name_type = default_name_type; + this.Default_value_type = default_value_type; + } + + [DataMember(Order = 0)] + public Dictionary Name_types { get; set; } + + [DataMember(Order = 0)] + public Dictionary Value_types { get; set; } + + [DataMember(Order = 0)] + public string Default_name_type { get; set; } + + [DataMember(Order = 0)] + public string Default_value_type { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name_types = false; + bool isset_value_types = false; + bool isset_default_name_type = false; + bool isset_default_value_type = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Name_types = new Dictionary(); + TMap _map69 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i70 = 0; _i70 < _map69.Count; ++_i70) + { + byte[] _key71; + string _val72; + _key71 = await iprot.ReadBinaryAsync(cancellationToken); + _val72 = await iprot.ReadStringAsync(cancellationToken); + Name_types[_key71] = _val72; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + isset_name_types = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Map) + { + { + Value_types = new Dictionary(); + TMap _map73 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i74 = 0; _i74 < _map73.Count; ++_i74) + { + byte[] _key75; + string _val76; + _key75 = await iprot.ReadBinaryAsync(cancellationToken); + _val76 = await iprot.ReadStringAsync(cancellationToken); + Value_types[_key75] = _val76; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + isset_value_types = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Default_name_type = await iprot.ReadStringAsync(cancellationToken); + isset_default_name_type = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Default_value_type = await iprot.ReadStringAsync(cancellationToken); + isset_default_value_type = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name_types) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_value_types) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_default_name_type) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_default_value_type) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CqlMetadata"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name_types"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Name_types.Count), + cancellationToken); + foreach (byte[] _iter77 in Name_types.Keys) + { + await oprot.WriteBinaryAsync(_iter77, cancellationToken); + await oprot.WriteStringAsync(Name_types[_iter77], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "value_types"; + field.Type = TType.Map; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Value_types.Count), + cancellationToken); + foreach (byte[] _iter78 in Value_types.Keys) + { + await oprot.WriteBinaryAsync(_iter78, cancellationToken); + await oprot.WriteStringAsync(Value_types[_iter78], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "default_name_type"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Default_name_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "default_value_type"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Default_value_type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CqlMetadata("); + sb.Append(", Name_types: "); + sb.Append(Name_types); + sb.Append(", Value_types: "); + sb.Append(Value_types); + sb.Append(", Default_name_type: "); + sb.Append(Default_name_type); + sb.Append(", Default_value_type: "); + sb.Append(Default_value_type); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs new file mode 100644 index 00000000000..d3feb18d739 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs @@ -0,0 +1,163 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CqlPreparedResult : TBase + { + public CqlPreparedResult() + { + } + + public CqlPreparedResult(int itemId, int count) : this() + { + this.ItemId = itemId; + this.Count = count; + } + + [DataMember(Order = 0)] + public int ItemId { get; set; } + + [DataMember(Order = 0)] + public int Count { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_itemId = false; + bool isset_count = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ItemId = await iprot.ReadI32Async(cancellationToken); + isset_itemId = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Count = await iprot.ReadI32Async(cancellationToken); + isset_count = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_itemId) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_count) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CqlPreparedResult"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "itemId"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ItemId, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "count"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Count, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CqlPreparedResult("); + sb.Append(", ItemId: "); + sb.Append(ItemId); + sb.Append(", Count: "); + sb.Append(Count); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs new file mode 100644 index 00000000000..5c51f7ef62a --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs @@ -0,0 +1,295 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class CqlResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _num; + private List _rows; + private CqlMetadata _schema; + + public CqlResult() + { + } + + public CqlResult(CqlResultType type) : this() + { + this.Type = type; + } + + /// + /// + /// + [DataMember(Order = 0)] + public CqlResultType Type { get; set; } + + [DataMember(Order = 0)] + public List Rows + { + get { return _rows; } + set + { + __isset.rows = true; + this._rows = value; + } + } + + [DataMember(Order = 0)] + public int Num + { + get { return _num; } + set + { + __isset.num = true; + this._num = value; + } + } + + [DataMember(Order = 0)] + public CqlMetadata Schema + { + get { return _schema; } + set + { + __isset.schema = true; + this._schema = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_type = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Type = (CqlResultType) await iprot.ReadI32Async(cancellationToken); + isset_type = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Rows = new List(); + TList _list79 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i80 = 0; _i80 < _list79.Count; ++_i80) + { + CqlRow _elem81; + _elem81 = new CqlRow(); + await _elem81.ReadAsync(iprot, cancellationToken); + Rows.Add(_elem81); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Num = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Struct) + { + Schema = new CqlMetadata(); + await Schema.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_type) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CqlResult"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "type"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Rows != null && __isset.rows) + { + field.Name = "rows"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Rows.Count), cancellationToken); + foreach (CqlRow _iter82 in Rows) + { + await _iter82.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.num) + { + field.Name = "num"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Num, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Schema != null && __isset.schema) + { + field.Name = "schema"; + field.Type = TType.Struct; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Schema.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CqlResult("); + sb.Append(", Type: "); + sb.Append(Type); + if (Rows != null && __isset.rows) + { + sb.Append(", Rows: "); + sb.Append(Rows); + } + if (__isset.num) + { + sb.Append(", Num: "); + sb.Append(Num); + } + if (Schema != null && __isset.schema) + { + sb.Append(", Schema: "); + sb.Append(Schema == null ? "" : Schema.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool rows; + [DataMember] public bool num; + [DataMember] public bool schema; + } + + #region XmlSerializer support + + public bool ShouldSerializeRows() + { + return __isset.rows; + } + + public bool ShouldSerializeNum() + { + return __isset.num; + } + + public bool ShouldSerializeSchema() + { + return __isset.schema; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs new file mode 100644 index 00000000000..f100d01d5df --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Apache.Cassandra.Test +{ + public enum CqlResultType + { + ROWS = 1, + VOID = 2, + INT = 3, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs new file mode 100644 index 00000000000..54811e7630a --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs @@ -0,0 +1,184 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Row returned from a CQL query + /// + [DataContract(Namespace = "")] + public partial class CqlRow : TBase + { + public CqlRow() + { + } + + public CqlRow(byte[] key, List columns) : this() + { + this.Key = key; + this.Columns = columns; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public List Columns { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_columns = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Columns = new List(); + TList _list65 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i66 = 0; _i66 < _list65.Count; ++_i66) + { + Column _elem67; + _elem67 = new Column(); + await _elem67.ReadAsync(iprot, cancellationToken); + Columns.Add(_elem67); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_columns = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_columns) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CqlRow"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "columns"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); + foreach (Column _iter68 in Columns) + { + await _iter68.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CqlRow("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Columns: "); + sb.Append(Columns); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs new file mode 100644 index 00000000000..5f630d7e2b7 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs @@ -0,0 +1,261 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Note that the timestamp is only optional in case of counter deletion. + /// + [DataContract(Namespace = "")] + public partial class Deletion : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private SlicePredicate _predicate; + private byte[] _super_column; + private long _timestamp; + + public Deletion() + { + } + + [DataMember(Order = 0)] + public long Timestamp + { + get { return _timestamp; } + set + { + __isset.timestamp = true; + this._timestamp = value; + } + } + + [DataMember(Order = 0)] + public byte[] Super_column + { + get { return _super_column; } + set + { + __isset.super_column = true; + this._super_column = value; + } + } + + [DataMember(Order = 0)] + public SlicePredicate Predicate + { + get { return _predicate; } + set + { + __isset.predicate = true; + this._predicate = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I64) + { + Timestamp = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Super_column = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Struct) + { + Predicate = new SlicePredicate(); + await Predicate.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Deletion"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.timestamp) + { + field.Name = "timestamp"; + field.Type = TType.I64; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Timestamp, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Super_column != null && __isset.super_column) + { + field.Name = "super_column"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Super_column, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Predicate != null && __isset.predicate) + { + field.Name = "predicate"; + field.Type = TType.Struct; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Predicate.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Deletion("); + bool __first = true; + if (__isset.timestamp) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Timestamp: "); + sb.Append(Timestamp); + } + if (Super_column != null && __isset.super_column) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Super_column: "); + sb.Append(Super_column); + } + if (Predicate != null && __isset.predicate) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Predicate: "); + sb.Append(Predicate == null ? "" : Predicate.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool timestamp; + [DataMember] public bool super_column; + [DataMember] public bool predicate; + } + + #region XmlSerializer support + + public bool ShouldSerializeTimestamp() + { + return __isset.timestamp; + } + + public bool ShouldSerializeSuper_column() + { + return __isset.super_column; + } + + public bool ShouldSerializePredicate() + { + return __isset.predicate; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs new file mode 100644 index 00000000000..dc49650cb9f --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs @@ -0,0 +1,257 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class EndpointDetails : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _datacenter; + private string _host; + private string _rack; + + public EndpointDetails() + { + } + + [DataMember(Order = 0)] + public string Host + { + get { return _host; } + set + { + __isset.host = true; + this._host = value; + } + } + + [DataMember(Order = 0)] + public string Datacenter + { + get { return _datacenter; } + set + { + __isset.datacenter = true; + this._datacenter = value; + } + } + + [DataMember(Order = 0)] + public string Rack + { + get { return _rack; } + set + { + __isset.rack = true; + this._rack = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Host = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Datacenter = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Rack = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("EndpointDetails"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Host != null && __isset.host) + { + field.Name = "host"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Host, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Datacenter != null && __isset.datacenter) + { + field.Name = "datacenter"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Datacenter, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Rack != null && __isset.rack) + { + field.Name = "rack"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Rack, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("EndpointDetails("); + bool __first = true; + if (Host != null && __isset.host) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Host: "); + sb.Append(Host); + } + if (Datacenter != null && __isset.datacenter) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Datacenter: "); + sb.Append(Datacenter); + } + if (Rack != null && __isset.rack) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Rack: "); + sb.Append(Rack); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool host; + [DataMember] public bool datacenter; + [DataMember] public bool rack; + } + + #region XmlSerializer support + + public bool ShouldSerializeHost() + { + return __isset.host; + } + + public bool ShouldSerializeDatacenter() + { + return __isset.datacenter; + } + + public bool ShouldSerializeRack() + { + return __isset.rack; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs new file mode 100644 index 00000000000..312fcc76a86 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class IndexClause : TBase + { + public IndexClause() + { + this.Count = 100; + } + + public IndexClause(List expressions, byte[] start_key, int count) : this() + { + this.Expressions = expressions; + this.Start_key = start_key; + this.Count = count; + } + + [DataMember(Order = 0)] + public List Expressions { get; set; } + + [DataMember(Order = 0)] + public byte[] Start_key { get; set; } + + [DataMember(Order = 0)] + public int Count { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_expressions = false; + bool isset_start_key = false; + bool isset_count = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Expressions = new List(); + TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i13 = 0; _i13 < _list12.Count; ++_i13) + { + IndexExpression _elem14; + _elem14 = new IndexExpression(); + await _elem14.ReadAsync(iprot, cancellationToken); + Expressions.Add(_elem14); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_expressions = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Start_key = await iprot.ReadBinaryAsync(cancellationToken); + isset_start_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Count = await iprot.ReadI32Async(cancellationToken); + isset_count = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_expressions) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_start_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_count) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("IndexClause"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "expressions"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Expressions.Count), cancellationToken); + foreach (IndexExpression _iter15 in Expressions) + { + await _iter15.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "start_key"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Start_key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "count"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Count, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("IndexClause("); + sb.Append(", Expressions: "); + sb.Append(Expressions); + sb.Append(", Start_key: "); + sb.Append(Start_key); + sb.Append(", Count: "); + sb.Append(Count); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs new file mode 100644 index 00000000000..a4c25ed83c2 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs @@ -0,0 +1,194 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class IndexExpression : TBase + { + public IndexExpression() + { + } + + public IndexExpression(byte[] column_name, IndexOperator op, byte[] value) : this() + { + this.Column_name = column_name; + this.Op = op; + this.Value = value; + } + + [DataMember(Order = 0)] + public byte[] Column_name { get; set; } + + /// + /// + /// + [DataMember(Order = 0)] + public IndexOperator Op { get; set; } + + [DataMember(Order = 0)] + public byte[] Value { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_column_name = false; + bool isset_op = false; + bool isset_value = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Column_name = await iprot.ReadBinaryAsync(cancellationToken); + isset_column_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Op = (IndexOperator) await iprot.ReadI32Async(cancellationToken); + isset_op = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Value = await iprot.ReadBinaryAsync(cancellationToken); + isset_value = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_column_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_op) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_value) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("IndexExpression"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "column_name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Column_name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "op"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Op, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "value"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Value, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("IndexExpression("); + sb.Append(", Column_name: "); + sb.Append(Column_name); + sb.Append(", Op: "); + sb.Append(Op); + sb.Append(", Value: "); + sb.Append(Value); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs new file mode 100644 index 00000000000..a65c588ff8d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Apache.Cassandra.Test +{ + public enum IndexOperator + { + EQ = 0, + GTE = 1, + GT = 2, + LTE = 3, + LT = 4, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs new file mode 100644 index 00000000000..5003559face --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Apache.Cassandra.Test +{ + public enum IndexType + { + KEYS = 0, + CUSTOM = 1, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs new file mode 100644 index 00000000000..d4302b4d009 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs @@ -0,0 +1,149 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a + /// parameter is malformed. + /// why contains an associated error message. + /// + public partial class InvalidRequestException : TException, TBase + { + public InvalidRequestException() + { + } + + public InvalidRequestException(string why) : this() + { + this.Why = why; + } + + [DataMember(Order = 0)] + public string Why { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_why = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Why = await iprot.ReadStringAsync(cancellationToken); + isset_why = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_why) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("InvalidRequestException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "why"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Why, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("InvalidRequestException("); + sb.Append(", Why: "); + sb.Append(Why); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class InvalidRequestExceptionFault + { + private string _why; + + [DataMember(Order = 0)] + public string Why { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs new file mode 100644 index 00000000000..e0ea6dcd7ad --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs @@ -0,0 +1,163 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class KeyCount : TBase + { + public KeyCount() + { + } + + public KeyCount(byte[] key, int count) : this() + { + this.Key = key; + this.Count = count; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public int Count { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_count = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Count = await iprot.ReadI32Async(cancellationToken); + isset_count = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_count) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("KeyCount"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "count"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Count, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("KeyCount("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Count: "); + sb.Append(Count); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs new file mode 100644 index 00000000000..003306d7d5d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs @@ -0,0 +1,349 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// The semantics of start keys and tokens are slightly different. + /// Keys are start-inclusive; tokens are start-exclusive. Token + /// ranges may also wrap -- that is, the end token may be less + /// than the start one. Thus, a range from keyX to keyX is a + /// one-element range, but a range from tokenY to tokenY is the + /// full ring. + /// + [DataContract(Namespace = "")] + public partial class KeyRange : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _end_key; + private string _end_token; + private byte[] _start_key; + private string _start_token; + + public KeyRange() + { + this.Count = 100; + } + + public KeyRange(int count) : this() + { + this.Count = count; + } + + [DataMember(Order = 0)] + public byte[] Start_key + { + get { return _start_key; } + set + { + __isset.start_key = true; + this._start_key = value; + } + } + + [DataMember(Order = 0)] + public byte[] End_key + { + get { return _end_key; } + set + { + __isset.end_key = true; + this._end_key = value; + } + } + + [DataMember(Order = 0)] + public string Start_token + { + get { return _start_token; } + set + { + __isset.start_token = true; + this._start_token = value; + } + } + + [DataMember(Order = 0)] + public string End_token + { + get { return _end_token; } + set + { + __isset.end_token = true; + this._end_token = value; + } + } + + [DataMember(Order = 0)] + public int Count { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_count = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Start_key = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + End_key = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Start_token = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + End_token = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.I32) + { + Count = await iprot.ReadI32Async(cancellationToken); + isset_count = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_count) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("KeyRange"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Start_key != null && __isset.start_key) + { + field.Name = "start_key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Start_key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (End_key != null && __isset.end_key) + { + field.Name = "end_key"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(End_key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Start_token != null && __isset.start_token) + { + field.Name = "start_token"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Start_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (End_token != null && __isset.end_token) + { + field.Name = "end_token"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(End_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "count"; + field.Type = TType.I32; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Count, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("KeyRange("); + bool __first = true; + if (Start_key != null && __isset.start_key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Start_key: "); + sb.Append(Start_key); + } + if (End_key != null && __isset.end_key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("End_key: "); + sb.Append(End_key); + } + if (Start_token != null && __isset.start_token) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Start_token: "); + sb.Append(Start_token); + } + if (End_token != null && __isset.end_token) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("End_token: "); + sb.Append(End_token); + } + if (!__first) + { + sb.Append(", "); + } + sb.Append("Count: "); + sb.Append(Count); + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool start_key; + [DataMember] public bool end_key; + [DataMember] public bool start_token; + [DataMember] public bool end_token; + } + + #region XmlSerializer support + + public bool ShouldSerializeStart_key() + { + return __isset.start_key; + } + + public bool ShouldSerializeEnd_key() + { + return __isset.end_key; + } + + public bool ShouldSerializeStart_token() + { + return __isset.start_token; + } + + public bool ShouldSerializeEnd_token() + { + return __isset.end_token; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs new file mode 100644 index 00000000000..b1477294b8b --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs @@ -0,0 +1,189 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A KeySlice is key followed by the data it maps to. A collection of KeySlice is returned by the get_range_slice + /// operation. + /// @param key. a row key + /// @param columns. List of data represented by the key. Typically, the list is pared down to only the columns + /// specified by + /// a SlicePredicate. + /// + [DataContract(Namespace = "")] + public partial class KeySlice : TBase + { + public KeySlice() + { + } + + public KeySlice(byte[] key, List columns) : this() + { + this.Key = key; + this.Columns = columns; + } + + [DataMember(Order = 0)] + public byte[] Key { get; set; } + + [DataMember(Order = 0)] + public List Columns { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_key = false; + bool isset_columns = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadBinaryAsync(cancellationToken); + isset_key = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Columns = new List(); + TList _list16 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i17 = 0; _i17 < _list16.Count; ++_i17) + { + ColumnOrSuperColumn _elem18; + _elem18 = new ColumnOrSuperColumn(); + await _elem18.ReadAsync(iprot, cancellationToken); + Columns.Add(_elem18); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_columns = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_key) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_columns) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("KeySlice"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "columns"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); + foreach (ColumnOrSuperColumn _iter19 in Columns) + { + await _iter19.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("KeySlice("); + sb.Append(", Key: "); + sb.Append(Key); + sb.Append(", Columns: "); + sb.Append(Columns); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs new file mode 100644 index 00000000000..ed8a3eed6fb --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs @@ -0,0 +1,374 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + [DataContract(Namespace = "")] + public partial class KsDef : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private bool _durable_writes; + private int _replication_factor; + private Dictionary _strategy_options; + + public KsDef() + { + this._durable_writes = true; + this.__isset.durable_writes = true; + } + + public KsDef(string name, string strategy_class, List cf_defs) : this() + { + this.Name = name; + this.Strategy_class = strategy_class; + this.Cf_defs = cf_defs; + } + + [DataMember(Order = 0)] + public string Name { get; set; } + + [DataMember(Order = 0)] + public string Strategy_class { get; set; } + + [DataMember(Order = 0)] + public Dictionary Strategy_options + { + get { return _strategy_options; } + set + { + __isset.strategy_options = true; + this._strategy_options = value; + } + } + + /// + /// @deprecated + /// + [DataMember(Order = 0)] + public int Replication_factor + { + get { return _replication_factor; } + set + { + __isset.replication_factor = true; + this._replication_factor = value; + } + } + + [DataMember(Order = 0)] + public List Cf_defs { get; set; } + + [DataMember(Order = 0)] + public bool Durable_writes + { + get { return _durable_writes; } + set + { + __isset.durable_writes = true; + this._durable_writes = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_strategy_class = false; + bool isset_cf_defs = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadStringAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Strategy_class = await iprot.ReadStringAsync(cancellationToken); + isset_strategy_class = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Map) + { + { + Strategy_options = new Dictionary(); + TMap _map56 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i57 = 0; _i57 < _map56.Count; ++_i57) + { + string _key58; + string _val59; + _key58 = await iprot.ReadStringAsync(cancellationToken); + _val59 = await iprot.ReadStringAsync(cancellationToken); + Strategy_options[_key58] = _val59; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Replication_factor = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.List) + { + { + Cf_defs = new List(); + TList _list60 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i61 = 0; _i61 < _list60.Count; ++_i61) + { + CfDef _elem62; + _elem62 = new CfDef(); + await _elem62.ReadAsync(iprot, cancellationToken); + Cf_defs.Add(_elem62); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_cf_defs = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.Bool) + { + Durable_writes = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_strategy_class) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_cf_defs) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("KsDef"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "strategy_class"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Strategy_class, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + if (Strategy_options != null && __isset.strategy_options) + { + field.Name = "strategy_options"; + field.Type = TType.Map; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Strategy_options.Count), + cancellationToken); + foreach (string _iter63 in Strategy_options.Keys) + { + await oprot.WriteStringAsync(_iter63, cancellationToken); + await oprot.WriteStringAsync(Strategy_options[_iter63], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.replication_factor) + { + field.Name = "replication_factor"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Replication_factor, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "cf_defs"; + field.Type = TType.List; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Cf_defs.Count), cancellationToken); + foreach (CfDef _iter64 in Cf_defs) + { + await _iter64.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + if (__isset.durable_writes) + { + field.Name = "durable_writes"; + field.Type = TType.Bool; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Durable_writes, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("KsDef("); + sb.Append(", Name: "); + sb.Append(Name); + sb.Append(", Strategy_class: "); + sb.Append(Strategy_class); + if (Strategy_options != null && __isset.strategy_options) + { + sb.Append(", Strategy_options: "); + sb.Append(Strategy_options); + } + if (__isset.replication_factor) + { + sb.Append(", Replication_factor: "); + sb.Append(Replication_factor); + } + sb.Append(", Cf_defs: "); + sb.Append(Cf_defs); + if (__isset.durable_writes) + { + sb.Append(", Durable_writes: "); + sb.Append(Durable_writes); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool strategy_options; + [DataMember] public bool replication_factor; + [DataMember] public bool durable_writes; + } + + #region XmlSerializer support + + public bool ShouldSerializeStrategy_options() + { + return __isset.strategy_options; + } + + public bool ShouldSerializeReplication_factor() + { + return __isset.replication_factor; + } + + public bool ShouldSerializeDurable_writes() + { + return __isset.durable_writes; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs new file mode 100644 index 00000000000..5c81ee53557 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs @@ -0,0 +1,218 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling + /// the deletion attribute). + /// @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn) + /// @param deletion. A deletion of a column or supercolumn + /// + [DataContract(Namespace = "")] + public partial class Mutation : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private ColumnOrSuperColumn _column_or_supercolumn; + private Deletion _deletion; + + public Mutation() + { + } + + [DataMember(Order = 0)] + public ColumnOrSuperColumn Column_or_supercolumn + { + get { return _column_or_supercolumn; } + set + { + __isset.column_or_supercolumn = true; + this._column_or_supercolumn = value; + } + } + + [DataMember(Order = 0)] + public Deletion Deletion + { + get { return _deletion; } + set + { + __isset.deletion = true; + this._deletion = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Column_or_supercolumn = new ColumnOrSuperColumn(); + await Column_or_supercolumn.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Deletion = new Deletion(); + await Deletion.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Mutation"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Column_or_supercolumn != null && __isset.column_or_supercolumn) + { + field.Name = "column_or_supercolumn"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Column_or_supercolumn.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Deletion != null && __isset.deletion) + { + field.Name = "deletion"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Deletion.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Mutation("); + bool __first = true; + if (Column_or_supercolumn != null && __isset.column_or_supercolumn) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Column_or_supercolumn: "); + sb.Append(Column_or_supercolumn == null ? "" : Column_or_supercolumn.ToString()); + } + if (Deletion != null && __isset.deletion) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Deletion: "); + sb.Append(Deletion == null ? "" : Deletion.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool column_or_supercolumn; + [DataMember] public bool deletion; + } + + #region XmlSerializer support + + public bool ShouldSerializeColumn_or_supercolumn() + { + return __isset.column_or_supercolumn; + } + + public bool ShouldSerializeDeletion() + { + return __isset.deletion; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs new file mode 100644 index 00000000000..c6f0df567b1 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A specific column was requested that does not exist. + /// + public partial class NotFoundException : TException, TBase + { + public NotFoundException() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NotFoundException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NotFoundException("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class NotFoundExceptionFault + { + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs new file mode 100644 index 00000000000..e05fa25ec52 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// schemas are not in agreement across all nodes + /// + public partial class SchemaDisagreementException : TException, TBase + { + public SchemaDisagreementException() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("SchemaDisagreementException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("SchemaDisagreementException("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class SchemaDisagreementExceptionFault + { + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs new file mode 100644 index 00000000000..01a2dd06a7e --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs @@ -0,0 +1,239 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A SlicePredicate is similar to a mathematic predicate (see + /// http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)), + /// which is described as "a property that the elements of a set have in common." + /// SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange. If column_names is + /// specified, slice_range is ignored. + /// @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature + /// to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack', + /// and 'Jim' you can pass those column names as a list to fetch all three at once. + /// @param slice_range. A SliceRange describing how to range, order, and/or limit the slice. + /// + [DataContract(Namespace = "")] + public partial class SlicePredicate : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List _column_names; + private SliceRange _slice_range; + + public SlicePredicate() + { + } + + [DataMember(Order = 0)] + public List Column_names + { + get { return _column_names; } + set + { + __isset.column_names = true; + this._column_names = value; + } + } + + [DataMember(Order = 0)] + public SliceRange Slice_range + { + get { return _slice_range; } + set + { + __isset.slice_range = true; + this._slice_range = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Column_names = new List(); + TList _list8 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i9 = 0; _i9 < _list8.Count; ++_i9) + { + byte[] _elem10; + _elem10 = await iprot.ReadBinaryAsync(cancellationToken); + Column_names.Add(_elem10); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Slice_range = new SliceRange(); + await Slice_range.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("SlicePredicate"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Column_names != null && __isset.column_names) + { + field.Name = "column_names"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Column_names.Count), cancellationToken); + foreach (byte[] _iter11 in Column_names) + { + await oprot.WriteBinaryAsync(_iter11, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Slice_range != null && __isset.slice_range) + { + field.Name = "slice_range"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Slice_range.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("SlicePredicate("); + bool __first = true; + if (Column_names != null && __isset.column_names) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Column_names: "); + sb.Append(Column_names); + } + if (Slice_range != null && __isset.slice_range) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Slice_range: "); + sb.Append(Slice_range == null ? "" : Slice_range.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool column_names; + [DataMember] public bool slice_range; + } + + #region XmlSerializer support + + public bool ShouldSerializeColumn_names() + { + return __isset.column_names; + } + + public bool ShouldSerializeSlice_range() + { + return __isset.slice_range; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs new file mode 100644 index 00000000000..634f15d98a3 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs @@ -0,0 +1,238 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A slice range is a structure that stores basic range, ordering and limit information for a query that will return + /// multiple columns. It could be thought of as Cassandra's version of LIMIT and ORDER BY + /// @param start. The column name to start the slice with. This attribute is not required, though there is no default + /// value, + /// and can be safely set to '', i.e., an empty byte array, to start with the first column name. Otherwise, it + /// must a valid value under the rules of the Comparator defined for the given ColumnFamily. + /// @param finish. The column name to stop the slice at. This attribute is not required, though there is no default + /// value, + /// and can be safely set to an empty byte array to not stop until 'count' results are seen. Otherwise, it + /// must also be a valid value to the ColumnFamily Comparator. + /// @param reversed. Whether the results should be ordered in reversed order. Similar to ORDER BY blah DESC in SQL. + /// @param count. How many columns to return. Similar to LIMIT in SQL. May be arbitrarily large, but Thrift will + /// materialize the whole result into memory before returning it to the client, so be aware that you may + /// be better served by iterating through slices by passing the last value of one call in as the 'start' + /// of the next instead of increasing 'count' arbitrarily large. + /// + [DataContract(Namespace = "")] + public partial class SliceRange : TBase + { + public SliceRange() + { + this.Reversed = false; + this.Count = 100; + } + + public SliceRange(byte[] start, byte[] finish, bool reversed, int count) : this() + { + this.Start = start; + this.Finish = finish; + this.Reversed = reversed; + this.Count = count; + } + + [DataMember(Order = 0)] + public byte[] Start { get; set; } + + [DataMember(Order = 0)] + public byte[] Finish { get; set; } + + [DataMember(Order = 0)] + public bool Reversed { get; set; } + + [DataMember(Order = 0)] + public int Count { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_start = false; + bool isset_finish = false; + bool isset_reversed = false; + bool isset_count = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Start = await iprot.ReadBinaryAsync(cancellationToken); + isset_start = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Finish = await iprot.ReadBinaryAsync(cancellationToken); + isset_finish = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Bool) + { + Reversed = await iprot.ReadBoolAsync(cancellationToken); + isset_reversed = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Count = await iprot.ReadI32Async(cancellationToken); + isset_count = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_start) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_finish) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_reversed) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_count) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("SliceRange"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "start"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Start, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "finish"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Finish, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "reversed"; + field.Type = TType.Bool; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Reversed, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "count"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Count, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("SliceRange("); + sb.Append(", Start: "); + sb.Append(Start); + sb.Append(", Finish: "); + sb.Append(Finish); + sb.Append(", Reversed: "); + sb.Append(Reversed); + sb.Append(", Count: "); + sb.Append(Count); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs new file mode 100644 index 00000000000..be90d6f9604 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs @@ -0,0 +1,188 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A named list of columns. + /// @param name. see Column.name. + /// @param columns. A collection of standard Columns. The columns within a super column are defined in an adhoc + /// manner. + /// Columns within a super column do not have to have matching structures (similarly named child columns). + /// + [DataContract(Namespace = "")] + public partial class SuperColumn : TBase + { + public SuperColumn() + { + } + + public SuperColumn(byte[] name, List columns) : this() + { + this.Name = name; + this.Columns = columns; + } + + [DataMember(Order = 0)] + public byte[] Name { get; set; } + + [DataMember(Order = 0)] + public List Columns { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_name = false; + bool isset_columns = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Name = await iprot.ReadBinaryAsync(cancellationToken); + isset_name = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Columns = new List(); + TList _list0 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i1 = 0; _i1 < _list0.Count; ++_i1) + { + Column _elem2; + _elem2 = new Column(); + await _elem2.ReadAsync(iprot, cancellationToken); + Columns.Add(_elem2); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_columns = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_name) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_columns) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("SuperColumn"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "name"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Name, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "columns"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); + foreach (Column _iter3 in Columns) + { + await _iter3.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("SuperColumn("); + sb.Append(", Name: "); + sb.Append(Name); + sb.Append(", Columns: "); + sb.Append(Columns); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs new file mode 100644 index 00000000000..e96a10ad5b5 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs @@ -0,0 +1,111 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too + /// large. + /// + public partial class TimedOutException : TException, TBase + { + public TimedOutException() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("TimedOutException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("TimedOutException("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class TimedOutExceptionFault + { + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs new file mode 100644 index 00000000000..275aadde7a4 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs @@ -0,0 +1,348 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// A TokenRange describes part of the Cassandra ring, it is a mapping from a range to + /// endpoints responsible for that range. + /// @param start_token The first token in the range + /// @param end_token The last token in the range + /// @param endpoints The endpoints responsible for the range (listed by their configured listen_address) + /// @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address) + /// + [DataContract(Namespace = "")] + public partial class TokenRange : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List _endpoint_details; + private List _rpc_endpoints; + + public TokenRange() + { + } + + public TokenRange(string start_token, string end_token, List endpoints) : this() + { + this.Start_token = start_token; + this.End_token = end_token; + this.Endpoints = endpoints; + } + + [DataMember(Order = 0)] + public string Start_token { get; set; } + + [DataMember(Order = 0)] + public string End_token { get; set; } + + [DataMember(Order = 0)] + public List Endpoints { get; set; } + + [DataMember(Order = 0)] + public List Rpc_endpoints + { + get { return _rpc_endpoints; } + set + { + __isset.rpc_endpoints = true; + this._rpc_endpoints = value; + } + } + + [DataMember(Order = 0)] + public List Endpoint_details + { + get { return _endpoint_details; } + set + { + __isset.endpoint_details = true; + this._endpoint_details = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_start_token = false; + bool isset_end_token = false; + bool isset_endpoints = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Start_token = await iprot.ReadStringAsync(cancellationToken); + isset_start_token = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + End_token = await iprot.ReadStringAsync(cancellationToken); + isset_end_token = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + Endpoints = new List(); + TList _list20 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i21 = 0; _i21 < _list20.Count; ++_i21) + { + string _elem22; + _elem22 = await iprot.ReadStringAsync(cancellationToken); + Endpoints.Add(_elem22); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_endpoints = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.List) + { + { + Rpc_endpoints = new List(); + TList _list23 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i24 = 0; _i24 < _list23.Count; ++_i24) + { + string _elem25; + _elem25 = await iprot.ReadStringAsync(cancellationToken); + Rpc_endpoints.Add(_elem25); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.List) + { + { + Endpoint_details = new List(); + TList _list26 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i27 = 0; _i27 < _list26.Count; ++_i27) + { + EndpointDetails _elem28; + _elem28 = new EndpointDetails(); + await _elem28.ReadAsync(iprot, cancellationToken); + Endpoint_details.Add(_elem28); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_start_token) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_end_token) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + if (!isset_endpoints) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("TokenRange"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "start_token"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Start_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "end_token"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(End_token, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + field.Name = "endpoints"; + field.Type = TType.List; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Endpoints.Count), cancellationToken); + foreach (string _iter29 in Endpoints) + { + await oprot.WriteStringAsync(_iter29, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + if (Rpc_endpoints != null && __isset.rpc_endpoints) + { + field.Name = "rpc_endpoints"; + field.Type = TType.List; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Rpc_endpoints.Count), cancellationToken); + foreach (string _iter30 in Rpc_endpoints) + { + await oprot.WriteStringAsync(_iter30, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Endpoint_details != null && __isset.endpoint_details) + { + field.Name = "endpoint_details"; + field.Type = TType.List; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, Endpoint_details.Count), cancellationToken); + foreach (EndpointDetails _iter31 in Endpoint_details) + { + await _iter31.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("TokenRange("); + sb.Append(", Start_token: "); + sb.Append(Start_token); + sb.Append(", End_token: "); + sb.Append(End_token); + sb.Append(", Endpoints: "); + sb.Append(Endpoints); + if (Rpc_endpoints != null && __isset.rpc_endpoints) + { + sb.Append(", Rpc_endpoints: "); + sb.Append(Rpc_endpoints); + } + if (Endpoint_details != null && __isset.endpoint_details) + { + sb.Append(", Endpoint_details: "); + sb.Append(Endpoint_details); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool rpc_endpoints; + [DataMember] public bool endpoint_details; + } + + #region XmlSerializer support + + public bool ShouldSerializeRpc_endpoints() + { + return __isset.rpc_endpoints; + } + + public bool ShouldSerializeEndpoint_details() + { + return __isset.endpoint_details; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs new file mode 100644 index 00000000000..e3f478e794c --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Apache.Cassandra.Test +{ + /// + /// Not all the replicas required could be created and/or read. + /// + public partial class UnavailableException : TException, TBase + { + public UnavailableException() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("UnavailableException"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("UnavailableException("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract] + public partial class UnavailableExceptionFault + { + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs new file mode 100644 index 00000000000..2cad49d3b40 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs @@ -0,0 +1,3538 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Facebook.FB303.Test +{ + public partial class FacebookService + { + /// + /// Standard base service + /// + [ServiceContract(Namespace = "")] + public interface IAsync + { + /// + /// Returns a descriptive name of the service + /// + [OperationContract] + Task getNameAsync(CancellationToken cancellationToken); + + /// + /// Returns the version of the service + /// + [OperationContract] + Task getVersionAsync(CancellationToken cancellationToken); + + /// + /// Gets the status of this service + /// + [OperationContract] + Task getStatusAsync(CancellationToken cancellationToken); + + /// + /// User friendly description of status, such as why the service is in + /// the dead or warning state, or what is being started or stopped. + /// + [OperationContract] + Task getStatusDetailsAsync(CancellationToken cancellationToken); + + /// + /// Gets the counters for this service + /// + [OperationContract] + Task> getCountersAsync(CancellationToken cancellationToken); + + /// + /// Gets the value of a single counter + /// + /// + [OperationContract] + Task getCounterAsync(string key, CancellationToken cancellationToken); + + /// + /// Sets an option + /// + /// + /// + [OperationContract] + Task setOptionAsync(string key, string @value, CancellationToken cancellationToken); + + /// + /// Gets an option + /// + /// + [OperationContract] + Task getOptionAsync(string key, CancellationToken cancellationToken); + + /// + /// Gets all options + /// + [OperationContract] + Task> getOptionsAsync(CancellationToken cancellationToken); + + /// + /// Returns a CPU profile over the given time interval (client and server + /// must agree on the profile format). + /// + /// + [OperationContract] + Task getCpuProfileAsync(int profileDurationInSec, CancellationToken cancellationToken); + + /// + /// Returns the unix time that the server has been running since + /// + [OperationContract] + Task aliveSinceAsync(CancellationToken cancellationToken); + + /// + /// Tell the server to reload its configuration, reopen log files, etc + /// + [OperationContract] + Task reinitializeAsync(CancellationToken cancellationToken); + + /// + /// Suggest a shutdown to the server + /// + [OperationContract] + Task shutdownAsync(CancellationToken cancellationToken); + } + + + /// + /// Standard base service + /// + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task getNameAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getNameArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getNameResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getName failed: unknown result"); + } + + public async Task getVersionAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getVersionArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getVersionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getVersion failed: unknown result"); + } + + public async Task getStatusAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getStatusArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getStatusResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getStatus failed: unknown result"); + } + + public async Task getStatusDetailsAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getStatusDetailsArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getStatusDetailsResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getStatusDetails failed: unknown result"); + } + + public async Task> getCountersAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getCountersArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getCountersResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getCounters failed: unknown result"); + } + + public async Task getCounterAsync(string key, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getCounterArgs(); + args.Key = key; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getCounterResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getCounter failed: unknown result"); + } + + public async Task setOptionAsync(string key, string @value, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Call, SeqId), + cancellationToken); + + var args = new setOptionArgs(); + args.Key = key; + args.Value = @value; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new setOptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task getOptionAsync(string key, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getOptionArgs(); + args.Key = key; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getOptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getOption failed: unknown result"); + } + + public async Task> getOptionsAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getOptionsArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getOptionsResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getOptions failed: unknown result"); + } + + public async Task getCpuProfileAsync(int profileDurationInSec, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Call, SeqId), + cancellationToken); + + var args = new getCpuProfileArgs(); + args.ProfileDurationInSec = profileDurationInSec; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new getCpuProfileResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "getCpuProfile failed: unknown result"); + } + + public async Task aliveSinceAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Call, SeqId), + cancellationToken); + + var args = new aliveSinceArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new aliveSinceResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "aliveSince failed: unknown result"); + } + + public async Task reinitializeAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("reinitialize", TMessageType.Oneway, SeqId), + cancellationToken); + + var args = new reinitializeArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + } + + public async Task shutdownAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("shutdown", TMessageType.Oneway, SeqId), + cancellationToken); + + var args = new shutdownArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + protected Dictionary processMap_ = new Dictionary(); + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["getName"] = getName_ProcessAsync; + processMap_["getVersion"] = getVersion_ProcessAsync; + processMap_["getStatus"] = getStatus_ProcessAsync; + processMap_["getStatusDetails"] = getStatusDetails_ProcessAsync; + processMap_["getCounters"] = getCounters_ProcessAsync; + processMap_["getCounter"] = getCounter_ProcessAsync; + processMap_["setOption"] = setOption_ProcessAsync; + processMap_["getOption"] = getOption_ProcessAsync; + processMap_["getOptions"] = getOptions_ProcessAsync; + processMap_["getCpuProfile"] = getCpuProfile_ProcessAsync; + processMap_["aliveSince"] = aliveSince_ProcessAsync; + processMap_["reinitialize"] = reinitialize_ProcessAsync; + processMap_["shutdown"] = shutdown_ProcessAsync; + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task getName_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getNameArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getNameResult(); + try + { + result.Success = await _iAsync.getNameAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getVersion_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getVersionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getVersionResult(); + try + { + result.Success = await _iAsync.getVersionAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getStatus_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getStatusArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getStatusResult(); + try + { + result.Success = await _iAsync.getStatusAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getStatusDetails_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getStatusDetailsArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getStatusDetailsResult(); + try + { + result.Success = await _iAsync.getStatusDetailsAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getCounters_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getCountersArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getCountersResult(); + try + { + result.Success = await _iAsync.getCountersAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getCounter_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getCounterArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getCounterResult(); + try + { + result.Success = await _iAsync.getCounterAsync(args.Key, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task setOption_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new setOptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new setOptionResult(); + try + { + await _iAsync.setOptionAsync(args.Key, args.Value, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getOption_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getOptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getOptionResult(); + try + { + result.Success = await _iAsync.getOptionAsync(args.Key, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getOptions_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getOptionsArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getOptionsResult(); + try + { + result.Success = await _iAsync.getOptionsAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task getCpuProfile_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new getCpuProfileArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new getCpuProfileResult(); + try + { + result.Success = await _iAsync.getCpuProfileAsync(args.ProfileDurationInSec, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task aliveSince_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new aliveSinceArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new aliveSinceResult(); + try + { + result.Success = await _iAsync.aliveSinceAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task reinitialize_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new reinitializeArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + try + { + await _iAsync.reinitializeAsync(cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + } + } + + public async Task shutdown_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new shutdownArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + try + { + await _iAsync.shutdownAsync(cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + } + } + + protected delegate Task ProcessFunction( + int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } + + + [DataContract(Namespace = "")] + public partial class getNameArgs : TBase + { + public getNameArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getName_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getName_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getNameResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public getNameResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getName_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getName_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getVersionArgs : TBase + { + public getVersionArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getVersion_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getVersion_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getVersionResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public getVersionResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getVersion_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getVersion_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getStatusArgs : TBase + { + public getStatusArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getStatus_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getStatus_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getStatusResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private fb_status _success; + + public getStatusResult() + { + } + + /// + /// + /// + [DataMember(Order = 0)] + public fb_status Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = (fb_status) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getStatus_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getStatus_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getStatusDetailsArgs : TBase + { + public getStatusDetailsArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getStatusDetails_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getStatusDetails_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getStatusDetailsResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public getStatusDetailsResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getStatusDetails_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getStatusDetails_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getCountersArgs : TBase + { + public getCountersArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCounters_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getCounters_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getCountersResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _success; + + public getCountersResult() + { + } + + [DataMember(Order = 0)] + public Dictionary Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i1 = 0; _i1 < _map0.Count; ++_i1) + { + string _key2; + long _val3; + _key2 = await iprot.ReadStringAsync(cancellationToken); + _val3 = await iprot.ReadI64Async(cancellationToken); + Success[_key2] = _val3; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCounters_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.I64, Success.Count), + cancellationToken); + foreach (string _iter4 in Success.Keys) + { + await oprot.WriteStringAsync(_iter4, cancellationToken); + await oprot.WriteI64Async(Success[_iter4], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getCounters_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getCounterArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _key; + + public getCounterArgs() + { + } + + [DataMember(Order = 0)] + public string Key + { + get { return _key; } + set + { + __isset.key = true; + this._key = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCounter_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Key != null && __isset.key) + { + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeKey() + { + return __isset.key; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getCounter_args("); + bool __first = true; + if (Key != null && __isset.key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Key: "); + sb.Append(Key); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool key; + } + } + + + [DataContract(Namespace = "")] + public partial class getCounterResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _success; + + public getCounterResult() + { + } + + [DataMember(Order = 0)] + public long Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCounter_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getCounter_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class setOptionArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _key; + private string _value; + + public setOptionArgs() + { + } + + [DataMember(Order = 0)] + public string Key + { + get { return _key; } + set + { + __isset.key = true; + this._key = value; + } + } + + [DataMember(Order = 0)] + public string Value + { + get { return _value; } + set + { + __isset.@value = true; + this._value = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Value = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("setOption_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Key != null && __isset.key) + { + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Value != null && __isset.@value) + { + field.Name = "value"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Value, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("setOption_args("); + bool __first = true; + if (Key != null && __isset.key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Key: "); + sb.Append(Key); + } + if (Value != null && __isset.@value) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Value: "); + sb.Append(Value); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool key; + [DataMember] public bool @value; + } + + #region XmlSerializer support + + public bool ShouldSerializeKey() + { + return __isset.key; + } + + public bool ShouldSerializeValue() + { + return __isset.@value; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class setOptionResult : TBase + { + public setOptionResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("setOption_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("setOption_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getOptionArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _key; + + public getOptionArgs() + { + } + + [DataMember(Order = 0)] + public string Key + { + get { return _key; } + set + { + __isset.key = true; + this._key = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Key = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getOption_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Key != null && __isset.key) + { + field.Name = "key"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeKey() + { + return __isset.key; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getOption_args("); + bool __first = true; + if (Key != null && __isset.key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Key: "); + sb.Append(Key); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool key; + } + } + + + [DataContract(Namespace = "")] + public partial class getOptionResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public getOptionResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getOption_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getOption_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getOptionsArgs : TBase + { + public getOptionsArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getOptions_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("getOptions_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class getOptionsResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _success; + + public getOptionsResult() + { + } + + [DataMember(Order = 0)] + public Dictionary Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map5 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i6 = 0; _i6 < _map5.Count; ++_i6) + { + string _key7; + string _val8; + _key7 = await iprot.ReadStringAsync(cancellationToken); + _val8 = await iprot.ReadStringAsync(cancellationToken); + Success[_key7] = _val8; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getOptions_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), + cancellationToken); + foreach (string _iter9 in Success.Keys) + { + await oprot.WriteStringAsync(_iter9, cancellationToken); + await oprot.WriteStringAsync(Success[_iter9], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getOptions_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class getCpuProfileArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _profileDurationInSec; + + public getCpuProfileArgs() + { + } + + [DataMember(Order = 0)] + public int ProfileDurationInSec + { + get { return _profileDurationInSec; } + set + { + __isset.profileDurationInSec = true; + this._profileDurationInSec = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ProfileDurationInSec = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCpuProfile_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.profileDurationInSec) + { + field.Name = "profileDurationInSec"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ProfileDurationInSec, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeProfileDurationInSec() + { + return __isset.profileDurationInSec; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getCpuProfile_args("); + bool __first = true; + if (__isset.profileDurationInSec) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("ProfileDurationInSec: "); + sb.Append(ProfileDurationInSec); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool profileDurationInSec; + } + } + + + [DataContract(Namespace = "")] + public partial class getCpuProfileResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public getCpuProfileResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("getCpuProfile_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("getCpuProfile_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class aliveSinceArgs : TBase + { + public aliveSinceArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("aliveSince_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("aliveSince_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class aliveSinceResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _success; + + public aliveSinceResult() + { + } + + [DataMember(Order = 0)] + public long Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("aliveSince_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("aliveSince_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class reinitializeArgs : TBase + { + public reinitializeArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("reinitialize_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("reinitialize_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class shutdownArgs : TBase + { + public shutdownArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("shutdown_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("shutdown_args("); + sb.Append(")"); + return sb.ToString(); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs new file mode 100644 index 00000000000..2518022b463 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Facebook.FB303.Test +{ + /// + /// Common status reporting mechanism across all services + /// + public enum fb_status + { + DEAD = 0, + STARTING = 1, + ALIVE = 2, + STOPPING = 3, + STOPPED = 4, + WARNING = 5, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs new file mode 100644 index 00000000000..08a8cdd0834 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Bonk : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _message; + private int _type; + + public Bonk() + { + } + + [DataMember(Order = 0)] + public string Message + { + get { return _message; } + set + { + __isset.message = true; + this._message = value; + } + } + + [DataMember(Order = 0)] + public int Type + { + get { return _type; } + set + { + __isset.type = true; + this._type = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Message = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Type = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Bonk"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Message != null && __isset.message) + { + field.Name = "message"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Message, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.type) + { + field.Name = "type"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Bonk("); + bool __first = true; + if (Message != null && __isset.message) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Message: "); + sb.Append(Message); + } + if (__isset.type) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Type: "); + sb.Append(Type); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool message; + [DataMember] public bool type; + } + + #region XmlSerializer support + + public bool ShouldSerializeMessage() + { + return __isset.message; + } + + public bool ShouldSerializeType() + { + return __isset.type; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs new file mode 100644 index 00000000000..06030a5bbf3 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs @@ -0,0 +1,214 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class BoolTest : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private bool _b; + private string _s; + + public BoolTest() + { + this._b = true; + this.__isset.b = true; + this._s = "true"; + this.__isset.s = true; + } + + [DataMember(Order = 0)] + public bool B + { + get { return _b; } + set + { + __isset.b = true; + this._b = value; + } + } + + [DataMember(Order = 0)] + public string S + { + get { return _s; } + set + { + __isset.s = true; + this._s = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + B = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + S = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("BoolTest"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.b) + { + field.Name = "b"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(B, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (S != null && __isset.s) + { + field.Name = "s"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(S, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("BoolTest("); + bool __first = true; + if (__isset.b) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("B: "); + sb.Append(B); + } + if (S != null && __isset.s) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("S: "); + sb.Append(S); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool b; + [DataMember] public bool s; + } + + #region XmlSerializer support + + public bool ShouldSerializeB() + { + return __isset.b; + } + + public bool ShouldSerializeS() + { + return __isset.s; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs new file mode 100644 index 00000000000..5e301db4605 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Bools : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private bool _im_false; + private bool _im_true; + + public Bools() + { + } + + [DataMember(Order = 0)] + public bool Im_true + { + get { return _im_true; } + set + { + __isset.im_true = true; + this._im_true = value; + } + } + + [DataMember(Order = 0)] + public bool Im_false + { + get { return _im_false; } + set + { + __isset.im_false = true; + this._im_false = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + Im_true = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Bool) + { + Im_false = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Bools"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.im_true) + { + field.Name = "im_true"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Im_true, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.im_false) + { + field.Name = "im_false"; + field.Type = TType.Bool; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Im_false, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Bools("); + bool __first = true; + if (__isset.im_true) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Im_true: "); + sb.Append(Im_true); + } + if (__isset.im_false) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Im_false: "); + sb.Append(Im_false); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool im_true; + [DataMember] public bool im_false; + } + + #region XmlSerializer support + + public bool ShouldSerializeIm_true() + { + return __isset.im_true; + } + + public bool ShouldSerializeIm_false() + { + return __isset.im_false; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs new file mode 100644 index 00000000000..d1bbc1f4a7e --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs @@ -0,0 +1,482 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class CrazyNesting : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _binary_field; + private THashSet _set_field; + private string _string_field; + + public CrazyNesting() + { + } + + public CrazyNesting( + List, Dictionary>>>>> list_field) + : this() + { + this.List_field = list_field; + } + + [DataMember(Order = 0)] + public string String_field + { + get { return _string_field; } + set + { + __isset.string_field = true; + this._string_field = value; + } + } + + [DataMember(Order = 0)] + public THashSet Set_field + { + get { return _set_field; } + set + { + __isset.set_field = true; + this._set_field = value; + } + } + + [DataMember(Order = 0)] + public List, Dictionary>>>>> List_field + { get; set; } + + [DataMember(Order = 0)] + public byte[] Binary_field + { + get { return _binary_field; } + set + { + __isset.binary_field = true; + this._binary_field = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_list_field = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_field = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Set) + { + { + Set_field = new THashSet(); + TSet _set9 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i10 = 0; _i10 < _set9.Count; ++_i10) + { + Insanity _elem11; + _elem11 = new Insanity(); + await _elem11.ReadAsync(iprot, cancellationToken); + Set_field.Add(_elem11); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + List_field = + new List + < + Dictionary + , + Dictionary>>>>>(); + TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i13 = 0; _i13 < _list12.Count; ++_i13) + { + Dictionary + , + Dictionary>>>> _elem14; + { + _elem14 = + new Dictionary + , + Dictionary>>>>(); + TMap _map15 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i16 = 0; _i16 < _map15.Count; ++_i16) + { + THashSet _key17; + Dictionary>>> _val18; + { + _key17 = new THashSet(); + TSet _set19 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i20 = 0; _i20 < _set19.Count; ++_i20) + { + int _elem21; + _elem21 = await iprot.ReadI32Async(cancellationToken); + _key17.Add(_elem21); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + { + _val18 = + new Dictionary + >>>(); + TMap _map22 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i23 = 0; _i23 < _map22.Count; ++_i23) + { + int _key24; + THashSet>> _val25; + _key24 = await iprot.ReadI32Async(cancellationToken); + { + _val25 = new THashSet>>(); + TSet _set26 = + await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i27 = 0; _i27 < _set26.Count; ++_i27) + { + List> _elem28; + { + _elem28 = new List>(); + TList _list29 = + await + iprot.ReadListBeginAsync(cancellationToken); + for (int _i30 = 0; _i30 < _list29.Count; ++_i30) + { + Dictionary _elem31; + { + _elem31 = new Dictionary(); + TMap _map32 = + await + iprot.ReadMapBeginAsync( + cancellationToken); + for (int _i33 = 0; + _i33 < _map32.Count; + ++_i33) + { + Insanity _key34; + string _val35; + _key34 = new Insanity(); + await + _key34.ReadAsync(iprot, + cancellationToken); + _val35 = + await + iprot.ReadStringAsync( + cancellationToken); + _elem31[_key34] = _val35; + } + await + iprot.ReadMapEndAsync(cancellationToken); + } + _elem28.Add(_elem31); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _val25.Add(_elem28); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + _val18[_key24] = _val25; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + _elem14[_key17] = _val18; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + List_field.Add(_elem14); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_list_field = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Binary_field = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_list_field) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CrazyNesting"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_field != null && __isset.string_field) + { + field.Name = "string_field"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_field, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Set_field != null && __isset.set_field) + { + field.Name = "set_field"; + field.Type = TType.Set; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.Struct, Set_field.Count), cancellationToken); + foreach (Insanity _iter36 in Set_field) + { + await _iter36.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "list_field"; + field.Type = TType.List; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Map, List_field.Count), cancellationToken); + foreach ( + Dictionary, Dictionary>>>> _iter37 + in List_field) + { + { + await + oprot.WriteMapBeginAsync(new TMap(TType.Set, TType.Map, _iter37.Count), + cancellationToken); + foreach (THashSet _iter38 in _iter37.Keys) + { + { + await + oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter38.Count), cancellationToken); + foreach (int _iter39 in _iter38) + { + await oprot.WriteI32Async(_iter39, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.I32, TType.Set, _iter37[_iter38].Count), cancellationToken); + foreach (int _iter40 in _iter37[_iter38].Keys) + { + await oprot.WriteI32Async(_iter40, cancellationToken); + { + await + oprot.WriteSetBeginAsync( + new TSet(TType.List, _iter37[_iter38][_iter40].Count), + cancellationToken); + foreach ( + List> _iter41 in _iter37[_iter38][_iter40]) + { + { + await + oprot.WriteListBeginAsync(new TList(TType.Map, _iter41.Count), + cancellationToken); + foreach (Dictionary _iter42 in _iter41) + { + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.Struct, TType.String, _iter42.Count), + cancellationToken); + foreach (Insanity _iter43 in _iter42.Keys) + { + await _iter43.WriteAsync(oprot, cancellationToken); + await + oprot.WriteStringAsync(_iter42[_iter43], + cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + if (Binary_field != null && __isset.binary_field) + { + field.Name = "binary_field"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Binary_field, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CrazyNesting("); + bool __first = true; + if (String_field != null && __isset.string_field) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("String_field: "); + sb.Append(String_field); + } + if (Set_field != null && __isset.set_field) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Set_field: "); + sb.Append(Set_field); + } + if (!__first) + { + sb.Append(", "); + } + sb.Append("List_field: "); + sb.Append(List_field); + if (Binary_field != null && __isset.binary_field) + { + sb.Append(", Binary_field: "); + sb.Append(Binary_field); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool string_field; + [DataMember] public bool set_field; + [DataMember] public bool binary_field; + } + + #region XmlSerializer support + + public bool ShouldSerializeString_field() + { + return __isset.string_field; + } + + public bool ShouldSerializeSet_field() + { + return __isset.set_field; + } + + public bool ShouldSerializeBinary_field() + { + return __isset.binary_field; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs new file mode 100644 index 00000000000..59096b47c0d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs @@ -0,0 +1,102 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class EmptyStruct : TBase + { + public EmptyStruct() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("EmptyStruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("EmptyStruct("); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs new file mode 100644 index 00000000000..ed8c0e72876 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs @@ -0,0 +1,185 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class GuessProtocolStruct : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _map_field; + + public GuessProtocolStruct() + { + } + + [DataMember(Order = 0)] + public Dictionary Map_field + { + get { return _map_field; } + set + { + __isset.map_field = true; + this._map_field = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 7: + if (field.Type == TType.Map) + { + { + Map_field = new Dictionary(); + TMap _map65 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i66 = 0; _i66 < _map65.Count; ++_i66) + { + string _key67; + string _val68; + _key67 = await iprot.ReadStringAsync(cancellationToken); + _val68 = await iprot.ReadStringAsync(cancellationToken); + Map_field[_key67] = _val68; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("GuessProtocolStruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Map_field != null && __isset.map_field) + { + field.Name = "map_field"; + field.Type = TType.Map; + field.ID = 7; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Map_field.Count), + cancellationToken); + foreach (string _iter69 in Map_field.Keys) + { + await oprot.WriteStringAsync(_iter69, cancellationToken); + await oprot.WriteStringAsync(Map_field[_iter69], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeMap_field() + { + return __isset.map_field; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("GuessProtocolStruct("); + bool __first = true; + if (Map_field != null && __isset.map_field) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Map_field: "); + sb.Append(Map_field); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool map_field; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs new file mode 100644 index 00000000000..34b2c7aedc6 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs @@ -0,0 +1,248 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Insanity : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _userMap; + private List _xtructs; + + public Insanity() + { + } + + [DataMember(Order = 0)] + public Dictionary UserMap + { + get { return _userMap; } + set + { + __isset.userMap = true; + this._userMap = value; + } + } + + [DataMember(Order = 0)] + public List Xtructs + { + get { return _xtructs; } + set + { + __isset.xtructs = true; + this._xtructs = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + UserMap = new Dictionary(); + TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i1 = 0; _i1 < _map0.Count; ++_i1) + { + Numberz _key2; + long _val3; + _key2 = (Numberz) await iprot.ReadI32Async(cancellationToken); + _val3 = await iprot.ReadI64Async(cancellationToken); + UserMap[_key2] = _val3; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Xtructs = new List(); + TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i5 = 0; _i5 < _list4.Count; ++_i5) + { + Xtruct _elem6; + _elem6 = new Xtruct(); + await _elem6.ReadAsync(iprot, cancellationToken); + Xtructs.Add(_elem6); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Insanity"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (UserMap != null && __isset.userMap) + { + field.Name = "userMap"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I64, UserMap.Count), cancellationToken); + foreach (Numberz _iter7 in UserMap.Keys) + { + await oprot.WriteI32Async((int) _iter7, cancellationToken); + await oprot.WriteI64Async(UserMap[_iter7], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Xtructs != null && __isset.xtructs) + { + field.Name = "xtructs"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Xtructs.Count), cancellationToken); + foreach (Xtruct _iter8 in Xtructs) + { + await _iter8.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Insanity("); + bool __first = true; + if (UserMap != null && __isset.userMap) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("UserMap: "); + sb.Append(UserMap); + } + if (Xtructs != null && __isset.xtructs) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Xtructs: "); + sb.Append(Xtructs); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool userMap; + [DataMember] public bool xtructs; + } + + #region XmlSerializer support + + public bool ShouldSerializeUserMap() + { + return __isset.userMap; + } + + public bool ShouldSerializeXtructs() + { + return __isset.xtructs; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs new file mode 100644 index 00000000000..0e6eccf1342 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs @@ -0,0 +1,626 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class LargeDeltas : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private THashSet _a_set2500; + private Bools _b1; + private Bools _b10; + private Bools _b100; + private Bools _b1000; + private List _big_numbers; + private bool _check_false; + private bool _check_true; + private VersioningTestV2 _vertwo2000; + private VersioningTestV2 _vertwo3000; + + public LargeDeltas() + { + } + + [DataMember(Order = 0)] + public Bools B1 + { + get { return _b1; } + set + { + __isset.b1 = true; + this._b1 = value; + } + } + + [DataMember(Order = 0)] + public Bools B10 + { + get { return _b10; } + set + { + __isset.b10 = true; + this._b10 = value; + } + } + + [DataMember(Order = 0)] + public Bools B100 + { + get { return _b100; } + set + { + __isset.b100 = true; + this._b100 = value; + } + } + + [DataMember(Order = 0)] + public bool Check_true + { + get { return _check_true; } + set + { + __isset.check_true = true; + this._check_true = value; + } + } + + [DataMember(Order = 0)] + public Bools B1000 + { + get { return _b1000; } + set + { + __isset.b1000 = true; + this._b1000 = value; + } + } + + [DataMember(Order = 0)] + public bool Check_false + { + get { return _check_false; } + set + { + __isset.check_false = true; + this._check_false = value; + } + } + + [DataMember(Order = 0)] + public VersioningTestV2 Vertwo2000 + { + get { return _vertwo2000; } + set + { + __isset.vertwo2000 = true; + this._vertwo2000 = value; + } + } + + [DataMember(Order = 0)] + public THashSet A_set2500 + { + get { return _a_set2500; } + set + { + __isset.a_set2500 = true; + this._a_set2500 = value; + } + } + + [DataMember(Order = 0)] + public VersioningTestV2 Vertwo3000 + { + get { return _vertwo3000; } + set + { + __isset.vertwo3000 = true; + this._vertwo3000 = value; + } + } + + [DataMember(Order = 0)] + public List Big_numbers + { + get { return _big_numbers; } + set + { + __isset.big_numbers = true; + this._big_numbers = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + B1 = new Bools(); + await B1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 10: + if (field.Type == TType.Struct) + { + B10 = new Bools(); + await B10.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 100: + if (field.Type == TType.Struct) + { + B100 = new Bools(); + await B100.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 500: + if (field.Type == TType.Bool) + { + Check_true = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1000: + if (field.Type == TType.Struct) + { + B1000 = new Bools(); + await B1000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1500: + if (field.Type == TType.Bool) + { + Check_false = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2000: + if (field.Type == TType.Struct) + { + Vertwo2000 = new VersioningTestV2(); + await Vertwo2000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2500: + if (field.Type == TType.Set) + { + { + A_set2500 = new THashSet(); + TSet _set70 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i71 = 0; _i71 < _set70.Count; ++_i71) + { + string _elem72; + _elem72 = await iprot.ReadStringAsync(cancellationToken); + A_set2500.Add(_elem72); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3000: + if (field.Type == TType.Struct) + { + Vertwo3000 = new VersioningTestV2(); + await Vertwo3000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4000: + if (field.Type == TType.List) + { + { + Big_numbers = new List(); + TList _list73 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i74 = 0; _i74 < _list73.Count; ++_i74) + { + int _elem75; + _elem75 = await iprot.ReadI32Async(cancellationToken); + Big_numbers.Add(_elem75); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("LargeDeltas"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (B1 != null && __isset.b1) + { + field.Name = "b1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B10 != null && __isset.b10) + { + field.Name = "b10"; + field.Type = TType.Struct; + field.ID = 10; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B10.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B100 != null && __isset.b100) + { + field.Name = "b100"; + field.Type = TType.Struct; + field.ID = 100; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B100.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.check_true) + { + field.Name = "check_true"; + field.Type = TType.Bool; + field.ID = 500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Check_true, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B1000 != null && __isset.b1000) + { + field.Name = "b1000"; + field.Type = TType.Struct; + field.ID = 1000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B1000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.check_false) + { + field.Name = "check_false"; + field.Type = TType.Bool; + field.ID = 1500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Check_false, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Vertwo2000 != null && __isset.vertwo2000) + { + field.Name = "vertwo2000"; + field.Type = TType.Struct; + field.ID = 2000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Vertwo2000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (A_set2500 != null && __isset.a_set2500) + { + field.Name = "a_set2500"; + field.Type = TType.Set; + field.ID = 2500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.String, A_set2500.Count), cancellationToken); + foreach (string _iter76 in A_set2500) + { + await oprot.WriteStringAsync(_iter76, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Vertwo3000 != null && __isset.vertwo3000) + { + field.Name = "vertwo3000"; + field.Type = TType.Struct; + field.ID = 3000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Vertwo3000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Big_numbers != null && __isset.big_numbers) + { + field.Name = "big_numbers"; + field.Type = TType.List; + field.ID = 4000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Big_numbers.Count), cancellationToken); + foreach (int _iter77 in Big_numbers) + { + await oprot.WriteI32Async(_iter77, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("LargeDeltas("); + bool __first = true; + if (B1 != null && __isset.b1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("B1: "); + sb.Append(B1 == null ? "" : B1.ToString()); + } + if (B10 != null && __isset.b10) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("B10: "); + sb.Append(B10 == null ? "" : B10.ToString()); + } + if (B100 != null && __isset.b100) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("B100: "); + sb.Append(B100 == null ? "" : B100.ToString()); + } + if (__isset.check_true) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Check_true: "); + sb.Append(Check_true); + } + if (B1000 != null && __isset.b1000) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("B1000: "); + sb.Append(B1000 == null ? "" : B1000.ToString()); + } + if (__isset.check_false) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Check_false: "); + sb.Append(Check_false); + } + if (Vertwo2000 != null && __isset.vertwo2000) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Vertwo2000: "); + sb.Append(Vertwo2000 == null ? "" : Vertwo2000.ToString()); + } + if (A_set2500 != null && __isset.a_set2500) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("A_set2500: "); + sb.Append(A_set2500); + } + if (Vertwo3000 != null && __isset.vertwo3000) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Vertwo3000: "); + sb.Append(Vertwo3000 == null ? "" : Vertwo3000.ToString()); + } + if (Big_numbers != null && __isset.big_numbers) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Big_numbers: "); + sb.Append(Big_numbers); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool b1; + [DataMember] public bool b10; + [DataMember] public bool b100; + [DataMember] public bool check_true; + [DataMember] public bool b1000; + [DataMember] public bool check_false; + [DataMember] public bool vertwo2000; + [DataMember] public bool a_set2500; + [DataMember] public bool vertwo3000; + [DataMember] public bool big_numbers; + } + + #region XmlSerializer support + + public bool ShouldSerializeB1() + { + return __isset.b1; + } + + public bool ShouldSerializeB10() + { + return __isset.b10; + } + + public bool ShouldSerializeB100() + { + return __isset.b100; + } + + public bool ShouldSerializeCheck_true() + { + return __isset.check_true; + } + + public bool ShouldSerializeB1000() + { + return __isset.b1000; + } + + public bool ShouldSerializeCheck_false() + { + return __isset.check_false; + } + + public bool ShouldSerializeVertwo2000() + { + return __isset.vertwo2000; + } + + public bool ShouldSerializeA_set2500() + { + return __isset.a_set2500; + } + + public bool ShouldSerializeVertwo3000() + { + return __isset.vertwo3000; + } + + public bool ShouldSerializeBig_numbers() + { + return __isset.big_numbers; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs new file mode 100644 index 00000000000..46facba9145 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs @@ -0,0 +1,181 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class ListBonks : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List _bonk; + + public ListBonks() + { + } + + [DataMember(Order = 0)] + public List Bonk + { + get { return _bonk; } + set + { + __isset.bonk = true; + this._bonk = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Bonk = new List(); + TList _list128 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i129 = 0; _i129 < _list128.Count; ++_i129) + { + Bonk _elem130; + _elem130 = new Bonk(); + await _elem130.ReadAsync(iprot, cancellationToken); + Bonk.Add(_elem130); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListBonks"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Bonk != null && __isset.bonk) + { + field.Name = "bonk"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Bonk.Count), cancellationToken); + foreach (Bonk _iter131 in Bonk) + { + await _iter131.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeBonk() + { + return __isset.bonk; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("ListBonks("); + bool __first = true; + if (Bonk != null && __isset.bonk) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Bonk: "); + sb.Append(Bonk); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool bonk; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs new file mode 100644 index 00000000000..6f489dd8ecc --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs @@ -0,0 +1,227 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class ListTypeVersioningV1 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _hello; + private List _myints; + + public ListTypeVersioningV1() + { + } + + [DataMember(Order = 0)] + public List Myints + { + get { return _myints; } + set + { + __isset.myints = true; + this._myints = value; + } + } + + [DataMember(Order = 0)] + public string Hello + { + get { return _hello; } + set + { + __isset.hello = true; + this._hello = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Myints = new List(); + TList _list57 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i58 = 0; _i58 < _list57.Count; ++_i58) + { + int _elem59; + _elem59 = await iprot.ReadI32Async(cancellationToken); + Myints.Add(_elem59); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Hello = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListTypeVersioningV1"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Myints != null && __isset.myints) + { + field.Name = "myints"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Myints.Count), cancellationToken); + foreach (int _iter60 in Myints) + { + await oprot.WriteI32Async(_iter60, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Hello != null && __isset.hello) + { + field.Name = "hello"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ListTypeVersioningV1("); + bool __first = true; + if (Myints != null && __isset.myints) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Myints: "); + sb.Append(Myints); + } + if (Hello != null && __isset.hello) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool myints; + [DataMember] public bool hello; + } + + #region XmlSerializer support + + public bool ShouldSerializeMyints() + { + return __isset.myints; + } + + public bool ShouldSerializeHello() + { + return __isset.hello; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs new file mode 100644 index 00000000000..abaf3044a73 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs @@ -0,0 +1,227 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class ListTypeVersioningV2 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _hello; + private List _strings; + + public ListTypeVersioningV2() + { + } + + [DataMember(Order = 0)] + public List Strings + { + get { return _strings; } + set + { + __isset.strings = true; + this._strings = value; + } + } + + [DataMember(Order = 0)] + public string Hello + { + get { return _hello; } + set + { + __isset.hello = true; + this._hello = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Strings = new List(); + TList _list61 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i62 = 0; _i62 < _list61.Count; ++_i62) + { + string _elem63; + _elem63 = await iprot.ReadStringAsync(cancellationToken); + Strings.Add(_elem63); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Hello = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListTypeVersioningV2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Strings != null && __isset.strings) + { + field.Name = "strings"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Strings.Count), cancellationToken); + foreach (string _iter64 in Strings) + { + await oprot.WriteStringAsync(_iter64, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Hello != null && __isset.hello) + { + field.Name = "hello"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ListTypeVersioningV2("); + bool __first = true; + if (Strings != null && __isset.strings) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Strings: "); + sb.Append(Strings); + } + if (Hello != null && __isset.hello) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool strings; + [DataMember] public bool hello; + } + + #region XmlSerializer support + + public bool ShouldSerializeStrings() + { + return __isset.strings; + } + + public bool ShouldSerializeHello() + { + return __isset.hello; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs new file mode 100644 index 00000000000..1b015cb65c5 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs @@ -0,0 +1,218 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class NestedListsBonk : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List>> _bonk; + + public NestedListsBonk() + { + } + + [DataMember(Order = 0)] + public List>> Bonk + { + get { return _bonk; } + set + { + __isset.bonk = true; + this._bonk = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Bonk = new List>>(); + TList _list132 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i133 = 0; _i133 < _list132.Count; ++_i133) + { + List> _elem134; + { + _elem134 = new List>(); + TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i136 = 0; _i136 < _list135.Count; ++_i136) + { + List _elem137; + { + _elem137 = new List(); + TList _list138 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i139 = 0; _i139 < _list138.Count; ++_i139) + { + Bonk _elem140; + _elem140 = new Bonk(); + await _elem140.ReadAsync(iprot, cancellationToken); + _elem137.Add(_elem140); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _elem134.Add(_elem137); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Bonk.Add(_elem134); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsBonk"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Bonk != null && __isset.bonk) + { + field.Name = "bonk"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Bonk.Count), cancellationToken); + foreach (List> _iter141 in Bonk) + { + { + await + oprot.WriteListBeginAsync(new TList(TType.List, _iter141.Count), cancellationToken); + foreach (List _iter142 in _iter141) + { + { + await + oprot.WriteListBeginAsync(new TList(TType.Struct, _iter142.Count), + cancellationToken); + foreach (Bonk _iter143 in _iter142) + { + await _iter143.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeBonk() + { + return __isset.bonk; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("NestedListsBonk("); + bool __first = true; + if (Bonk != null && __isset.bonk) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Bonk: "); + sb.Append(Bonk); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool bonk; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs new file mode 100644 index 00000000000..bbcd5528289 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs @@ -0,0 +1,197 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class NestedListsI32x2 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List> _integerlist; + + public NestedListsI32x2() + { + } + + [DataMember(Order = 0)] + public List> Integerlist + { + get { return _integerlist; } + set + { + __isset.integerlist = true; + this._integerlist = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Integerlist = new List>(); + TList _list78 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i79 = 0; _i79 < _list78.Count; ++_i79) + { + List _elem80; + { + _elem80 = new List(); + TList _list81 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i82 = 0; _i82 < _list81.Count; ++_i82) + { + int _elem83; + _elem83 = await iprot.ReadI32Async(cancellationToken); + _elem80.Add(_elem83); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Integerlist.Add(_elem80); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsI32x2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Integerlist != null && __isset.integerlist) + { + field.Name = "integerlist"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); + foreach (List _iter84 in Integerlist) + { + { + await oprot.WriteListBeginAsync(new TList(TType.I32, _iter84.Count), cancellationToken); + foreach (int _iter85 in _iter84) + { + await oprot.WriteI32Async(_iter85, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeIntegerlist() + { + return __isset.integerlist; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("NestedListsI32x2("); + bool __first = true; + if (Integerlist != null && __isset.integerlist) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Integerlist: "); + sb.Append(Integerlist); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool integerlist; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs new file mode 100644 index 00000000000..3f1a851b3e7 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs @@ -0,0 +1,216 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class NestedListsI32x3 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List>> _integerlist; + + public NestedListsI32x3() + { + } + + [DataMember(Order = 0)] + public List>> Integerlist + { + get { return _integerlist; } + set + { + __isset.integerlist = true; + this._integerlist = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Integerlist = new List>>(); + TList _list86 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i87 = 0; _i87 < _list86.Count; ++_i87) + { + List> _elem88; + { + _elem88 = new List>(); + TList _list89 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i90 = 0; _i90 < _list89.Count; ++_i90) + { + List _elem91; + { + _elem91 = new List(); + TList _list92 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i93 = 0; _i93 < _list92.Count; ++_i93) + { + int _elem94; + _elem94 = await iprot.ReadI32Async(cancellationToken); + _elem91.Add(_elem94); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _elem88.Add(_elem91); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Integerlist.Add(_elem88); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsI32x3"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Integerlist != null && __isset.integerlist) + { + field.Name = "integerlist"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); + foreach (List> _iter95 in Integerlist) + { + { + await oprot.WriteListBeginAsync(new TList(TType.List, _iter95.Count), cancellationToken); + foreach (List _iter96 in _iter95) + { + { + await + oprot.WriteListBeginAsync(new TList(TType.I32, _iter96.Count), + cancellationToken); + foreach (int _iter97 in _iter96) + { + await oprot.WriteI32Async(_iter97, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeIntegerlist() + { + return __isset.integerlist; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("NestedListsI32x3("); + bool __first = true; + if (Integerlist != null && __isset.integerlist) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Integerlist: "); + sb.Append(Integerlist); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool integerlist; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs new file mode 100644 index 00000000000..77b1416aa2f --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs @@ -0,0 +1,391 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class NestedMixedx2 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List> _int_set_list; + private Dictionary> _map_int_strset; + private List>> _map_int_strset_list; + + public NestedMixedx2() + { + } + + [DataMember(Order = 0)] + public List> Int_set_list + { + get { return _int_set_list; } + set + { + __isset.int_set_list = true; + this._int_set_list = value; + } + } + + [DataMember(Order = 0)] + public Dictionary> Map_int_strset + { + get { return _map_int_strset; } + set + { + __isset.map_int_strset = true; + this._map_int_strset = value; + } + } + + [DataMember(Order = 0)] + public List>> Map_int_strset_list + { + get { return _map_int_strset_list; } + set + { + __isset.map_int_strset_list = true; + this._map_int_strset_list = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Int_set_list = new List>(); + TList _list98 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i99 = 0; _i99 < _list98.Count; ++_i99) + { + THashSet _elem100; + { + _elem100 = new THashSet(); + TSet _set101 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i102 = 0; _i102 < _set101.Count; ++_i102) + { + int _elem103; + _elem103 = await iprot.ReadI32Async(cancellationToken); + _elem100.Add(_elem103); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + Int_set_list.Add(_elem100); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Map) + { + { + Map_int_strset = new Dictionary>(); + TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i105 = 0; _i105 < _map104.Count; ++_i105) + { + int _key106; + THashSet _val107; + _key106 = await iprot.ReadI32Async(cancellationToken); + { + _val107 = new THashSet(); + TSet _set108 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i109 = 0; _i109 < _set108.Count; ++_i109) + { + string _elem110; + _elem110 = await iprot.ReadStringAsync(cancellationToken); + _val107.Add(_elem110); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + Map_int_strset[_key106] = _val107; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + Map_int_strset_list = new List>>(); + TList _list111 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i112 = 0; _i112 < _list111.Count; ++_i112) + { + Dictionary> _elem113; + { + _elem113 = new Dictionary>(); + TMap _map114 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i115 = 0; _i115 < _map114.Count; ++_i115) + { + int _key116; + THashSet _val117; + _key116 = await iprot.ReadI32Async(cancellationToken); + { + _val117 = new THashSet(); + TSet _set118 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i119 = 0; _i119 < _set118.Count; ++_i119) + { + string _elem120; + _elem120 = await iprot.ReadStringAsync(cancellationToken); + _val117.Add(_elem120); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + _elem113[_key116] = _val117; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Map_int_strset_list.Add(_elem113); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedMixedx2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Int_set_list != null && __isset.int_set_list) + { + field.Name = "int_set_list"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Set, Int_set_list.Count), cancellationToken); + foreach (THashSet _iter121 in Int_set_list) + { + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter121.Count), cancellationToken); + foreach (int _iter122 in _iter121) + { + await oprot.WriteI32Async(_iter122, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Map_int_strset != null && __isset.map_int_strset) + { + field.Name = "map_int_strset"; + field.Type = TType.Map; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, Map_int_strset.Count), + cancellationToken); + foreach (int _iter123 in Map_int_strset.Keys) + { + await oprot.WriteI32Async(_iter123, cancellationToken); + { + await + oprot.WriteSetBeginAsync(new TSet(TType.String, Map_int_strset[_iter123].Count), + cancellationToken); + foreach (string _iter124 in Map_int_strset[_iter123]) + { + await oprot.WriteStringAsync(_iter124, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Map_int_strset_list != null && __isset.map_int_strset_list) + { + field.Name = "map_int_strset_list"; + field.Type = TType.List; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteListBeginAsync(new TList(TType.Map, Map_int_strset_list.Count), cancellationToken); + foreach (Dictionary> _iter125 in Map_int_strset_list) + { + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter125.Count), + cancellationToken); + foreach (int _iter126 in _iter125.Keys) + { + await oprot.WriteI32Async(_iter126, cancellationToken); + { + await + oprot.WriteSetBeginAsync(new TSet(TType.String, _iter125[_iter126].Count), + cancellationToken); + foreach (string _iter127 in _iter125[_iter126]) + { + await oprot.WriteStringAsync(_iter127, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NestedMixedx2("); + bool __first = true; + if (Int_set_list != null && __isset.int_set_list) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Int_set_list: "); + sb.Append(Int_set_list); + } + if (Map_int_strset != null && __isset.map_int_strset) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Map_int_strset: "); + sb.Append(Map_int_strset); + } + if (Map_int_strset_list != null && __isset.map_int_strset_list) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Map_int_strset_list: "); + sb.Append(Map_int_strset_list); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool int_set_list; + [DataMember] public bool map_int_strset; + [DataMember] public bool map_int_strset_list; + } + + #region XmlSerializer support + + public bool ShouldSerializeInt_set_list() + { + return __isset.int_set_list; + } + + public bool ShouldSerializeMap_int_strset() + { + return __isset.map_int_strset; + } + + public bool ShouldSerializeMap_int_strset_list() + { + return __isset.map_int_strset_list; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs new file mode 100644 index 00000000000..38a514568d9 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace ThriftAsync.Test +{ + /// + /// Docstring! + /// + public enum Numberz + { + ONE = 1, + TWO = 2, + THREE = 3, + FIVE = 5, + SIX = 6, + EIGHT = 8, + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs new file mode 100644 index 00000000000..9f776c1155d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs @@ -0,0 +1,164 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class OneField : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private EmptyStruct _field; + + public OneField() + { + } + + [DataMember(Order = 0)] + public EmptyStruct Field + { + get { return _field; } + set + { + __isset.field = true; + this._field = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Field = new EmptyStruct(); + await Field.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("OneField"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Field != null && __isset.field) + { + field.Name = "field"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Field.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeField() + { + return __isset.field; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("OneField("); + bool __first = true; + if (Field != null && __isset.field) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Field: "); + sb.Append(Field == null ? "" : Field.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool field; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs new file mode 100644 index 00000000000..95c1030ee44 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs @@ -0,0 +1,638 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + public partial class SecondService + { + [ServiceContract(Namespace = "")] + public interface IAsync + { + [OperationContract] + Task blahBlahAsync(CancellationToken cancellationToken); + + /// + /// Prints 'testString("%s")' with thing as '%s' + /// @param string thing - the string to print + /// @return string - returns the string 'thing' + /// + /// + [OperationContract] + Task secondtestStringAsync(string thing, CancellationToken cancellationToken); + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task blahBlahAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Call, SeqId), + cancellationToken); + + var args = new blahBlahArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new blahBlahResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task secondtestStringAsync(string thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Call, SeqId), + cancellationToken); + + var args = new secondtestStringArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new secondtestStringResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "secondtestString failed: unknown result"); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + protected Dictionary processMap_ = new Dictionary(); + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["blahBlah"] = blahBlah_ProcessAsync; + processMap_["secondtestString"] = secondtestString_ProcessAsync; + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task blahBlah_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new blahBlahArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new blahBlahResult(); + try + { + await _iAsync.blahBlahAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task secondtestString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new secondtestStringArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new secondtestStringResult(); + try + { + result.Success = await _iAsync.secondtestStringAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + protected delegate Task ProcessFunction( + int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } + + + [DataContract(Namespace = "")] + public partial class blahBlahArgs : TBase + { + public blahBlahArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("blahBlah_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("blahBlah_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class blahBlahResult : TBase + { + public blahBlahResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("blahBlah_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("blahBlah_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class secondtestStringArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _thing; + + public secondtestStringArgs() + { + } + + [DataMember(Order = 0)] + public string Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("secondtestString_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("secondtestString_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class secondtestStringResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public secondtestStringResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("secondtestString_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("secondtestString_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs new file mode 100644 index 00000000000..49f8161c513 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class StructA : TBase + { + public StructA() + { + } + + public StructA(string s) : this() + { + this.S = s; + } + + [DataMember(Order = 0)] + public string S { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_s = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + S = await iprot.ReadStringAsync(cancellationToken); + isset_s = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_s) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("StructA"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "s"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(S, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("StructA("); + sb.Append(", S: "); + sb.Append(S); + sb.Append(")"); + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs new file mode 100644 index 00000000000..5d777e991ef --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs @@ -0,0 +1,201 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class StructB : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private StructA _aa; + + public StructB() + { + } + + public StructB(StructA ab) : this() + { + this.Ab = ab; + } + + [DataMember(Order = 0)] + public StructA Aa + { + get { return _aa; } + set + { + __isset.aa = true; + this._aa = value; + } + } + + [DataMember(Order = 0)] + public StructA Ab { get; set; } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_ab = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Aa = new StructA(); + await Aa.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ab = new StructA(); + await Ab.ReadAsync(iprot, cancellationToken); + isset_ab = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_ab) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("StructB"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Aa != null && __isset.aa) + { + field.Name = "aa"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Aa.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "ab"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ab.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeAa() + { + return __isset.aa; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("StructB("); + bool __first = true; + if (Aa != null && __isset.aa) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Aa: "); + sb.Append(Aa == null ? "" : Aa.ToString()); + } + if (!__first) + { + sb.Append(", "); + } + sb.Append("Ab: "); + sb.Append(Ab == null ? "" : Ab.ToString()); + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool aa; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs new file mode 100644 index 00000000000..163ca55b4c3 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs @@ -0,0 +1,7866 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + public partial class ThriftTest + { + [ServiceContract(Namespace = "")] + public interface IAsync + { + /// + /// Prints "testVoid()" and returns nothing. + /// + [OperationContract] + Task testVoidAsync(CancellationToken cancellationToken); + + /// + /// Prints 'testString("%s")' with thing as '%s' + /// @param string thing - the string to print + /// @return string - returns the string 'thing' + /// + /// + [OperationContract] + Task testStringAsync(string thing, CancellationToken cancellationToken); + + /// + /// Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' + /// @param bool thing - the bool data to print + /// @return bool - returns the bool 'thing' + /// + /// + [OperationContract] + Task testBoolAsync(bool thing, CancellationToken cancellationToken); + + /// + /// Prints 'testByte("%d")' with thing as '%d' + /// The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. + /// @param byte thing - the i8/byte to print + /// @return i8 - returns the i8/byte 'thing' + /// + /// + [OperationContract] + Task testByteAsync(sbyte thing, CancellationToken cancellationToken); + + /// + /// Prints 'testI32("%d")' with thing as '%d' + /// @param i32 thing - the i32 to print + /// @return i32 - returns the i32 'thing' + /// + /// + [OperationContract] + Task testI32Async(int thing, CancellationToken cancellationToken); + + /// + /// Prints 'testI64("%d")' with thing as '%d' + /// @param i64 thing - the i64 to print + /// @return i64 - returns the i64 'thing' + /// + /// + [OperationContract] + Task testI64Async(long thing, CancellationToken cancellationToken); + + /// + /// Prints 'testDouble("%f")' with thing as '%f' + /// @param double thing - the double to print + /// @return double - returns the double 'thing' + /// + /// + [OperationContract] + Task testDoubleAsync(double thing, CancellationToken cancellationToken); + + /// + /// Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data + /// @param binary thing - the binary data to print + /// @return binary - returns the binary 'thing' + /// + /// + [OperationContract] + Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken); + + /// + /// Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values + /// @param Xtruct thing - the Xtruct to print + /// @return Xtruct - returns the Xtruct 'thing' + /// + /// + [OperationContract] + Task testStructAsync(Xtruct thing, CancellationToken cancellationToken); + + /// + /// Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct + /// @param Xtruct2 thing - the Xtruct2 to print + /// @return Xtruct2 - returns the Xtruct2 'thing' + /// + /// + [OperationContract] + Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken); + + /// + /// Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs + /// separated by commas and new lines + /// @param map + /// + /// thing - the map + /// + /// to print + /// @return map - returns the map 'thing' + /// + /// + [OperationContract] + Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken); + + /// + /// Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs + /// separated by commas and new lines + /// @param map + /// + /// thing - the map + /// + /// to print + /// @return map - returns the map 'thing' + /// + /// + [OperationContract] + Task> testStringMapAsync(Dictionary thing, + CancellationToken cancellationToken); + + /// + /// Prints 'testSet("{%s}")' where thing has been formatted into a string of values + /// separated by commas and new lines + /// @param set + /// + /// thing - the set + /// + /// to print + /// @return set - returns the set 'thing' + /// + /// + [OperationContract] + Task> testSetAsync(THashSet thing, CancellationToken cancellationToken); + + /// + /// Prints 'testList("{%s}")' where thing has been formatted into a string of values + /// separated by commas and new lines + /// @param list + /// + /// thing - the list + /// + /// to print + /// @return list - returns the list 'thing' + /// + /// + [OperationContract] + Task> testListAsync(List thing, CancellationToken cancellationToken); + + /// + /// Prints 'testEnum("%d")' where thing has been formatted into it's numeric value + /// @param Numberz thing - the Numberz to print + /// @return Numberz - returns the Numberz 'thing' + /// + /// + [OperationContract] + Task testEnumAsync(Numberz thing, CancellationToken cancellationToken); + + /// + /// Prints 'testTypedef("%d")' with thing as '%d' + /// @param UserId thing - the UserId to print + /// @return UserId - returns the UserId 'thing' + /// + /// + [OperationContract] + Task testTypedefAsync(long thing, CancellationToken cancellationToken); + + /// + /// Prints 'testMapMap("%d")' with hello as '%d' + /// @param i32 hello - the i32 to print + /// @return map + /// > - returns a dictionary with these values: + /// {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } + /// + /// + [OperationContract] + Task>> testMapMapAsync(int hello, CancellationToken cancellationToken); + + /// + /// So you think you've got this all worked, out eh? + /// Creates a the returned map with these values and prints it out: + /// { 1 => { 2 => argument, + /// 3 => argument, + /// }, + /// 2 => { 6 => + /// + /// , }, + /// } + /// @return map> - a map with the above values + /// + /// + [OperationContract] + Task>> testInsanityAsync(Insanity argument, + CancellationToken cancellationToken); + + /// + /// Prints 'testMulti()' + /// @param byte arg0 - + /// @param i32 arg1 - + /// @param i64 arg2 - + /// @param map + /// + /// arg3 - + /// @param Numberz arg4 - + /// @param UserId arg5 - + /// @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 + /// and i64_thing = arg2 + /// + /// + /// + /// + /// + /// + /// + [OperationContract] + Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, + long arg5, CancellationToken cancellationToken); + + /// + /// Print 'testException(%s)' with arg as '%s' + /// @param string arg - a string indication what type of exception to throw + /// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg + /// elsen if arg == "TException" throw TException + /// else do not throw anything + /// + /// + [OperationContract] + [FaultContract(typeof(XceptionFault))] + Task testExceptionAsync(string arg, CancellationToken cancellationToken); + + /// + /// Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' + /// @param string arg - a string indication what type of exception to throw + /// if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" + /// elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an + /// Xception2" + /// else do not throw anything + /// @return Xtruct - an Xtruct with string_thing = arg1 + /// + /// + /// + [OperationContract] + [FaultContract(typeof(XceptionFault))] + [FaultContract(typeof(Xception2Fault))] + Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken); + + /// + /// Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' + /// sleep 'secondsToSleep' + /// Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' + /// @param i32 secondsToSleep - the number of seconds to sleep + /// + /// + [OperationContract] + Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken); + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task testVoidAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testVoidArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testVoidResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task testStringAsync(string thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testStringArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStringResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testString failed: unknown result"); + } + + public async Task testBoolAsync(bool thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testBoolArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testBoolResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testBool failed: unknown result"); + } + + public async Task testByteAsync(sbyte thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testByteArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testByteResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testByte failed: unknown result"); + } + + public async Task testI32Async(int thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testI32Args(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testI32Result(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testI32 failed: unknown result"); + } + + public async Task testI64Async(long thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testI64Args(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testI64Result(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testI64 failed: unknown result"); + } + + public async Task testDoubleAsync(double thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testDoubleArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testDoubleResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testDouble failed: unknown result"); + } + + public async Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testBinaryArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testBinaryResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testBinary failed: unknown result"); + } + + public async Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testStructArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStructResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testStruct failed: unknown result"); + } + + public async Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testNestArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testNestResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testNest failed: unknown result"); + } + + public async Task> testMapAsync(Dictionary thing, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testMapArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testMap failed: unknown result"); + } + + public async Task> testStringMapAsync(Dictionary thing, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testStringMapArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStringMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testStringMap failed: unknown result"); + } + + public async Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testSetArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testSetResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testSet failed: unknown result"); + } + + public async Task> testListAsync(List thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testListArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testListResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testList failed: unknown result"); + } + + public async Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testEnumArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testEnumResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testEnum failed: unknown result"); + } + + public async Task testTypedefAsync(long thing, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testTypedefArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testTypedefResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testTypedef failed: unknown result"); + } + + public async Task>> testMapMapAsync(int hello, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testMapMapArgs(); + args.Hello = hello; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMapMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testMapMap failed: unknown result"); + } + + public async Task>> testInsanityAsync(Insanity argument, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testInsanityArgs(); + args.Argument = argument; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testInsanityResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testInsanity failed: unknown result"); + } + + public async Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, + Numberz arg4, long arg5, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testMultiArgs(); + args.Arg0 = arg0; + args.Arg1 = arg1; + args.Arg2 = arg2; + args.Arg3 = arg3; + args.Arg4 = arg4; + args.Arg5 = arg5; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMultiResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testMulti failed: unknown result"); + } + + public async Task testExceptionAsync(string arg, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testExceptionArgs(); + args.Arg = arg; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testExceptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.err1) + { + throw result.Err1; + } + return; + } + + public async Task testMultiExceptionAsync(string arg0, string arg1, + CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Call, SeqId), + cancellationToken); + + var args = new testMultiExceptionArgs(); + args.Arg0 = arg0; + args.Arg1 = arg1; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMultiExceptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.err1) + { + throw result.Err1; + } + if (result.__isset.err2) + { + throw result.Err2; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "testMultiException failed: unknown result"); + } + + public async Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("testOneway", TMessageType.Oneway, SeqId), + cancellationToken); + + var args = new testOnewayArgs(); + args.SecondsToSleep = secondsToSleep; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + protected Dictionary processMap_ = new Dictionary(); + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["testVoid"] = testVoid_ProcessAsync; + processMap_["testString"] = testString_ProcessAsync; + processMap_["testBool"] = testBool_ProcessAsync; + processMap_["testByte"] = testByte_ProcessAsync; + processMap_["testI32"] = testI32_ProcessAsync; + processMap_["testI64"] = testI64_ProcessAsync; + processMap_["testDouble"] = testDouble_ProcessAsync; + processMap_["testBinary"] = testBinary_ProcessAsync; + processMap_["testStruct"] = testStruct_ProcessAsync; + processMap_["testNest"] = testNest_ProcessAsync; + processMap_["testMap"] = testMap_ProcessAsync; + processMap_["testStringMap"] = testStringMap_ProcessAsync; + processMap_["testSet"] = testSet_ProcessAsync; + processMap_["testList"] = testList_ProcessAsync; + processMap_["testEnum"] = testEnum_ProcessAsync; + processMap_["testTypedef"] = testTypedef_ProcessAsync; + processMap_["testMapMap"] = testMapMap_ProcessAsync; + processMap_["testInsanity"] = testInsanity_ProcessAsync; + processMap_["testMulti"] = testMulti_ProcessAsync; + processMap_["testException"] = testException_ProcessAsync; + processMap_["testMultiException"] = testMultiException_ProcessAsync; + processMap_["testOneway"] = testOneway_ProcessAsync; + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task testVoid_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testVoidArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testVoidResult(); + try + { + await _iAsync.testVoidAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testStringArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStringResult(); + try + { + result.Success = await _iAsync.testStringAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testBool_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testBoolArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testBoolResult(); + try + { + result.Success = await _iAsync.testBoolAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testByte_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testByteArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testByteResult(); + try + { + result.Success = await _iAsync.testByteAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testI32_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testI32Args(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testI32Result(); + try + { + result.Success = await _iAsync.testI32Async(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testI64_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testI64Args(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testI64Result(); + try + { + result.Success = await _iAsync.testI64Async(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testDouble_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testDoubleArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testDoubleResult(); + try + { + result.Success = await _iAsync.testDoubleAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testBinary_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testBinaryArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testBinaryResult(); + try + { + result.Success = await _iAsync.testBinaryAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testStructArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStructResult(); + try + { + result.Success = await _iAsync.testStructAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testNest_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testNestArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testNestResult(); + try + { + result.Success = await _iAsync.testNestAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMapResult(); + try + { + result.Success = await _iAsync.testMapAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testStringMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testStringMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStringMapResult(); + try + { + result.Success = await _iAsync.testStringMapAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testSet_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testSetArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testSetResult(); + try + { + result.Success = await _iAsync.testSetAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testList_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testListArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testListResult(); + try + { + result.Success = await _iAsync.testListAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testEnum_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testEnumArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testEnumResult(); + try + { + result.Success = await _iAsync.testEnumAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testTypedef_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testTypedefArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testTypedefResult(); + try + { + result.Success = await _iAsync.testTypedefAsync(args.Thing, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMapMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testMapMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMapMapResult(); + try + { + result.Success = await _iAsync.testMapMapAsync(args.Hello, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testInsanity_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testInsanityArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testInsanityResult(); + try + { + result.Success = await _iAsync.testInsanityAsync(args.Argument, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMulti_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testMultiArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMultiResult(); + try + { + result.Success = + await + _iAsync.testMultiAsync(args.Arg0, args.Arg1, args.Arg2, args.Arg3, args.Arg4, args.Arg5, + cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testExceptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testExceptionResult(); + try + { + try + { + await _iAsync.testExceptionAsync(args.Arg, cancellationToken); + } + catch (Xception err1) + { + result.Err1 = err1; + } + await + oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMultiException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testMultiExceptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMultiExceptionResult(); + try + { + try + { + result.Success = await _iAsync.testMultiExceptionAsync(args.Arg0, args.Arg1, cancellationToken); + } + catch (Xception err1) + { + result.Err1 = err1; + } + catch (Xception2 err2) + { + result.Err2 = err2; + } + await + oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testOneway_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new testOnewayArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + try + { + await _iAsync.testOnewayAsync(args.SecondsToSleep, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + } + } + + protected delegate Task ProcessFunction( + int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } + + + [DataContract(Namespace = "")] + public partial class testVoidArgs : TBase + { + public testVoidArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testVoid_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testVoid_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class testVoidResult : TBase + { + public testVoidResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testVoid_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testVoid_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class testStringArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _thing; + + public testStringArgs() + { + } + + [DataMember(Order = 0)] + public string Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testString_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testString_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testStringResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _success; + + public testStringResult() + { + } + + [DataMember(Order = 0)] + public string Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testString_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testString_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testBoolArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private bool _thing; + + public testBoolArgs() + { + } + + [DataMember(Order = 0)] + public bool Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + Thing = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBool_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testBool_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testBoolResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private bool _success; + + public testBoolResult() + { + } + + [DataMember(Order = 0)] + public bool Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Bool) + { + Success = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBool_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Bool; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testBool_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testByteArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private sbyte _thing; + + public testByteArgs() + { + } + + [DataMember(Order = 0)] + public sbyte Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testByte_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testByte_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testByteResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private sbyte _success; + + public testByteResult() + { + } + + [DataMember(Order = 0)] + public sbyte Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Byte) + { + Success = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testByte_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Byte; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testByte_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testI32Args : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _thing; + + public testI32Args() + { + } + + [DataMember(Order = 0)] + public int Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI32_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testI32_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testI32Result : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _success; + + public testI32Result() + { + } + + [DataMember(Order = 0)] + public int Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI32_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testI32_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testI64Args : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _thing; + + public testI64Args() + { + } + + [DataMember(Order = 0)] + public long Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I64) + { + Thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI64_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I64; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testI64_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testI64Result : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _success; + + public testI64Result() + { + } + + [DataMember(Order = 0)] + public long Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI64_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testI64_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testDoubleArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private double _thing; + + public testDoubleArgs() + { + } + + [DataMember(Order = 0)] + public double Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Double) + { + Thing = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testDouble_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Double; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testDouble_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testDoubleResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private double _success; + + public testDoubleResult() + { + } + + [DataMember(Order = 0)] + public double Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Double) + { + Success = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testDouble_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Double; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testDouble_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testBinaryArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _thing; + + public testBinaryArgs() + { + } + + [DataMember(Order = 0)] + public byte[] Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBinary_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testBinary_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testBinaryResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private byte[] _success; + + public testBinaryResult() + { + } + + [DataMember(Order = 0)] + public byte[] Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBinary_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testBinary_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testStructArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xtruct _thing; + + public testStructArgs() + { + } + + [DataMember(Order = 0)] + public Xtruct Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Thing = new Xtruct(); + await Thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStruct_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testStruct_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing == null ? "" : Thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testStructResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xtruct _success; + + public testStructResult() + { + } + + [DataMember(Order = 0)] + public Xtruct Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStruct_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testStruct_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testNestArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xtruct2 _thing; + + public testNestArgs() + { + } + + [DataMember(Order = 0)] + public Xtruct2 Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Thing = new Xtruct2(); + await Thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testNest_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testNest_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing == null ? "" : Thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testNestResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xtruct2 _success; + + public testNestResult() + { + } + + [DataMember(Order = 0)] + public Xtruct2 Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct2(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testNest_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testNest_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testMapArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _thing; + + public testMapArgs() + { + } + + [DataMember(Order = 0)] + public Dictionary Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Thing = new Dictionary(); + TMap _map144 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i145 = 0; _i145 < _map144.Count; ++_i145) + { + int _key146; + int _val147; + _key146 = await iprot.ReadI32Async(cancellationToken); + _val147 = await iprot.ReadI32Async(cancellationToken); + Thing[_key146] = _val147; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Thing.Count), cancellationToken); + foreach (int _iter148 in Thing.Keys) + { + await oprot.WriteI32Async(_iter148, cancellationToken); + await oprot.WriteI32Async(Thing[_iter148], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testMap_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testMapResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _success; + + public testMapResult() + { + } + + [DataMember(Order = 0)] + public Dictionary Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map149 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i150 = 0; _i150 < _map149.Count; ++_i150) + { + int _key151; + int _val152; + _key151 = await iprot.ReadI32Async(cancellationToken); + _val152 = await iprot.ReadI32Async(cancellationToken); + Success[_key151] = _val152; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success.Count), + cancellationToken); + foreach (int _iter153 in Success.Keys) + { + await oprot.WriteI32Async(_iter153, cancellationToken); + await oprot.WriteI32Async(Success[_iter153], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testStringMapArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _thing; + + public testStringMapArgs() + { + } + + [DataMember(Order = 0)] + public Dictionary Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Thing = new Dictionary(); + TMap _map154 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i155 = 0; _i155 < _map154.Count; ++_i155) + { + string _key156; + string _val157; + _key156 = await iprot.ReadStringAsync(cancellationToken); + _val157 = await iprot.ReadStringAsync(cancellationToken); + Thing[_key156] = _val157; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStringMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Thing.Count), + cancellationToken); + foreach (string _iter158 in Thing.Keys) + { + await oprot.WriteStringAsync(_iter158, cancellationToken); + await oprot.WriteStringAsync(Thing[_iter158], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testStringMap_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testStringMapResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary _success; + + public testStringMapResult() + { + } + + [DataMember(Order = 0)] + public Dictionary Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map159 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i160 = 0; _i160 < _map159.Count; ++_i160) + { + string _key161; + string _val162; + _key161 = await iprot.ReadStringAsync(cancellationToken); + _val162 = await iprot.ReadStringAsync(cancellationToken); + Success[_key161] = _val162; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStringMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), + cancellationToken); + foreach (string _iter163 in Success.Keys) + { + await oprot.WriteStringAsync(_iter163, cancellationToken); + await oprot.WriteStringAsync(Success[_iter163], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testStringMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testSetArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private THashSet _thing; + + public testSetArgs() + { + } + + [DataMember(Order = 0)] + public THashSet Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Set) + { + { + Thing = new THashSet(); + TSet _set164 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i165 = 0; _i165 < _set164.Count; ++_i165) + { + int _elem166; + _elem166 = await iprot.ReadI32Async(cancellationToken); + Thing.Add(_elem166); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testSet_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Set; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Thing.Count), cancellationToken); + foreach (int _iter167 in Thing) + { + await oprot.WriteI32Async(_iter167, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testSet_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testSetResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private THashSet _success; + + public testSetResult() + { + } + + [DataMember(Order = 0)] + public THashSet Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Set) + { + { + Success = new THashSet(); + TSet _set168 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i169 = 0; _i169 < _set168.Count; ++_i169) + { + int _elem170; + _elem170 = await iprot.ReadI32Async(cancellationToken); + Success.Add(_elem170); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testSet_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Set; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Success.Count), cancellationToken); + foreach (int _iter171 in Success) + { + await oprot.WriteI32Async(_iter171, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testSet_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testListArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List _thing; + + public testListArgs() + { + } + + [DataMember(Order = 0)] + public List Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Thing = new List(); + TList _list172 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i173 = 0; _i173 < _list172.Count; ++_i173) + { + int _elem174; + _elem174 = await iprot.ReadI32Async(cancellationToken); + Thing.Add(_elem174); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testList_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Thing.Count), cancellationToken); + foreach (int _iter175 in Thing) + { + await oprot.WriteI32Async(_iter175, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testList_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testListResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private List _success; + + public testListResult() + { + } + + [DataMember(Order = 0)] + public List Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list176 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i177 = 0; _i177 < _list176.Count; ++_i177) + { + int _elem178; + _elem178 = await iprot.ReadI32Async(cancellationToken); + Success.Add(_elem178); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testList_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Success.Count), cancellationToken); + foreach (int _iter179 in Success) + { + await oprot.WriteI32Async(_iter179, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testList_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testEnumArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Numberz _thing; + + public testEnumArgs() + { + } + + /// + /// + /// + [DataMember(Order = 0)] + public Numberz Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Thing = (Numberz) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testEnum_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testEnum_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testEnumResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Numberz _success; + + public testEnumResult() + { + } + + /// + /// + /// + [DataMember(Order = 0)] + public Numberz Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = (Numberz) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testEnum_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testEnum_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testTypedefArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _thing; + + public testTypedefArgs() + { + } + + [DataMember(Order = 0)] + public long Thing + { + get { return _thing; } + set + { + __isset.thing = true; + this._thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I64) + { + Thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testTypedef_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I64; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeThing() + { + return __isset.thing; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testTypedef_args("); + bool __first = true; + if (__isset.thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool thing; + } + } + + + [DataContract(Namespace = "")] + public partial class testTypedefResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private long _success; + + public testTypedefResult() + { + } + + [DataMember(Order = 0)] + public long Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testTypedef_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testTypedef_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testMapMapArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _hello; + + public testMapMapArgs() + { + } + + [DataMember(Order = 0)] + public int Hello + { + get { return _hello; } + set + { + __isset.hello = true; + this._hello = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Hello = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMapMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.hello) + { + field.Name = "hello"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeHello() + { + return __isset.hello; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testMapMap_args("); + bool __first = true; + if (__isset.hello) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool hello; + } + } + + + [DataContract(Namespace = "")] + public partial class testMapMapResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary> _success; + + public testMapMapResult() + { + } + + [DataMember(Order = 0)] + public Dictionary> Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map180 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i181 = 0; _i181 < _map180.Count; ++_i181) + { + int _key182; + Dictionary _val183; + _key182 = await iprot.ReadI32Async(cancellationToken); + { + _val183 = new Dictionary(); + TMap _map184 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i185 = 0; _i185 < _map184.Count; ++_i185) + { + int _key186; + int _val187; + _key186 = await iprot.ReadI32Async(cancellationToken); + _val187 = await iprot.ReadI32Async(cancellationToken); + _val183[_key186] = _val187; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Success[_key182] = _val183; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMapMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Map, Success.Count), + cancellationToken); + foreach (int _iter188 in Success.Keys) + { + await oprot.WriteI32Async(_iter188, cancellationToken); + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.I32, TType.I32, Success[_iter188].Count), + cancellationToken); + foreach (int _iter189 in Success[_iter188].Keys) + { + await oprot.WriteI32Async(_iter189, cancellationToken); + await oprot.WriteI32Async(Success[_iter188][_iter189], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testMapMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testInsanityArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Insanity _argument; + + public testInsanityArgs() + { + } + + [DataMember(Order = 0)] + public Insanity Argument + { + get { return _argument; } + set + { + __isset.argument = true; + this._argument = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Argument = new Insanity(); + await Argument.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testInsanity_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Argument != null && __isset.argument) + { + field.Name = "argument"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Argument.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeArgument() + { + return __isset.argument; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testInsanity_args("); + bool __first = true; + if (Argument != null && __isset.argument) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Argument: "); + sb.Append(Argument == null ? "" : Argument.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool argument; + } + } + + + [DataContract(Namespace = "")] + public partial class testInsanityResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Dictionary> _success; + + public testInsanityResult() + { + } + + [DataMember(Order = 0)] + public Dictionary> Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map190 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i191 = 0; _i191 < _map190.Count; ++_i191) + { + long _key192; + Dictionary _val193; + _key192 = await iprot.ReadI64Async(cancellationToken); + { + _val193 = new Dictionary(); + TMap _map194 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i195 = 0; _i195 < _map194.Count; ++_i195) + { + Numberz _key196; + Insanity _val197; + _key196 = (Numberz) await iprot.ReadI32Async(cancellationToken); + _val197 = new Insanity(); + await _val197.ReadAsync(iprot, cancellationToken); + _val193[_key196] = _val197; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Success[_key192] = _val193; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testInsanity_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I64, TType.Map, Success.Count), + cancellationToken); + foreach (long _iter198 in Success.Keys) + { + await oprot.WriteI64Async(_iter198, cancellationToken); + { + await + oprot.WriteMapBeginAsync( + new TMap(TType.I32, TType.Struct, Success[_iter198].Count), + cancellationToken); + foreach (Numberz _iter199 in Success[_iter198].Keys) + { + await oprot.WriteI32Async((int) _iter199, cancellationToken); + await Success[_iter198][_iter199].WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testInsanity_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testMultiArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private sbyte _arg0; + private int _arg1; + private long _arg2; + private Dictionary _arg3; + private Numberz _arg4; + private long _arg5; + + public testMultiArgs() + { + } + + [DataMember(Order = 0)] + public sbyte Arg0 + { + get { return _arg0; } + set + { + __isset.arg0 = true; + this._arg0 = value; + } + } + + [DataMember(Order = 0)] + public int Arg1 + { + get { return _arg1; } + set + { + __isset.arg1 = true; + this._arg1 = value; + } + } + + [DataMember(Order = 0)] + public long Arg2 + { + get { return _arg2; } + set + { + __isset.arg2 = true; + this._arg2 = value; + } + } + + [DataMember(Order = 0)] + public Dictionary Arg3 + { + get { return _arg3; } + set + { + __isset.arg3 = true; + this._arg3 = value; + } + } + + /// + /// + /// + [DataMember(Order = 0)] + public Numberz Arg4 + { + get { return _arg4; } + set + { + __isset.arg4 = true; + this._arg4 = value; + } + } + + [DataMember(Order = 0)] + public long Arg5 + { + get { return _arg5; } + set + { + __isset.arg5 = true; + this._arg5 = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Arg0 = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Arg1 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I64) + { + Arg2 = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Map) + { + { + Arg3 = new Dictionary(); + TMap _map200 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i201 = 0; _i201 < _map200.Count; ++_i201) + { + short _key202; + string _val203; + _key202 = await iprot.ReadI16Async(cancellationToken); + _val203 = await iprot.ReadStringAsync(cancellationToken); + Arg3[_key202] = _val203; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.I32) + { + Arg4 = (Numberz) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.I64) + { + Arg5 = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMulti_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.arg0) + { + field.Name = "arg0"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Arg0, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg1) + { + field.Name = "arg1"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Arg1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg2) + { + field.Name = "arg2"; + field.Type = TType.I64; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Arg2, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Arg3 != null && __isset.arg3) + { + field.Name = "arg3"; + field.Type = TType.Map; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await + oprot.WriteMapBeginAsync(new TMap(TType.I16, TType.String, Arg3.Count), + cancellationToken); + foreach (short _iter204 in Arg3.Keys) + { + await oprot.WriteI16Async(_iter204, cancellationToken); + await oprot.WriteStringAsync(Arg3[_iter204], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg4) + { + field.Name = "arg4"; + field.Type = TType.I32; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Arg4, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg5) + { + field.Name = "arg5"; + field.Type = TType.I64; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Arg5, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMulti_args("); + bool __first = true; + if (__isset.arg0) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg0: "); + sb.Append(Arg0); + } + if (__isset.arg1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg1: "); + sb.Append(Arg1); + } + if (__isset.arg2) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg2: "); + sb.Append(Arg2); + } + if (Arg3 != null && __isset.arg3) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg3: "); + sb.Append(Arg3); + } + if (__isset.arg4) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg4: "); + sb.Append(Arg4); + } + if (__isset.arg5) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg5: "); + sb.Append(Arg5); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool arg0; + [DataMember] public bool arg1; + [DataMember] public bool arg2; + [DataMember] public bool arg3; + [DataMember] public bool arg4; + [DataMember] public bool arg5; + } + + #region XmlSerializer support + + public bool ShouldSerializeArg0() + { + return __isset.arg0; + } + + public bool ShouldSerializeArg1() + { + return __isset.arg1; + } + + public bool ShouldSerializeArg2() + { + return __isset.arg2; + } + + public bool ShouldSerializeArg3() + { + return __isset.arg3; + } + + public bool ShouldSerializeArg4() + { + return __isset.arg4; + } + + public bool ShouldSerializeArg5() + { + return __isset.arg5; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class testMultiResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xtruct _success; + + public testMultiResult() + { + } + + [DataMember(Order = 0)] + public Xtruct Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMulti_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testMulti_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class testExceptionArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _arg; + + public testExceptionArgs() + { + } + + [DataMember(Order = 0)] + public string Arg + { + get { return _arg; } + set + { + __isset.arg = true; + this._arg = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Arg = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testException_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Arg != null && __isset.arg) + { + field.Name = "arg"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeArg() + { + return __isset.arg; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testException_args("); + bool __first = true; + if (Arg != null && __isset.arg) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg: "); + sb.Append(Arg); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool arg; + } + } + + + [DataContract(Namespace = "")] + public partial class testExceptionResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xception _err1; + + public testExceptionResult() + { + } + + [DataMember(Order = 0)] + public Xception Err1 + { + get { return _err1; } + set + { + __isset.err1 = true; + this._err1 = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Err1 = new Xception(); + await Err1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testException_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.err1) + { + if (Err1 != null) + { + field.Name = "Err1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeErr1() + { + return __isset.err1; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testException_result("); + bool __first = true; + if (Err1 != null && __isset.err1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Err1: "); + sb.Append(Err1 == null ? "" : Err1.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool err1; + } + } + + + [DataContract(Namespace = "")] + public partial class testMultiExceptionArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _arg0; + private string _arg1; + + public testMultiExceptionArgs() + { + } + + [DataMember(Order = 0)] + public string Arg0 + { + get { return _arg0; } + set + { + __isset.arg0 = true; + this._arg0 = value; + } + } + + [DataMember(Order = 0)] + public string Arg1 + { + get { return _arg1; } + set + { + __isset.arg1 = true; + this._arg1 = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Arg0 = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Arg1 = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMultiException_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Arg0 != null && __isset.arg0) + { + field.Name = "arg0"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg0, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Arg1 != null && __isset.arg1) + { + field.Name = "arg1"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMultiException_args("); + bool __first = true; + if (Arg0 != null && __isset.arg0) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg0: "); + sb.Append(Arg0); + } + if (Arg1 != null && __isset.arg1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Arg1: "); + sb.Append(Arg1); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool arg0; + [DataMember] public bool arg1; + } + + #region XmlSerializer support + + public bool ShouldSerializeArg0() + { + return __isset.arg0; + } + + public bool ShouldSerializeArg1() + { + return __isset.arg1; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class testMultiExceptionResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private Xception _err1; + private Xception2 _err2; + private Xtruct _success; + + public testMultiExceptionResult() + { + } + + [DataMember(Order = 0)] + public Xtruct Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public Xception Err1 + { + get { return _err1; } + set + { + __isset.err1 = true; + this._err1 = value; + } + } + + [DataMember(Order = 0)] + public Xception2 Err2 + { + get { return _err2; } + set + { + __isset.err2 = true; + this._err2 = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Err1 = new Xception(); + await Err1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Err2 = new Xception2(); + await Err2.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMultiException_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.err1) + { + if (Err1 != null) + { + field.Name = "Err1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if (this.__isset.err2) + { + if (Err2 != null) + { + field.Name = "Err2"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err2.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMultiException_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + if (Err1 != null && __isset.err1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Err1: "); + sb.Append(Err1 == null ? "" : Err1.ToString()); + } + if (Err2 != null && __isset.err2) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Err2: "); + sb.Append(Err2 == null ? "" : Err2.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool err1; + [DataMember] public bool err2; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeErr1() + { + return __isset.err1; + } + + public bool ShouldSerializeErr2() + { + return __isset.err2; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class testOnewayArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _secondsToSleep; + + public testOnewayArgs() + { + } + + [DataMember(Order = 0)] + public int SecondsToSleep + { + get { return _secondsToSleep; } + set + { + __isset.secondsToSleep = true; + this._secondsToSleep = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + SecondsToSleep = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testOneway_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.secondsToSleep) + { + field.Name = "secondsToSleep"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(SecondsToSleep, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSecondsToSleep() + { + return __isset.secondsToSleep; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("testOneway_args("); + bool __first = true; + if (__isset.secondsToSleep) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("SecondsToSleep: "); + sb.Append(SecondsToSleep); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool secondsToSleep; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs new file mode 100644 index 00000000000..740969bc3a1 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; + + +namespace ThriftAsync.Test +{ + public static class ThriftTestAsyncConstants + { + public static Numberz myNumberz = Numberz.ONE; + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs new file mode 100644 index 00000000000..f1d829e064d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs @@ -0,0 +1,257 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class VersioningTestV1 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _begin_in_both; + private int _end_in_both; + private string _old_string; + + public VersioningTestV1() + { + } + + [DataMember(Order = 0)] + public int Begin_in_both + { + get { return _begin_in_both; } + set + { + __isset.begin_in_both = true; + this._begin_in_both = value; + } + } + + [DataMember(Order = 0)] + public string Old_string + { + get { return _old_string; } + set + { + __isset.old_string = true; + this._old_string = value; + } + } + + [DataMember(Order = 0)] + public int End_in_both + { + get { return _end_in_both; } + set + { + __isset.end_in_both = true; + this._end_in_both = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Begin_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Old_string = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 12: + if (field.Type == TType.I32) + { + End_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("VersioningTestV1"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.begin_in_both) + { + field.Name = "begin_in_both"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Begin_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Old_string != null && __isset.old_string) + { + field.Name = "old_string"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Old_string, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.end_in_both) + { + field.Name = "end_in_both"; + field.Type = TType.I32; + field.ID = 12; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(End_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("VersioningTestV1("); + bool __first = true; + if (__isset.begin_in_both) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Begin_in_both: "); + sb.Append(Begin_in_both); + } + if (Old_string != null && __isset.old_string) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Old_string: "); + sb.Append(Old_string); + } + if (__isset.end_in_both) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("End_in_both: "); + sb.Append(End_in_both); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool begin_in_both; + [DataMember] public bool old_string; + [DataMember] public bool end_in_both; + } + + #region XmlSerializer support + + public bool ShouldSerializeBegin_in_both() + { + return __isset.begin_in_both; + } + + public bool ShouldSerializeOld_string() + { + return __isset.old_string; + } + + public bool ShouldSerializeEnd_in_both() + { + return __isset.end_in_both; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs new file mode 100644 index 00000000000..405f9b49ce9 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs @@ -0,0 +1,735 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class VersioningTestV2 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _begin_in_both; + private int _end_in_both; + private sbyte _newbyte; + private double _newdouble; + private int _newint; + private List _newlist; + private long _newlong; + private Dictionary _newmap; + private THashSet _newset; + private short _newshort; + private string _newstring; + private Bonk _newstruct; + + public VersioningTestV2() + { + } + + [DataMember(Order = 0)] + public int Begin_in_both + { + get { return _begin_in_both; } + set + { + __isset.begin_in_both = true; + this._begin_in_both = value; + } + } + + [DataMember(Order = 0)] + public int Newint + { + get { return _newint; } + set + { + __isset.newint = true; + this._newint = value; + } + } + + [DataMember(Order = 0)] + public sbyte Newbyte + { + get { return _newbyte; } + set + { + __isset.newbyte = true; + this._newbyte = value; + } + } + + [DataMember(Order = 0)] + public short Newshort + { + get { return _newshort; } + set + { + __isset.newshort = true; + this._newshort = value; + } + } + + [DataMember(Order = 0)] + public long Newlong + { + get { return _newlong; } + set + { + __isset.newlong = true; + this._newlong = value; + } + } + + [DataMember(Order = 0)] + public double Newdouble + { + get { return _newdouble; } + set + { + __isset.newdouble = true; + this._newdouble = value; + } + } + + [DataMember(Order = 0)] + public Bonk Newstruct + { + get { return _newstruct; } + set + { + __isset.newstruct = true; + this._newstruct = value; + } + } + + [DataMember(Order = 0)] + public List Newlist + { + get { return _newlist; } + set + { + __isset.newlist = true; + this._newlist = value; + } + } + + [DataMember(Order = 0)] + public THashSet Newset + { + get { return _newset; } + set + { + __isset.newset = true; + this._newset = value; + } + } + + [DataMember(Order = 0)] + public Dictionary Newmap + { + get { return _newmap; } + set + { + __isset.newmap = true; + this._newmap = value; + } + } + + [DataMember(Order = 0)] + public string Newstring + { + get { return _newstring; } + set + { + __isset.newstring = true; + this._newstring = value; + } + } + + [DataMember(Order = 0)] + public int End_in_both + { + get { return _end_in_both; } + set + { + __isset.end_in_both = true; + this._end_in_both = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Begin_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Newint = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Byte) + { + Newbyte = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I16) + { + Newshort = await iprot.ReadI16Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.I64) + { + Newlong = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.Double) + { + Newdouble = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 7: + if (field.Type == TType.Struct) + { + Newstruct = new Bonk(); + await Newstruct.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 8: + if (field.Type == TType.List) + { + { + Newlist = new List(); + TList _list44 = await iprot.ReadListBeginAsync(cancellationToken); + for (int _i45 = 0; _i45 < _list44.Count; ++_i45) + { + int _elem46; + _elem46 = await iprot.ReadI32Async(cancellationToken); + Newlist.Add(_elem46); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.Set) + { + { + Newset = new THashSet(); + TSet _set47 = await iprot.ReadSetBeginAsync(cancellationToken); + for (int _i48 = 0; _i48 < _set47.Count; ++_i48) + { + int _elem49; + _elem49 = await iprot.ReadI32Async(cancellationToken); + Newset.Add(_elem49); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 10: + if (field.Type == TType.Map) + { + { + Newmap = new Dictionary(); + TMap _map50 = await iprot.ReadMapBeginAsync(cancellationToken); + for (int _i51 = 0; _i51 < _map50.Count; ++_i51) + { + int _key52; + int _val53; + _key52 = await iprot.ReadI32Async(cancellationToken); + _val53 = await iprot.ReadI32Async(cancellationToken); + Newmap[_key52] = _val53; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.String) + { + Newstring = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 12: + if (field.Type == TType.I32) + { + End_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("VersioningTestV2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.begin_in_both) + { + field.Name = "begin_in_both"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Begin_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newint) + { + field.Name = "newint"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Newint, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newbyte) + { + field.Name = "newbyte"; + field.Type = TType.Byte; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Newbyte, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newshort) + { + field.Name = "newshort"; + field.Type = TType.I16; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI16Async(Newshort, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newlong) + { + field.Name = "newlong"; + field.Type = TType.I64; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Newlong, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newdouble) + { + field.Name = "newdouble"; + field.Type = TType.Double; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Newdouble, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newstruct != null && __isset.newstruct) + { + field.Name = "newstruct"; + field.Type = TType.Struct; + field.ID = 7; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Newstruct.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newlist != null && __isset.newlist) + { + field.Name = "newlist"; + field.Type = TType.List; + field.ID = 8; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Newlist.Count), cancellationToken); + foreach (int _iter54 in Newlist) + { + await oprot.WriteI32Async(_iter54, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newset != null && __isset.newset) + { + field.Name = "newset"; + field.Type = TType.Set; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Newset.Count), cancellationToken); + foreach (int _iter55 in Newset) + { + await oprot.WriteI32Async(_iter55, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newmap != null && __isset.newmap) + { + field.Name = "newmap"; + field.Type = TType.Map; + field.ID = 10; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Newmap.Count), cancellationToken); + foreach (int _iter56 in Newmap.Keys) + { + await oprot.WriteI32Async(_iter56, cancellationToken); + await oprot.WriteI32Async(Newmap[_iter56], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newstring != null && __isset.newstring) + { + field.Name = "newstring"; + field.Type = TType.String; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Newstring, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.end_in_both) + { + field.Name = "end_in_both"; + field.Type = TType.I32; + field.ID = 12; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(End_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("VersioningTestV2("); + bool __first = true; + if (__isset.begin_in_both) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Begin_in_both: "); + sb.Append(Begin_in_both); + } + if (__isset.newint) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newint: "); + sb.Append(Newint); + } + if (__isset.newbyte) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newbyte: "); + sb.Append(Newbyte); + } + if (__isset.newshort) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newshort: "); + sb.Append(Newshort); + } + if (__isset.newlong) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newlong: "); + sb.Append(Newlong); + } + if (__isset.newdouble) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newdouble: "); + sb.Append(Newdouble); + } + if (Newstruct != null && __isset.newstruct) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newstruct: "); + sb.Append(Newstruct == null ? "" : Newstruct.ToString()); + } + if (Newlist != null && __isset.newlist) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newlist: "); + sb.Append(Newlist); + } + if (Newset != null && __isset.newset) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newset: "); + sb.Append(Newset); + } + if (Newmap != null && __isset.newmap) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newmap: "); + sb.Append(Newmap); + } + if (Newstring != null && __isset.newstring) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Newstring: "); + sb.Append(Newstring); + } + if (__isset.end_in_both) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("End_in_both: "); + sb.Append(End_in_both); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool begin_in_both; + [DataMember] public bool newint; + [DataMember] public bool newbyte; + [DataMember] public bool newshort; + [DataMember] public bool newlong; + [DataMember] public bool newdouble; + [DataMember] public bool newstruct; + [DataMember] public bool newlist; + [DataMember] public bool newset; + [DataMember] public bool newmap; + [DataMember] public bool newstring; + [DataMember] public bool end_in_both; + } + + #region XmlSerializer support + + public bool ShouldSerializeBegin_in_both() + { + return __isset.begin_in_both; + } + + public bool ShouldSerializeNewint() + { + return __isset.newint; + } + + public bool ShouldSerializeNewbyte() + { + return __isset.newbyte; + } + + public bool ShouldSerializeNewshort() + { + return __isset.newshort; + } + + public bool ShouldSerializeNewlong() + { + return __isset.newlong; + } + + public bool ShouldSerializeNewdouble() + { + return __isset.newdouble; + } + + public bool ShouldSerializeNewstruct() + { + return __isset.newstruct; + } + + public bool ShouldSerializeNewlist() + { + return __isset.newlist; + } + + public bool ShouldSerializeNewset() + { + return __isset.newset; + } + + public bool ShouldSerializeNewmap() + { + return __isset.newmap; + } + + public bool ShouldSerializeNewstring() + { + return __isset.newstring; + } + + public bool ShouldSerializeEnd_in_both() + { + return __isset.end_in_both; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs new file mode 100644 index 00000000000..2df4ee10729 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs @@ -0,0 +1,231 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + public partial class Xception : TException, TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _errorCode; + private string _message; + + public Xception() + { + } + + [DataMember(Order = 0)] + public int ErrorCode + { + get { return _errorCode; } + set + { + __isset.errorCode = true; + this._errorCode = value; + } + } + + [DataMember(Order = 0)] + public string Message + { + get { return _message; } + set + { + __isset.message = true; + this._message = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ErrorCode = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Message = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xception"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.errorCode) + { + field.Name = "errorCode"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ErrorCode, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Message != null && __isset.message) + { + field.Name = "message"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Message, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xception("); + bool __first = true; + if (__isset.errorCode) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("ErrorCode: "); + sb.Append(ErrorCode); + } + if (Message != null && __isset.message) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Message: "); + sb.Append(Message); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool errorCode; + [DataMember] public bool message; + } + + #region XmlSerializer support + + public bool ShouldSerializeErrorCode() + { + return __isset.errorCode; + } + + public bool ShouldSerializeMessage() + { + return __isset.message; + } + + #endregion XmlSerializer support + } + + + [DataContract] + public partial class XceptionFault + { + private int _errorCode; + private string _message; + + [DataMember(Order = 0)] + public int ErrorCode + { + get { return _errorCode; } + set { this._errorCode = value; } + } + + [DataMember(Order = 0)] + public string Message + { + get { return _message; } + set { this._message = value; } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs new file mode 100644 index 00000000000..e5c1f8e6d8a --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs @@ -0,0 +1,232 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + public partial class Xception2 : TException, TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _errorCode; + private Xtruct _struct_thing; + + public Xception2() + { + } + + [DataMember(Order = 0)] + public int ErrorCode + { + get { return _errorCode; } + set + { + __isset.errorCode = true; + this._errorCode = value; + } + } + + [DataMember(Order = 0)] + public Xtruct Struct_thing + { + get { return _struct_thing; } + set + { + __isset.struct_thing = true; + this._struct_thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ErrorCode = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Struct_thing = new Xtruct(); + await Struct_thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xception2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.errorCode) + { + field.Name = "errorCode"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ErrorCode, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Struct_thing != null && __isset.struct_thing) + { + field.Name = "struct_thing"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Struct_thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xception2("); + bool __first = true; + if (__isset.errorCode) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("ErrorCode: "); + sb.Append(ErrorCode); + } + if (Struct_thing != null && __isset.struct_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Struct_thing: "); + sb.Append(Struct_thing == null ? "" : Struct_thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool errorCode; + [DataMember] public bool struct_thing; + } + + #region XmlSerializer support + + public bool ShouldSerializeErrorCode() + { + return __isset.errorCode; + } + + public bool ShouldSerializeStruct_thing() + { + return __isset.struct_thing; + } + + #endregion XmlSerializer support + } + + + [DataContract] + public partial class Xception2Fault + { + private int _errorCode; + private Xtruct _struct_thing; + + [DataMember(Order = 0)] + public int ErrorCode + { + get { return _errorCode; } + set { this._errorCode = value; } + } + + [DataMember(Order = 0)] + public Xtruct Struct_thing + { + get { return _struct_thing; } + set { this._struct_thing = value; } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs new file mode 100644 index 00000000000..23f0013aa7d --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs @@ -0,0 +1,351 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Xtruct : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private sbyte _byte_thing; + private short _i16_thing; + private int _i32_thing; + private long _i64_thing; + private string _string_thing; + + public Xtruct() + { + } + + [DataMember(Order = 0)] + public string String_thing + { + get { return _string_thing; } + set + { + __isset.string_thing = true; + this._string_thing = value; + } + } + + [DataMember(Order = 0)] + public sbyte Byte_thing + { + get { return _byte_thing; } + set + { + __isset.byte_thing = true; + this._byte_thing = value; + } + } + + [DataMember(Order = 0)] + public short I16_thing + { + get { return _i16_thing; } + set + { + __isset.i16_thing = true; + this._i16_thing = value; + } + } + + [DataMember(Order = 0)] + public int I32_thing + { + get { return _i32_thing; } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + [DataMember(Order = 0)] + public long I64_thing + { + get { return _i64_thing; } + set + { + __isset.i64_thing = true; + this._i64_thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Byte) + { + Byte_thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 7: + if (field.Type == TType.I16) + { + I16_thing = await iprot.ReadI16Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.I64) + { + I64_thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_thing != null && __isset.string_thing) + { + field.Name = "string_thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.byte_thing) + { + field.Name = "byte_thing"; + field.Type = TType.Byte; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Byte_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i16_thing) + { + field.Name = "i16_thing"; + field.Type = TType.I16; + field.ID = 7; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI16Async(I16_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i64_thing) + { + field.Name = "i64_thing"; + field.Type = TType.I64; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(I64_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct("); + bool __first = true; + if (String_thing != null && __isset.string_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("String_thing: "); + sb.Append(String_thing); + } + if (__isset.byte_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Byte_thing: "); + sb.Append(Byte_thing); + } + if (__isset.i16_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I16_thing: "); + sb.Append(I16_thing); + } + if (__isset.i32_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + if (__isset.i64_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I64_thing: "); + sb.Append(I64_thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool string_thing; + [DataMember] public bool byte_thing; + [DataMember] public bool i16_thing; + [DataMember] public bool i32_thing; + [DataMember] public bool i64_thing; + } + + #region XmlSerializer support + + public bool ShouldSerializeString_thing() + { + return __isset.string_thing; + } + + public bool ShouldSerializeByte_thing() + { + return __isset.byte_thing; + } + + public bool ShouldSerializeI16_thing() + { + return __isset.i16_thing; + } + + public bool ShouldSerializeI32_thing() + { + return __isset.i32_thing; + } + + public bool ShouldSerializeI64_thing() + { + return __isset.i64_thing; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs new file mode 100644 index 00000000000..bf0296ffe5b --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs @@ -0,0 +1,258 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Xtruct2 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private sbyte _byte_thing; + private int _i32_thing; + private Xtruct _struct_thing; + + public Xtruct2() + { + } + + [DataMember(Order = 0)] + public sbyte Byte_thing + { + get { return _byte_thing; } + set + { + __isset.byte_thing = true; + this._byte_thing = value; + } + } + + [DataMember(Order = 0)] + public Xtruct Struct_thing + { + get { return _struct_thing; } + set + { + __isset.struct_thing = true; + this._struct_thing = value; + } + } + + [DataMember(Order = 0)] + public int I32_thing + { + get { return _i32_thing; } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Byte_thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Struct_thing = new Xtruct(); + await Struct_thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.byte_thing) + { + field.Name = "byte_thing"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Byte_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Struct_thing != null && __isset.struct_thing) + { + field.Name = "struct_thing"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Struct_thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct2("); + bool __first = true; + if (__isset.byte_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Byte_thing: "); + sb.Append(Byte_thing); + } + if (Struct_thing != null && __isset.struct_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Struct_thing: "); + sb.Append(Struct_thing == null ? "" : Struct_thing.ToString()); + } + if (__isset.i32_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool byte_thing; + [DataMember] public bool struct_thing; + [DataMember] public bool i32_thing; + } + + #region XmlSerializer support + + public bool ShouldSerializeByte_thing() + { + return __isset.byte_thing; + } + + public bool ShouldSerializeStruct_thing() + { + return __isset.struct_thing; + } + + public bool ShouldSerializeI32_thing() + { + return __isset.i32_thing; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs new file mode 100644 index 00000000000..1256cbbbd0e --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs @@ -0,0 +1,304 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace ThriftAsync.Test +{ + [DataContract(Namespace = "")] + public partial class Xtruct3 : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _changed; + private int _i32_thing; + private long _i64_thing; + private string _string_thing; + + public Xtruct3() + { + } + + [DataMember(Order = 0)] + public string String_thing + { + get { return _string_thing; } + set + { + __isset.string_thing = true; + this._string_thing = value; + } + } + + [DataMember(Order = 0)] + public int Changed + { + get { return _changed; } + set + { + __isset.changed = true; + this._changed = value; + } + } + + [DataMember(Order = 0)] + public int I32_thing + { + get { return _i32_thing; } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + [DataMember(Order = 0)] + public long I64_thing + { + get { return _i64_thing; } + set + { + __isset.i64_thing = true; + this._i64_thing = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Changed = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.I64) + { + I64_thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct3"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_thing != null && __isset.string_thing) + { + field.Name = "string_thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.changed) + { + field.Name = "changed"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Changed, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i64_thing) + { + field.Name = "i64_thing"; + field.Type = TType.I64; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(I64_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct3("); + bool __first = true; + if (String_thing != null && __isset.string_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("String_thing: "); + sb.Append(String_thing); + } + if (__isset.changed) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Changed: "); + sb.Append(Changed); + } + if (__isset.i32_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + if (__isset.i64_thing) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("I64_thing: "); + sb.Append(I64_thing); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool string_thing; + [DataMember] public bool changed; + [DataMember] public bool i32_thing; + [DataMember] public bool i64_thing; + } + + #region XmlSerializer support + + public bool ShouldSerializeString_thing() + { + return __isset.string_thing; + } + + public bool ShouldSerializeChanged() + { + return __isset.changed; + } + + public bool ShouldSerializeI32_thing() + { + return __isset.i32_thing; + } + + public bool ShouldSerializeI64_thing() + { + return __isset.i64_thing; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..78ca6d70da7 --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Thrift.PublicInterfaces.Tests")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("d0d3706b-fed5-4cf5-b984-04f448de9d7b")] \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj new file mode 100644 index 00000000000..733e473e25c --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + d0d3706b-fed5-4cf5-b984-04f448de9d7b + Thrift.PublicInterfaces.Tests + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift new file mode 100644 index 00000000000..69b708e00bc --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift @@ -0,0 +1,382 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Contains some contributions under the Thrift Software License. + * Please see doc/old-thrift-license.txt in the Thrift distribution for + * details. + */ + +namespace csharp ThriftAsync.Test + +/** + * Docstring! + */ +enum Numberz +{ + ONE = 1, + TWO, + THREE, + FIVE = 5, + SIX, + EIGHT = 8 +} + +const Numberz myNumberz = Numberz.ONE; +// the following is expected to fail: +// const Numberz urNumberz = ONE; + +typedef i64 UserId + +struct Bonk +{ + 1: string message, + 2: i32 type +} + +typedef map MapType + +struct Bools { + 1: bool im_true, + 2: bool im_false, +} + +struct Xtruct +{ + 1: string string_thing, + 4: byte byte_thing, + 7: i16 i16_thing, + 9: i32 i32_thing, + 11: i64 i64_thing +} + +struct Xtruct2 +{ + 1: byte byte_thing, // used to be byte, hence the name + 2: Xtruct struct_thing, + 3: i32 i32_thing +} + +struct Xtruct3 +{ + 1: string string_thing, + 4: i32 changed, + 9: i32 i32_thing, + 11: i64 i64_thing +} + + +struct Insanity +{ + 1: map userMap, + 2: list xtructs +} (python.immutable= "") + +struct CrazyNesting { + 1: string string_field, + 2: optional set set_field, + // Do not insert line break as test/go/Makefile.am is removing this line with pattern match + 3: required list (python.immutable = ""), map(python.immutable = "")> (python.immutable = "")>>>> list_field, + 4: binary binary_field +} + +exception Xception { + 1: i32 errorCode, + 2: string message +} + +exception Xception2 { + 1: i32 errorCode, + 2: Xtruct struct_thing +} + +struct EmptyStruct {} + +struct OneField { + 1: EmptyStruct field +} + +service ThriftTest +{ + /** + * Prints "testVoid()" and returns nothing. + */ + void testVoid(), + + /** + * Prints 'testString("%s")' with thing as '%s' + * @param string thing - the string to print + * @return string - returns the string 'thing' + */ + string testString(1: string thing), + + /** + * Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' + * @param bool thing - the bool data to print + * @return bool - returns the bool 'thing' + */ + bool testBool(1: bool thing), + + /** + * Prints 'testByte("%d")' with thing as '%d' + * The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. + * @param byte thing - the i8/byte to print + * @return i8 - returns the i8/byte 'thing' + */ + byte testByte(1: byte thing), + + /** + * Prints 'testI32("%d")' with thing as '%d' + * @param i32 thing - the i32 to print + * @return i32 - returns the i32 'thing' + */ + i32 testI32(1: i32 thing), + + /** + * Prints 'testI64("%d")' with thing as '%d' + * @param i64 thing - the i64 to print + * @return i64 - returns the i64 'thing' + */ + i64 testI64(1: i64 thing), + + /** + * Prints 'testDouble("%f")' with thing as '%f' + * @param double thing - the double to print + * @return double - returns the double 'thing' + */ + double testDouble(1: double thing), + + /** + * Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data + * @param binary thing - the binary data to print + * @return binary - returns the binary 'thing' + */ + binary testBinary(1: binary thing), + + /** + * Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values + * @param Xtruct thing - the Xtruct to print + * @return Xtruct - returns the Xtruct 'thing' + */ + Xtruct testStruct(1: Xtruct thing), + + /** + * Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct + * @param Xtruct2 thing - the Xtruct2 to print + * @return Xtruct2 - returns the Xtruct2 'thing' + */ + Xtruct2 testNest(1: Xtruct2 thing), + + /** + * Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs + * separated by commas and new lines + * @param map thing - the map to print + * @return map - returns the map 'thing' + */ + map testMap(1: map thing), + + /** + * Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs + * separated by commas and new lines + * @param map thing - the map to print + * @return map - returns the map 'thing' + */ + map testStringMap(1: map thing), + + /** + * Prints 'testSet("{%s}")' where thing has been formatted into a string of values + * separated by commas and new lines + * @param set thing - the set to print + * @return set - returns the set 'thing' + */ + set testSet(1: set thing), + + /** + * Prints 'testList("{%s}")' where thing has been formatted into a string of values + * separated by commas and new lines + * @param list thing - the list to print + * @return list - returns the list 'thing' + */ + list testList(1: list thing), + + /** + * Prints 'testEnum("%d")' where thing has been formatted into it's numeric value + * @param Numberz thing - the Numberz to print + * @return Numberz - returns the Numberz 'thing' + */ + Numberz testEnum(1: Numberz thing), + + /** + * Prints 'testTypedef("%d")' with thing as '%d' + * @param UserId thing - the UserId to print + * @return UserId - returns the UserId 'thing' + */ + UserId testTypedef(1: UserId thing), + + /** + * Prints 'testMapMap("%d")' with hello as '%d' + * @param i32 hello - the i32 to print + * @return map> - returns a dictionary with these values: + * {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } + */ + map> testMapMap(1: i32 hello), + + /** + * So you think you've got this all worked, out eh? + * + * Creates a the returned map with these values and prints it out: + * { 1 => { 2 => argument, + * 3 => argument, + * }, + * 2 => { 6 => , }, + * } + * @return map> - a map with the above values + */ + map> testInsanity(1: Insanity argument), + + /** + * Prints 'testMulti()' + * @param byte arg0 - + * @param i32 arg1 - + * @param i64 arg2 - + * @param map arg3 - + * @param Numberz arg4 - + * @param UserId arg5 - + * @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 + * and i64_thing = arg2 + */ + Xtruct testMulti(1: byte arg0, 2: i32 arg1, 3: i64 arg2, 4: map arg3, 5: Numberz arg4, 6: UserId arg5), + + /** + * Print 'testException(%s)' with arg as '%s' + * @param string arg - a string indication what type of exception to throw + * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg + * elsen if arg == "TException" throw TException + * else do not throw anything + */ + void testException(1: string arg) throws(1: Xception err1), + + /** + * Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' + * @param string arg - a string indication what type of exception to throw + * if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" + * elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2" + * else do not throw anything + * @return Xtruct - an Xtruct with string_thing = arg1 + */ + Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2) + + /** + * Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' + * sleep 'secondsToSleep' + * Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' + * @param i32 secondsToSleep - the number of seconds to sleep + */ + oneway void testOneway(1:i32 secondsToSleep) +} + +service SecondService +{ + void blahBlah() + /** + * Prints 'testString("%s")' with thing as '%s' + * @param string thing - the string to print + * @return string - returns the string 'thing' + */ + string secondtestString(1: string thing), +} + +struct VersioningTestV1 { + 1: i32 begin_in_both, + 3: string old_string, + 12: i32 end_in_both +} + +struct VersioningTestV2 { + 1: i32 begin_in_both, + + 2: i32 newint, + 3: byte newbyte, + 4: i16 newshort, + 5: i64 newlong, + 6: double newdouble + 7: Bonk newstruct, + 8: list newlist, + 9: set newset, + 10: map newmap, + 11: string newstring, + 12: i32 end_in_both +} + +struct ListTypeVersioningV1 { + 1: list myints; + 2: string hello; +} + +struct ListTypeVersioningV2 { + 1: list strings; + 2: string hello; +} + +struct GuessProtocolStruct { + 7: map map_field, +} + +struct LargeDeltas { + 1: Bools b1, + 10: Bools b10, + 100: Bools b100, + 500: bool check_true, + 1000: Bools b1000, + 1500: bool check_false, + 2000: VersioningTestV2 vertwo2000, + 2500: set a_set2500, + 3000: VersioningTestV2 vertwo3000, + 4000: list big_numbers +} + +struct NestedListsI32x2 { + 1: list> integerlist +} +struct NestedListsI32x3 { + 1: list>> integerlist +} +struct NestedMixedx2 { + 1: list> int_set_list + 2: map> map_int_strset + 3: list>> map_int_strset_list +} +struct ListBonks { + 1: list bonk +} +struct NestedListsBonk { + 1: list>> bonk +} + +struct BoolTest { + 1: optional bool b = true; + 2: optional string s = "true"; +} + +struct StructA { + 1: required string s; +} + +struct StructB { + 1: optional StructA aa; + 2: required StructA ab; +} diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json new file mode 100644 index 00000000000..441df75390b --- /dev/null +++ b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json @@ -0,0 +1,25 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "Thrift": "1.0.0-*", + "System.ServiceModel.Primitives": "4.0.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + }, + + "scripts": { + "precompile": [ + /* + "%project:Directory%/../../thrift.exe -r -out %project:Directory%/Generated --gen netcore:wcf %project:Directory%/ThriftTestAsync.thrift", + "%project:Directory%/../../thrift.exe -r -out %project:Directory%/Generated --gen netcore:wcf %project:Directory%/Facebook303Test.thrift", + "%project:Directory%/../../thrift.exe -r -out %project:Directory%/Generated --gen netcore:wcf %project:Directory%/CassandraTest.thrift" + */ + ] + } +} diff --git a/lib/netcore/src/Thrift.sln b/lib/netcore/src/Thrift.sln new file mode 100644 index 00000000000..eb61258834b --- /dev/null +++ b/lib/netcore/src/Thrift.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F043FC17-16B7-4497-B975-ABC12180F351}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift.PublicInterfaces.Compile.Tests", "Tests\Thrift.PublicInterfaces.Compile.Tests\Thrift.PublicInterfaces.Compile.Tests.xproj", "{D0D3706B-FED5-4CF5-B984-04F448DE9D7B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.Build.0 = Release|Any CPU + {D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0D3706B-FED5-4CF5-B984-04F448DE9D7B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D0D3706B-FED5-4CF5-B984-04F448DE9D7B} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE} + EndGlobalSection +EndGlobal diff --git a/lib/netcore/src/Thrift/Collections/TCollections.cs b/lib/netcore/src/Thrift/Collections/TCollections.cs new file mode 100644 index 00000000000..147bfc7d31c --- /dev/null +++ b/lib/netcore/src/Thrift/Collections/TCollections.cs @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Collections; + +namespace Thrift.Collections +{ + // ReSharper disable once InconsistentNaming + public class TCollections + { + /// + /// This will return true if the two collections are value-wise the same. + /// If the collection contains a collection, the collections will be compared using this method. + /// + public static bool Equals(IEnumerable first, IEnumerable second) + { + if (first == null && second == null) + { + return true; + } + + if (first == null || second == null) + { + return false; + } + + var fiter = first.GetEnumerator(); + var siter = second.GetEnumerator(); + + var fnext = fiter.MoveNext(); + var snext = siter.MoveNext(); + + while (fnext && snext) + { + var fenum = fiter.Current as IEnumerable; + var senum = siter.Current as IEnumerable; + + if (fenum != null && senum != null) + { + if (!Equals(fenum, senum)) + { + return false; + } + } + else if (fenum == null ^ senum == null) + { + return false; + } + else if (!Equals(fiter.Current, siter.Current)) + { + return false; + } + + fnext = fiter.MoveNext(); + snext = siter.MoveNext(); + } + + return fnext == snext; + } + + /// + /// This returns a hashcode based on the value of the enumerable. + /// + public static int GetHashCode(IEnumerable enumerable) + { + if (enumerable == null) + { + return 0; + } + + var hashcode = 0; + + foreach (var obj in enumerable) + { + var enum2 = obj as IEnumerable; + var objHash = enum2 == null ? obj.GetHashCode() : GetHashCode(enum2); + + unchecked + { + hashcode = (hashcode*397) ^ (objHash); + } + } + + return hashcode; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Collections/THashSet.cs b/lib/netcore/src/Thrift/Collections/THashSet.cs new file mode 100644 index 00000000000..011f0a0d629 --- /dev/null +++ b/lib/netcore/src/Thrift/Collections/THashSet.cs @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Collections; +using System.Collections.Generic; + +namespace Thrift.Collections +{ + // ReSharper disable once InconsistentNaming + public class THashSet : ICollection + { + private readonly HashSet _set = new HashSet(); + + public int Count => _set.Count; + + public bool IsReadOnly => false; + + public void Add(T item) + { + _set.Add(item); + } + + public void Clear() + { + _set.Clear(); + } + + public bool Contains(T item) + { + return _set.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + _set.CopyTo(array, arrayIndex); + } + + public IEnumerator GetEnumerator() + { + return _set.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable) _set).GetEnumerator(); + } + + public bool Remove(T item) + { + return _set.Remove(item); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/ITAsyncProcessor.cs b/lib/netcore/src/Thrift/ITAsyncProcessor.cs new file mode 100644 index 00000000000..db8e40aefe8 --- /dev/null +++ b/lib/netcore/src/Thrift/ITAsyncProcessor.cs @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols; + +namespace Thrift +{ + public interface ITAsyncProcessor + { + Task ProcessAsync(TProtocol iprot, TProtocol oprot); + Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/ITProcessorFactory.cs b/lib/netcore/src/Thrift/ITProcessorFactory.cs new file mode 100644 index 00000000000..5133e5c4801 --- /dev/null +++ b/lib/netcore/src/Thrift/ITProcessorFactory.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using Thrift.Server; +using Thrift.Transports; + +namespace Thrift +{ + // ReSharper disable once InconsistentNaming + public interface ITProcessorFactory + { + ITAsyncProcessor GetAsyncProcessor(TClientTransport trans, TBaseServer baseServer = null); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Properties/AssemblyInfo.cs b/lib/netcore/src/Thrift/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..e3118ab23be --- /dev/null +++ b/lib/netcore/src/Thrift/Properties/AssemblyInfo.cs @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("Thrift")] +[assembly: AssemblyDescription("C# .NET Core bindings for the Apache Thrift RPC system")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +//@TODO where to put License information? + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a exType in this assembly from +// COM, set the ComVisible attribute to true on that exType. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("df3f8ef0-e0a3-4c86-a65b-8ec84e016b1d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TField.cs b/lib/netcore/src/Thrift/Protocols/Entities/TField.cs new file mode 100644 index 00000000000..d311535e73c --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TField.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TField + { + public TField(string name, TType type, short id) + { + Name = name; + Type = type; + ID = id; + } + + public string Name { get; set; } + + public TType Type { get; set; } + + // ReSharper disable once InconsistentNaming - do not rename - it used for generation + public short ID { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TList.cs b/lib/netcore/src/Thrift/Protocols/Entities/TList.cs new file mode 100644 index 00000000000..ce232207cba --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TList.cs @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TList + { + public TList(TType elementType, int count) + { + ElementType = elementType; + Count = count; + } + + public TType ElementType { get; set; } + + public int Count { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMap.cs b/lib/netcore/src/Thrift/Protocols/Entities/TMap.cs new file mode 100644 index 00000000000..9195593db27 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TMap.cs @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TMap + { + public TMap(TType keyType, TType valueType, int count) + { + KeyType = keyType; + ValueType = valueType; + Count = count; + } + + public TType KeyType { get; set; } + + public TType ValueType { get; set; } + + public int Count { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs b/lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs new file mode 100644 index 00000000000..17f49298f77 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TMessage + { + public TMessage(string name, TMessageType type, int seqid) + { + Name = name; + Type = type; + SeqID = seqid; + } + + public string Name { get; set; } + + public TMessageType Type { get; set; } + + // ReSharper disable once InconsistentNaming - do not rename - it used for generation + public int SeqID { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs b/lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs new file mode 100644 index 00000000000..d7b9a227595 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public enum TMessageType + { + Call = 1, + Reply = 2, + Exception = 3, + Oneway = 4 + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TSet.cs b/lib/netcore/src/Thrift/Protocols/Entities/TSet.cs new file mode 100644 index 00000000000..a583b54a681 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TSet.cs @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TSet + { + public TSet(TType elementType, int count) + { + ElementType = elementType; + Count = count; + } + + public TSet(TList list) + : this(list.ElementType, list.Count) + { + } + + public TType ElementType { get; set; } + + public int Count { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs b/lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs new file mode 100644 index 00000000000..a28dcc3d001 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public struct TStruct + { + public TStruct(string name) + { + Name = name; + } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TType.cs b/lib/netcore/src/Thrift/Protocols/Entities/TType.cs new file mode 100644 index 00000000000..ebe781c9547 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Entities/TType.cs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols.Entities +{ + // ReSharper disable once InconsistentNaming + public enum TType : byte + { + Stop = 0, + Void = 1, + Bool = 2, + Byte = 3, + Double = 4, + I16 = 6, + I32 = 8, + I64 = 10, + String = 11, + Struct = 12, + Map = 13, + Set = 14, + List = 15 + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs b/lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs new file mode 100644 index 00000000000..ecc5cc494d4 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using Thrift.Transports; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public interface ITProtocolFactory + { + TProtocol GetProtocol(TClientTransport trans); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TAbstractBase.cs b/lib/netcore/src/Thrift/Protocols/TAbstractBase.cs new file mode 100644 index 00000000000..eddb85e755f --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TAbstractBase.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public interface TAbstractBase + { + Task WriteAsync(TProtocol tProtocol, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TBase.cs b/lib/netcore/src/Thrift/Protocols/TBase.cs new file mode 100644 index 00000000000..cd1109971d5 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TBase.cs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public interface TBase : TAbstractBase + { + Task ReadAsync(TProtocol tProtocol, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs b/lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs new file mode 100644 index 00000000000..fa0c5fc93ae --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs @@ -0,0 +1,608 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; +using Thrift.Transports; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public class TBinaryProtocol : TProtocol + { + //TODO: Unit tests + //TODO: Localization + //TODO: pragma + + protected const uint VersionMask = 0xffff0000; + protected const uint Version1 = 0x80010000; + + protected bool StrictRead; + protected bool StrictWrite; + + public TBinaryProtocol(TClientTransport trans) + : this(trans, false, true) + { + } + + public TBinaryProtocol(TClientTransport trans, bool strictRead, bool strictWrite) + : base(trans) + { + StrictRead = strictRead; + StrictWrite = strictWrite; + } + + public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + if (StrictWrite) + { + var version = Version1 | (uint) message.Type; + await WriteI32Async((int) version, cancellationToken); + await WriteStringAsync(message.Name, cancellationToken); + await WriteI32Async(message.SeqID, cancellationToken); + } + else + { + await WriteStringAsync(message.Name, cancellationToken); + await WriteByteAsync((sbyte) message.Type, cancellationToken); + await WriteI32Async(message.SeqID, cancellationToken); + } + } + + public override async Task WriteMessageEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteStructEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync((sbyte) field.Type, cancellationToken); + await WriteI16Async(field.ID, cancellationToken); + } + + public override async Task WriteFieldEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteFieldStopAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync((sbyte) TType.Stop, cancellationToken); + } + + public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync((sbyte) map.KeyType, cancellationToken); + await WriteByteAsync((sbyte) map.ValueType, cancellationToken); + await WriteI32Async(map.Count, cancellationToken); + } + + public override async Task WriteMapEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync((sbyte) list.ElementType, cancellationToken); + await WriteI32Async(list.Count, cancellationToken); + } + + public override async Task WriteListEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync((sbyte) set.ElementType, cancellationToken); + await WriteI32Async(set.Count, cancellationToken); + } + + public override async Task WriteSetEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteByteAsync(b ? (sbyte) 1 : (sbyte) 0, cancellationToken); + } + + protected internal static byte[] CreateWriteByte(sbyte b) + { + var bout = new byte[1]; + + bout[0] = (byte) b; + + return bout; + } + + public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bout = CreateWriteByte(b); + await Trans.WriteAsync(bout, 0, 1, cancellationToken); + } + + protected internal static byte[] CreateWriteI16(short s) + { + var i16Out = new byte[2]; + + i16Out[0] = (byte) (0xff & (s >> 8)); + i16Out[1] = (byte) (0xff & s); + + return i16Out; + } + + public override async Task WriteI16Async(short i16, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var i16Out = CreateWriteI16(i16); + await Trans.WriteAsync(i16Out, 0, 2, cancellationToken); + } + + protected internal static byte[] CreateWriteI32(int i32) + { + var i32Out = new byte[4]; + + i32Out[0] = (byte) (0xff & (i32 >> 24)); + i32Out[1] = (byte) (0xff & (i32 >> 16)); + i32Out[2] = (byte) (0xff & (i32 >> 8)); + i32Out[3] = (byte) (0xff & i32); + + return i32Out; + } + + public override async Task WriteI32Async(int i32, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var i32Out = CreateWriteI32(i32); + await Trans.WriteAsync(i32Out, 0, 4, cancellationToken); + } + + protected internal static byte[] CreateWriteI64(long i64) + { + var i64Out = new byte[8]; + + i64Out[0] = (byte) (0xff & (i64 >> 56)); + i64Out[1] = (byte) (0xff & (i64 >> 48)); + i64Out[2] = (byte) (0xff & (i64 >> 40)); + i64Out[3] = (byte) (0xff & (i64 >> 32)); + i64Out[4] = (byte) (0xff & (i64 >> 24)); + i64Out[5] = (byte) (0xff & (i64 >> 16)); + i64Out[6] = (byte) (0xff & (i64 >> 8)); + i64Out[7] = (byte) (0xff & i64); + + return i64Out; + } + + public override async Task WriteI64Async(long i64, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var i64Out = CreateWriteI64(i64); + await Trans.WriteAsync(i64Out, 0, 8, cancellationToken); + } + + public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteI64Async(BitConverter.DoubleToInt64Bits(d), cancellationToken); + } + + public override async Task WriteBinaryAsync(byte[] b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteI32Async(b.Length, cancellationToken); + await Trans.WriteAsync(b, 0, b.Length, cancellationToken); + } + + public override async Task ReadMessageBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var message = new TMessage(); + var size = await ReadI32Async(cancellationToken); + if (size < 0) + { + var version = (uint) size & VersionMask; + if (version != Version1) + { + throw new TProtocolException(TProtocolException.BAD_VERSION, + $"Bad version in ReadMessageBegin: {version}"); + } + message.Type = (TMessageType) (size & 0x000000ff); + message.Name = await ReadStringAsync(cancellationToken); + message.SeqID = await ReadI32Async(cancellationToken); + } + else + { + if (StrictRead) + { + throw new TProtocolException(TProtocolException.BAD_VERSION, + "Missing version in ReadMessageBegin, old client?"); + } + message.Name = await ReadStringBodyAsync(size, cancellationToken); + message.Type = (TMessageType) await ReadByteAsync(cancellationToken); + message.SeqID = await ReadI32Async(cancellationToken); + } + return message; + } + + public override async Task ReadMessageEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadStructBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + //TODO: no read from internal transport? + return new TStruct(); + } + + public override async Task ReadStructEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadFieldBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var field = new TField + { + Type = (TType) await ReadByteAsync(cancellationToken) + }; + + if (field.Type != TType.Stop) + { + field.ID = await ReadI16Async(cancellationToken); + } + + return field; + } + + public override async Task ReadFieldEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadMapBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var map = new TMap + { + KeyType = (TType) await ReadByteAsync(cancellationToken), + ValueType = (TType) await ReadByteAsync(cancellationToken), + Count = await ReadI32Async(cancellationToken) + }; + + return map; + } + + public override async Task ReadMapEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadListBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var list = new TList + { + ElementType = (TType) await ReadByteAsync(cancellationToken), + Count = await ReadI32Async(cancellationToken) + }; + + return list; + } + + public override async Task ReadListEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadSetBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var set = new TSet + { + ElementType = (TType) await ReadByteAsync(cancellationToken), + Count = await ReadI32Async(cancellationToken) + }; + + return set; + } + + public override async Task ReadSetEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadBoolAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + return await ReadByteAsync(cancellationToken) == 1; + } + + public override async Task ReadByteAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var bin = new byte[1]; + await Trans.ReadAllAsync(bin, 0, 1, cancellationToken); //TODO: why readall ? + return (sbyte) bin[0]; + } + + public override async Task ReadI16Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var i16In = new byte[2]; + await Trans.ReadAllAsync(i16In, 0, 2, cancellationToken); + var result = (short) (((i16In[0] & 0xff) << 8) | i16In[1] & 0xff); + return result; + } + + public override async Task ReadI32Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var i32In = new byte[4]; + await Trans.ReadAllAsync(i32In, 0, 4, cancellationToken); + var result = ((i32In[0] & 0xff) << 24) | ((i32In[1] & 0xff) << 16) | ((i32In[2] & 0xff) << 8) | + i32In[3] & 0xff; + return result; + } + +#pragma warning disable 675 + + protected internal long CreateReadI64(byte[] buf) + { + var result = + ((long) (buf[0] & 0xff) << 56) | + ((long) (buf[1] & 0xff) << 48) | + ((long) (buf[2] & 0xff) << 40) | + ((long) (buf[3] & 0xff) << 32) | + ((long) (buf[4] & 0xff) << 24) | + ((long) (buf[5] & 0xff) << 16) | + ((long) (buf[6] & 0xff) << 8) | + buf[7] & 0xff; + + return result; + } + +#pragma warning restore 675 + + public override async Task ReadI64Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var i64In = new byte[8]; + await Trans.ReadAllAsync(i64In, 0, 8, cancellationToken); + return CreateReadI64(i64In); + } + + public override async Task ReadDoubleAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var d = await ReadI64Async(cancellationToken); + return BitConverter.Int64BitsToDouble(d); + } + + public override async Task ReadBinaryAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var size = await ReadI32Async(cancellationToken); + var buf = new byte[size]; + await Trans.ReadAllAsync(buf, 0, size, cancellationToken); + return buf; + } + + private async Task ReadStringBodyAsync(int size, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + var buf = new byte[size]; + await Trans.ReadAllAsync(buf, 0, size, cancellationToken); + return Encoding.UTF8.GetString(buf, 0, buf.Length); + } + + public class Factory : ITProtocolFactory + { + protected bool StrictRead; + protected bool StrictWrite; + + public Factory() + : this(false, true) + { + } + + public Factory(bool strictRead, bool strictWrite) + { + StrictRead = strictRead; + StrictWrite = strictWrite; + } + + public TProtocol GetProtocol(TClientTransport trans) + { + return new TBinaryProtocol(trans, StrictRead, StrictWrite); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs b/lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs new file mode 100644 index 00000000000..6d5e0bf3514 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs @@ -0,0 +1,922 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; +using Thrift.Transports; + +namespace Thrift.Protocols +{ + //TODO: implementation of TProtocol + + // ReSharper disable once InconsistentNaming + public class TCompactProtocol : TProtocol + { + private const byte ProtocolId = 0x82; + private const byte Version = 1; + private const byte VersionMask = 0x1f; // 0001 1111 + private const byte TypeMask = 0xE0; // 1110 0000 + private const byte TypeBits = 0x07; // 0000 0111 + private const int TypeShiftAmount = 5; + private static readonly TStruct AnonymousStruct = new TStruct(string.Empty); + private static readonly TField Tstop = new TField(string.Empty, TType.Stop, 0); + + // ReSharper disable once InconsistentNaming + private static readonly byte[] TTypeToCompactType = new byte[16]; + + /// + /// Used to keep track of the last field for the current and previous structs, so we can do the delta stuff. + /// + private readonly Stack _lastField = new Stack(15); + + /// + /// If we encounter a boolean field begin, save the TField here so it can have the value incorporated. + /// + private TField? _booleanField; + + /// + /// If we Read a field header, and it's a boolean field, save the boolean value here so that ReadBool can use it. + /// + private bool? _boolValue; + + private short _lastFieldId; + + public TCompactProtocol(TClientTransport trans) + : base(trans) + { + TTypeToCompactType[(int) TType.Stop] = Types.Stop; + TTypeToCompactType[(int) TType.Bool] = Types.BooleanTrue; + TTypeToCompactType[(int) TType.Byte] = Types.Byte; + TTypeToCompactType[(int) TType.I16] = Types.I16; + TTypeToCompactType[(int) TType.I32] = Types.I32; + TTypeToCompactType[(int) TType.I64] = Types.I64; + TTypeToCompactType[(int) TType.Double] = Types.Double; + TTypeToCompactType[(int) TType.String] = Types.Binary; + TTypeToCompactType[(int) TType.List] = Types.List; + TTypeToCompactType[(int) TType.Set] = Types.Set; + TTypeToCompactType[(int) TType.Map] = Types.Map; + TTypeToCompactType[(int) TType.Struct] = Types.Struct; + } + + public void Reset() + { + _lastField.Clear(); + _lastFieldId = 0; + } + + public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await Trans.WriteAsync(new[] {ProtocolId}, cancellationToken); + await + Trans.WriteAsync( + new[] {(byte) ((Version & VersionMask) | (((uint) message.Type << TypeShiftAmount) & TypeMask))}, + cancellationToken); + + var bufferTuple = CreateWriteVarInt32((uint) message.SeqID); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + + await WriteStringAsync(message.Name, cancellationToken); + } + + public override async Task WriteMessageEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + /// + /// Write a struct begin. This doesn't actually put anything on the wire. We + /// use it as an opportunity to put special placeholder markers on the field + /// stack so we can get the field id deltas correct. + /// + public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + _lastField.Push(_lastFieldId); + _lastFieldId = 0; + } + + public override async Task WriteStructEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + _lastFieldId = _lastField.Pop(); + } + + private async Task WriteFieldBeginInternalAsync(TField field, byte typeOverride, + CancellationToken cancellationToken) + { + // if there's a exType override, use that. + var typeToWrite = typeOverride == 0xFF ? GetCompactType(field.Type) : typeOverride; + + // check if we can use delta encoding for the field id + if ((field.ID > _lastFieldId) && (field.ID - _lastFieldId <= 15)) + { + var b = (byte) (((field.ID - _lastFieldId) << 4) | typeToWrite); + // Write them together + await Trans.WriteAsync(new[] {b}, cancellationToken); + } + else + { + // Write them separate + await Trans.WriteAsync(new[] {typeToWrite}, cancellationToken); + await WriteI16Async(field.ID, cancellationToken); + } + + _lastFieldId = field.ID; + } + + public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken) + { + if (field.Type == TType.Bool) + { + _booleanField = field; + } + else + { + await WriteFieldBeginInternalAsync(field, 0xFF, cancellationToken); + } + } + + public override async Task WriteFieldEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteFieldStopAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await Trans.WriteAsync(new[] {Types.Stop}, cancellationToken); + } + + protected async Task WriteCollectionBeginAsync(TType elemType, int size, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + /* + Abstract method for writing the start of lists and sets. List and sets on + the wire differ only by the exType indicator. + */ + + if (size <= 14) + { + await Trans.WriteAsync(new[] {(byte) ((size << 4) | GetCompactType(elemType))}, cancellationToken); + } + else + { + await Trans.WriteAsync(new[] {(byte) (0xf0 | GetCompactType(elemType))}, cancellationToken); + + var bufferTuple = CreateWriteVarInt32((uint) size); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + } + } + + public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken) + { + await WriteCollectionBeginAsync(list.ElementType, list.Count, cancellationToken); + } + + public override async Task WriteListEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await WriteCollectionBeginAsync(set.ElementType, set.Count, cancellationToken); + } + + public override async Task WriteSetEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + /* + Write a boolean value. Potentially, this could be a boolean field, in + which case the field header info isn't written yet. If so, decide what the + right exType header is for the value and then Write the field header. + Otherwise, Write a single byte. + */ + + if (_booleanField != null) + { + // we haven't written the field header yet + await + WriteFieldBeginInternalAsync(_booleanField.Value, b ? Types.BooleanTrue : Types.BooleanFalse, + cancellationToken); + _booleanField = null; + } + else + { + // we're not part of a field, so just Write the value. + await Trans.WriteAsync(new[] {b ? Types.BooleanTrue : Types.BooleanFalse}, cancellationToken); + } + } + + public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + await Trans.WriteAsync(new[] {(byte) b}, cancellationToken); + } + + public override async Task WriteI16Async(short i16, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bufferTuple = CreateWriteVarInt32(IntToZigzag(i16)); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + } + + protected internal Tuple CreateWriteVarInt32(uint n) + { + // Write an i32 as a varint.Results in 1 - 5 bytes on the wire. + var i32Buf = new byte[5]; + var idx = 0; + + while (true) + { + if ((n & ~0x7F) == 0) + { + i32Buf[idx++] = (byte) n; + break; + } + + i32Buf[idx++] = (byte) ((n & 0x7F) | 0x80); + n >>= 7; + } + + return new Tuple(i32Buf, idx); + } + + public override async Task WriteI32Async(int i32, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bufferTuple = CreateWriteVarInt32(IntToZigzag(i32)); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + } + + protected internal Tuple CreateWriteVarInt64(ulong n) + { + // Write an i64 as a varint. Results in 1-10 bytes on the wire. + var buf = new byte[10]; + var idx = 0; + + while (true) + { + if ((n & ~(ulong) 0x7FL) == 0) + { + buf[idx++] = (byte) n; + break; + } + buf[idx++] = (byte) ((n & 0x7F) | 0x80); + n >>= 7; + } + + return new Tuple(buf, idx); + } + + public override async Task WriteI64Async(long i64, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bufferTuple = CreateWriteVarInt64(LongToZigzag(i64)); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + } + + public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var data = new byte[8]; + FixedLongToBytes(BitConverter.DoubleToInt64Bits(d), data, 0); + await Trans.WriteAsync(data, cancellationToken); + } + + public override async Task WriteStringAsync(string str, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bytes = Encoding.UTF8.GetBytes(str); + + var bufferTuple = CreateWriteVarInt32((uint) bytes.Length); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + await Trans.WriteAsync(bytes, 0, bytes.Length, cancellationToken); + } + + public override async Task WriteBinaryAsync(byte[] b, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + var bufferTuple = CreateWriteVarInt32((uint) b.Length); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + await Trans.WriteAsync(b, 0, b.Length, cancellationToken); + } + + public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return; + } + + if (map.Count == 0) + { + await Trans.WriteAsync(new[] {(byte) 0}, cancellationToken); + } + else + { + var bufferTuple = CreateWriteVarInt32((uint) map.Count); + await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken); + await + Trans.WriteAsync( + new[] {(byte) ((GetCompactType(map.KeyType) << 4) | GetCompactType(map.ValueType))}, + cancellationToken); + } + } + + public override async Task WriteMapEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadMessageBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var protocolId = (byte) await ReadByteAsync(cancellationToken); + if (protocolId != ProtocolId) + { + throw new TProtocolException($"Expected protocol id {ProtocolId:X} but got {protocolId:X}"); + } + + var versionAndType = (byte) await ReadByteAsync(cancellationToken); + var version = (byte) (versionAndType & VersionMask); + + if (version != Version) + { + throw new TProtocolException($"Expected version {Version} but got {version}"); + } + + var type = (byte) ((versionAndType >> TypeShiftAmount) & TypeBits); + var seqid = (int) await ReadVarInt32Async(cancellationToken); + var messageName = await ReadStringAsync(cancellationToken); + + return new TMessage(messageName, (TMessageType) type, seqid); + } + + public override async Task ReadMessageEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadStructBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + // some magic is here ) + + _lastField.Push(_lastFieldId); + _lastFieldId = 0; + + return AnonymousStruct; + } + + public override async Task ReadStructEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + /* + Doesn't actually consume any wire data, just removes the last field for + this struct from the field stack. + */ + + // consume the last field we Read off the wire. + _lastFieldId = _lastField.Pop(); + } + + public override async Task ReadFieldBeginAsync(CancellationToken cancellationToken) + { + // Read a field header off the wire. + var type = (byte) await ReadByteAsync(cancellationToken); + // if it's a stop, then we can return immediately, as the struct is over. + if (type == Types.Stop) + { + return Tstop; + } + + short fieldId; + // mask off the 4 MSB of the exType header. it could contain a field id delta. + var modifier = (short) ((type & 0xf0) >> 4); + if (modifier == 0) + { + fieldId = await ReadI16Async(cancellationToken); + } + else + { + fieldId = (short) (_lastFieldId + modifier); + } + + var field = new TField(string.Empty, GetTType((byte) (type & 0x0f)), fieldId); + // if this happens to be a boolean field, the value is encoded in the exType + if (IsBoolType(type)) + { + _boolValue = (byte) (type & 0x0f) == Types.BooleanTrue; + } + + // push the new field onto the field stack so we can keep the deltas going. + _lastFieldId = field.ID; + return field; + } + + public override async Task ReadFieldEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadMapBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + /* + Read a map header off the wire. If the size is zero, skip Reading the key + and value exType. This means that 0-length maps will yield TMaps without the + "correct" types. + */ + + var size = (int) await ReadVarInt32Async(cancellationToken); + var keyAndValueType = size == 0 ? (byte) 0 : (byte) await ReadByteAsync(cancellationToken); + return new TMap(GetTType((byte) (keyAndValueType >> 4)), GetTType((byte) (keyAndValueType & 0xf)), size); + } + + public override async Task ReadMapEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadSetBeginAsync(CancellationToken cancellationToken) + { + /* + Read a set header off the wire. If the set size is 0-14, the size will + be packed into the element exType header. If it's a longer set, the 4 MSB + of the element exType header will be 0xF, and a varint will follow with the + true size. + */ + + return new TSet(await ReadListBeginAsync(cancellationToken)); + } + + public override async Task ReadBoolAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + /* + Read a boolean off the wire. If this is a boolean field, the value should + already have been Read during ReadFieldBegin, so we'll just consume the + pre-stored value. Otherwise, Read a byte. + */ + + if (_boolValue != null) + { + var result = _boolValue.Value; + _boolValue = null; + return result; + } + + return await ReadByteAsync(cancellationToken) == Types.BooleanTrue; + } + + public override async Task ReadByteAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + // Read a single byte off the wire. Nothing interesting here. + var buf = new byte[1]; + await Trans.ReadAllAsync(buf, 0, 1, cancellationToken); + return (sbyte) buf[0]; + } + + public override async Task ReadI16Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + return (short) ZigzagToInt(await ReadVarInt32Async(cancellationToken)); + } + + public override async Task ReadI32Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + return ZigzagToInt(await ReadVarInt32Async(cancellationToken)); + } + + public override async Task ReadI64Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + return ZigzagToLong(await ReadVarInt64Async(cancellationToken)); + } + + public override async Task ReadDoubleAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var longBits = new byte[8]; + await Trans.ReadAllAsync(longBits, 0, 8, cancellationToken); + + return BitConverter.Int64BitsToDouble(BytesToLong(longBits)); + } + + public override async Task ReadStringAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + // Reads a byte[] (via ReadBinary), and then UTF-8 decodes it. + var length = (int) await ReadVarInt32Async(cancellationToken); + + if (length == 0) + { + return string.Empty; + } + + var buf = new byte[length]; + await Trans.ReadAllAsync(buf, 0, length, cancellationToken); + + return Encoding.UTF8.GetString(buf); + } + + public override async Task ReadBinaryAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + // Read a byte[] from the wire. + var length = (int) await ReadVarInt32Async(cancellationToken); + if (length == 0) + { + return new byte[0]; + } + + var buf = new byte[length]; + await Trans.ReadAllAsync(buf, 0, length, cancellationToken); + return buf; + } + + public override async Task ReadListBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + /* + Read a list header off the wire. If the list size is 0-14, the size will + be packed into the element exType header. If it's a longer list, the 4 MSB + of the element exType header will be 0xF, and a varint will follow with the + true size. + */ + + var sizeAndType = (byte) await ReadByteAsync(cancellationToken); + var size = (sizeAndType >> 4) & 0x0f; + if (size == 15) + { + size = (int) await ReadVarInt32Async(cancellationToken); + } + + var type = GetTType(sizeAndType); + return new TList(type, size); + } + + public override async Task ReadListEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task ReadSetEndAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + private static byte GetCompactType(TType ttype) + { + // Given a TType value, find the appropriate TCompactProtocol.Types constant. + return TTypeToCompactType[(int) ttype]; + } + + + private async Task ReadVarInt32Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + /* + Read an i32 from the wire as a varint. The MSB of each byte is set + if there is another byte to follow. This can Read up to 5 bytes. + */ + + uint result = 0; + var shift = 0; + + while (true) + { + var b = (byte) await ReadByteAsync(cancellationToken); + result |= (uint) (b & 0x7f) << shift; + if ((b & 0x80) != 0x80) + { + break; + } + shift += 7; + } + + return result; + } + + private async Task ReadVarInt64Async(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + /* + Read an i64 from the wire as a proper varint. The MSB of each byte is set + if there is another byte to follow. This can Read up to 10 bytes. + */ + + var shift = 0; + ulong result = 0; + while (true) + { + var b = (byte) await ReadByteAsync(cancellationToken); + result |= (ulong) (b & 0x7f) << shift; + if ((b & 0x80) != 0x80) + { + break; + } + shift += 7; + } + + return result; + } + + private static int ZigzagToInt(uint n) + { + return (int) (n >> 1) ^ -(int) (n & 1); + } + + private static long ZigzagToLong(ulong n) + { + return (long) (n >> 1) ^ -(long) (n & 1); + } + + private static long BytesToLong(byte[] bytes) + { + /* + Note that it's important that the mask bytes are long literals, + otherwise they'll default to ints, and when you shift an int left 56 bits, + you just get a messed up int. + */ + + return + ((bytes[7] & 0xffL) << 56) | + ((bytes[6] & 0xffL) << 48) | + ((bytes[5] & 0xffL) << 40) | + ((bytes[4] & 0xffL) << 32) | + ((bytes[3] & 0xffL) << 24) | + ((bytes[2] & 0xffL) << 16) | + ((bytes[1] & 0xffL) << 8) | + (bytes[0] & 0xffL); + } + + private static bool IsBoolType(byte b) + { + var lowerNibble = b & 0x0f; + return (lowerNibble == Types.BooleanTrue) || (lowerNibble == Types.BooleanFalse); + } + + private static TType GetTType(byte type) + { + // Given a TCompactProtocol.Types constant, convert it to its corresponding TType value. + switch ((byte) (type & 0x0f)) + { + case Types.Stop: + return TType.Stop; + case Types.BooleanFalse: + case Types.BooleanTrue: + return TType.Bool; + case Types.Byte: + return TType.Byte; + case Types.I16: + return TType.I16; + case Types.I32: + return TType.I32; + case Types.I64: + return TType.I64; + case Types.Double: + return TType.Double; + case Types.Binary: + return TType.String; + case Types.List: + return TType.List; + case Types.Set: + return TType.Set; + case Types.Map: + return TType.Map; + case Types.Struct: + return TType.Struct; + default: + throw new TProtocolException($"Don't know what exType: {(byte) (type & 0x0f)}"); + } + } + + private static ulong LongToZigzag(long n) + { + // Convert l into a zigzag long. This allows negative numbers to be represented compactly as a varint + return (ulong) (n << 1) ^ (ulong) (n >> 63); + } + + private static uint IntToZigzag(int n) + { + // Convert n into a zigzag int. This allows negative numbers to be represented compactly as a varint + return (uint) (n << 1) ^ (uint) (n >> 31); + } + + private static void FixedLongToBytes(long n, byte[] buf, int off) + { + // Convert a long into little-endian bytes in buf starting at off and going until off+7. + buf[off + 0] = (byte) (n & 0xff); + buf[off + 1] = (byte) ((n >> 8) & 0xff); + buf[off + 2] = (byte) ((n >> 16) & 0xff); + buf[off + 3] = (byte) ((n >> 24) & 0xff); + buf[off + 4] = (byte) ((n >> 32) & 0xff); + buf[off + 5] = (byte) ((n >> 40) & 0xff); + buf[off + 6] = (byte) ((n >> 48) & 0xff); + buf[off + 7] = (byte) ((n >> 56) & 0xff); + } + + public class Factory : ITProtocolFactory + { + public TProtocol GetProtocol(TClientTransport trans) + { + return new TCompactProtocol(trans); + } + } + + /// + /// All of the on-wire exType codes. + /// + private static class Types + { + public const byte Stop = 0x00; + public const byte BooleanTrue = 0x01; + public const byte BooleanFalse = 0x02; + public const byte Byte = 0x03; + public const byte I16 = 0x04; + public const byte I32 = 0x05; + public const byte I64 = 0x06; + public const byte Double = 0x07; + public const byte Binary = 0x08; + public const byte List = 0x09; + public const byte Set = 0x0A; + public const byte Map = 0x0B; + public const byte Struct = 0x0C; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs b/lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs new file mode 100644 index 00000000000..a4ddd5b28fd --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs @@ -0,0 +1,1170 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; + +namespace Thrift.Protocols +{ + //TODO: implementation of TProtocol + + /// + /// JSON protocol implementation for thrift. + /// This is a full-featured protocol supporting Write and Read. + /// Please see the C++ class header for a detailed description of the + /// protocol's wire format. + /// Adapted from the Java version. + /// + // ReSharper disable once InconsistentNaming + public class TJsonProtocol : TProtocol + { + private const long Version = 1; + + private const int DefStringSize = 16; + + private static readonly byte[] Comma = {(byte) ','}; + private static readonly byte[] Colon = {(byte) ':'}; + private static readonly byte[] Lbrace = {(byte) '{'}; + private static readonly byte[] Rbrace = {(byte) '}'}; + private static readonly byte[] Lbracket = {(byte) '['}; + private static readonly byte[] Rbracket = {(byte) ']'}; + private static readonly byte[] Quote = {(byte) '"'}; + private static readonly byte[] Backslash = {(byte) '\\'}; + + private static readonly byte[] NameBool = {(byte) 't', (byte) 'f'}; + private static readonly byte[] NameByte = {(byte) 'i', (byte) '8'}; + private static readonly byte[] NameI16 = {(byte) 'i', (byte) '1', (byte) '6'}; + private static readonly byte[] NameI32 = {(byte) 'i', (byte) '3', (byte) '2'}; + private static readonly byte[] NameI64 = {(byte) 'i', (byte) '6', (byte) '4'}; + private static readonly byte[] NameDouble = {(byte) 'd', (byte) 'b', (byte) 'l'}; + private static readonly byte[] NameStruct = {(byte) 'r', (byte) 'e', (byte) 'c'}; + private static readonly byte[] NameString = {(byte) 's', (byte) 't', (byte) 'r'}; + private static readonly byte[] NameMap = {(byte) 'm', (byte) 'a', (byte) 'p'}; + private static readonly byte[] NameList = {(byte) 'l', (byte) 's', (byte) 't'}; + private static readonly byte[] NameSet = {(byte) 's', (byte) 'e', (byte) 't'}; + + private readonly char[] _escapeChars = "\"\\/bfnrt".ToCharArray(); + + private readonly byte[] _escapeCharVals = + { + (byte) '"', (byte) '\\', (byte) '/', (byte) '\b', (byte) '\f', (byte) '\n', (byte) '\r', (byte) '\t' + }; + + private readonly byte[] _escseq = {(byte) '\\', (byte) 'u', (byte) '0', (byte) '0'}; + + private readonly byte[] _jsonCharTable = + { + 0, 0, 0, 0, 0, 0, 0, 0, (byte) 'b', (byte) 't', (byte) 'n', 0, (byte) 'f', (byte) 'r', 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, (byte) '"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + + // Temporary buffer used by several methods + private readonly byte[] _tempBuffer = new byte[4]; + + // Current context that we are in + protected JsonBaseContext Context; + + // Stack of nested contexts that we may be in + protected Stack ContextStack = new Stack(); + + // Reader that manages a 1-byte buffer + protected LookaheadReader Reader; + + // Default encoding + protected Encoding Utf8Encoding = Encoding.UTF8; + + /// + /// TJsonProtocol Constructor + /// + public TJsonProtocol(TClientTransport trans) + : base(trans) + { + //throw new NotImplementedException("TJsonProtocol is not fully ready for usage"); + + Context = new JsonBaseContext(this); + Reader = new LookaheadReader(this); + } + + private static byte[] GetTypeNameForTypeId(TType typeId) + { + switch (typeId) + { + case TType.Bool: + return NameBool; + case TType.Byte: + return NameByte; + case TType.I16: + return NameI16; + case TType.I32: + return NameI32; + case TType.I64: + return NameI64; + case TType.Double: + return NameDouble; + case TType.String: + return NameString; + case TType.Struct: + return NameStruct; + case TType.Map: + return NameMap; + case TType.Set: + return NameSet; + case TType.List: + return NameList; + default: + throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized exType"); + } + } + + private static TType GetTypeIdForTypeName(byte[] name) + { + var result = TType.Stop; + if (name.Length > 1) + { + switch (name[0]) + { + case (byte) 'd': + result = TType.Double; + break; + case (byte) 'i': + switch (name[1]) + { + case (byte) '8': + result = TType.Byte; + break; + case (byte) '1': + result = TType.I16; + break; + case (byte) '3': + result = TType.I32; + break; + case (byte) '6': + result = TType.I64; + break; + } + break; + case (byte) 'l': + result = TType.List; + break; + case (byte) 'm': + result = TType.Map; + break; + case (byte) 'r': + result = TType.Struct; + break; + case (byte) 's': + if (name[1] == (byte) 't') + { + result = TType.String; + } + else if (name[1] == (byte) 'e') + { + result = TType.Set; + } + break; + case (byte) 't': + result = TType.Bool; + break; + } + } + if (result == TType.Stop) + { + throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized exType"); + } + return result; + } + + /// + /// Push a new JSON context onto the stack. + /// + protected void PushContext(JsonBaseContext c) + { + ContextStack.Push(Context); + Context = c; + } + + /// + /// Pop the last JSON context off the stack + /// + protected void PopContext() + { + Context = ContextStack.Pop(); + } + + /// + /// Read a byte that must match b[0]; otherwise an exception is thrown. + /// Marked protected to avoid synthetic accessor in JSONListContext.Read + /// and JSONPairContext.Read + /// + protected async Task ReadJsonSyntaxCharAsync(byte[] b, CancellationToken cancellationToken) + { + var ch = await Reader.ReadAsync(cancellationToken); + if (ch != b[0]) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, $"Unexpected character: {(char) ch}"); + } + } + + /// + /// Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its + /// corresponding hex value + /// + private static byte HexVal(byte ch) + { + if ((ch >= '0') && (ch <= '9')) + { + return (byte) ((char) ch - '0'); + } + + if ((ch >= 'a') && (ch <= 'f')) + { + ch += 10; + return (byte) ((char) ch - 'a'); + } + + throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected hex character"); + } + + /// + /// Convert a byte containing a hex value to its corresponding hex character + /// + private static byte HexChar(byte val) + { + val &= 0x0F; + if (val < 10) + { + return (byte) ((char) val + '0'); + } + val -= 10; + return (byte) ((char) val + 'a'); + } + + /// + /// Write the bytes in array buf as a JSON characters, escaping as needed + /// + private async Task WriteJsonStringAsync(byte[] b, CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + await Trans.WriteAsync(Quote, cancellationToken); + + var len = b.Length; + for (var i = 0; i < len; i++) + { + if ((b[i] & 0x00FF) >= 0x30) + { + if (b[i] == Backslash[0]) + { + await Trans.WriteAsync(Backslash, cancellationToken); + await Trans.WriteAsync(Backslash, cancellationToken); + } + else + { + await Trans.WriteAsync(b, i, 1, cancellationToken); + } + } + else + { + _tempBuffer[0] = _jsonCharTable[b[i]]; + if (_tempBuffer[0] == 1) + { + await Trans.WriteAsync(b, i, 1, cancellationToken); + } + else if (_tempBuffer[0] > 1) + { + await Trans.WriteAsync(Backslash, cancellationToken); + await Trans.WriteAsync(_tempBuffer, 0, 1, cancellationToken); + } + else + { + await Trans.WriteAsync(_escseq, cancellationToken); + _tempBuffer[0] = HexChar((byte) (b[i] >> 4)); + _tempBuffer[1] = HexChar(b[i]); + await Trans.WriteAsync(_tempBuffer, 0, 2, cancellationToken); + } + } + } + await Trans.WriteAsync(Quote, cancellationToken); + } + + /// + /// Write out number as a JSON value. If the context dictates so, it will be + /// wrapped in quotes to output as a JSON string. + /// + private async Task WriteJsonIntegerAsync(long num, CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + var str = num.ToString(); + + var escapeNum = Context.EscapeNumbers(); + if (escapeNum) + { + await Trans.WriteAsync(Quote, cancellationToken); + } + + await Trans.WriteAsync(Utf8Encoding.GetBytes(str), cancellationToken); + + if (escapeNum) + { + await Trans.WriteAsync(Quote, cancellationToken); + } + } + + /// + /// Write out a double as a JSON value. If it is NaN or infinity or if the + /// context dictates escaping, Write out as JSON string. + /// + private async Task WriteJsonDoubleAsync(double num, CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + var str = num.ToString("G17", CultureInfo.InvariantCulture); + var special = false; + + switch (str[0]) + { + case 'N': // NaN + case 'I': // Infinity + special = true; + break; + case '-': + if (str[1] == 'I') + { + // -Infinity + special = true; + } + break; + } + + var escapeNum = special || Context.EscapeNumbers(); + + if (escapeNum) + { + await Trans.WriteAsync(Quote, cancellationToken); + } + + await Trans.WriteAsync(Utf8Encoding.GetBytes(str), cancellationToken); + + if (escapeNum) + { + await Trans.WriteAsync(Quote, cancellationToken); + } + } + + /// + /// Write out contents of byte array b as a JSON string with base-64 encoded + /// data + /// + private async Task WriteJsonBase64Async(byte[] b, CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + await Trans.WriteAsync(Quote, cancellationToken); + + var len = b.Length; + var off = 0; + + // Ignore padding + var bound = len >= 2 ? len - 2 : 0; + + for (var i = len - 1; i >= bound && b[i] == '='; --i) + { + --len; + } + + while (len >= 3) + { + // Encode 3 bytes at a time + TBase64Utils.Encode(b, off, 3, _tempBuffer, 0); + await Trans.WriteAsync(_tempBuffer, 0, 4, cancellationToken); + off += 3; + len -= 3; + } + + if (len > 0) + { + // Encode remainder + TBase64Utils.Encode(b, off, len, _tempBuffer, 0); + await Trans.WriteAsync(_tempBuffer, 0, len + 1, cancellationToken); + } + + await Trans.WriteAsync(Quote, cancellationToken); + } + + private async Task WriteJsonObjectStartAsync(CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + await Trans.WriteAsync(Lbrace, cancellationToken); + PushContext(new JsonPairContext(this)); + } + + private async Task WriteJsonObjectEndAsync(CancellationToken cancellationToken) + { + PopContext(); + await Trans.WriteAsync(Rbrace, cancellationToken); + } + + private async Task WriteJsonArrayStartAsync(CancellationToken cancellationToken) + { + await Context.WriteAsync(cancellationToken); + await Trans.WriteAsync(Lbracket, cancellationToken); + PushContext(new JsonListContext(this)); + } + + private async Task WriteJsonArrayEndAsync(CancellationToken cancellationToken) + { + PopContext(); + await Trans.WriteAsync(Rbracket, cancellationToken); + } + + public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken) + { + await WriteJsonArrayStartAsync(cancellationToken); + await WriteJsonIntegerAsync(Version, cancellationToken); + + var b = Utf8Encoding.GetBytes(message.Name); + await WriteJsonStringAsync(b, cancellationToken); + + await WriteJsonIntegerAsync((long) message.Type, cancellationToken); + await WriteJsonIntegerAsync(message.SeqID, cancellationToken); + } + + public override async Task WriteMessageEndAsync(CancellationToken cancellationToken) + { + await WriteJsonArrayEndAsync(cancellationToken); + } + + public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) + { + await WriteJsonObjectStartAsync(cancellationToken); + } + + public override async Task WriteStructEndAsync(CancellationToken cancellationToken) + { + await WriteJsonObjectEndAsync(cancellationToken); + } + + public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(field.ID, cancellationToken); + await WriteJsonObjectStartAsync(cancellationToken); + await WriteJsonStringAsync(GetTypeNameForTypeId(field.Type), cancellationToken); + } + + public override async Task WriteFieldEndAsync(CancellationToken cancellationToken) + { + await WriteJsonObjectEndAsync(cancellationToken); + } + + public override async Task WriteFieldStopAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken) + { + await WriteJsonArrayStartAsync(cancellationToken); + await WriteJsonStringAsync(GetTypeNameForTypeId(map.KeyType), cancellationToken); + await WriteJsonStringAsync(GetTypeNameForTypeId(map.ValueType), cancellationToken); + await WriteJsonIntegerAsync(map.Count, cancellationToken); + await WriteJsonObjectStartAsync(cancellationToken); + } + + public override async Task WriteMapEndAsync(CancellationToken cancellationToken) + { + await WriteJsonObjectEndAsync(cancellationToken); + await WriteJsonArrayEndAsync(cancellationToken); + } + + public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken) + { + await WriteJsonArrayStartAsync(cancellationToken); + await WriteJsonStringAsync(GetTypeNameForTypeId(list.ElementType), cancellationToken); + await WriteJsonIntegerAsync(list.Count, cancellationToken); + } + + public override async Task WriteListEndAsync(CancellationToken cancellationToken) + { + await WriteJsonArrayEndAsync(cancellationToken); + } + + public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken) + { + await WriteJsonArrayStartAsync(cancellationToken); + await WriteJsonStringAsync(GetTypeNameForTypeId(set.ElementType), cancellationToken); + await WriteJsonIntegerAsync(set.Count, cancellationToken); + } + + public override async Task WriteSetEndAsync(CancellationToken cancellationToken) + { + await WriteJsonArrayEndAsync(cancellationToken); + } + + public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(b ? 1 : 0, cancellationToken); + } + + public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(b, cancellationToken); + } + + public override async Task WriteI16Async(short i16, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(i16, cancellationToken); + } + + public override async Task WriteI32Async(int i32, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(i32, cancellationToken); + } + + public override async Task WriteI64Async(long i64, CancellationToken cancellationToken) + { + await WriteJsonIntegerAsync(i64, cancellationToken); + } + + public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken) + { + await WriteJsonDoubleAsync(d, cancellationToken); + } + + public override async Task WriteStringAsync(string s, CancellationToken cancellationToken) + { + var b = Utf8Encoding.GetBytes(s); + await WriteJsonStringAsync(b, cancellationToken); + } + + public override async Task WriteBinaryAsync(byte[] b, CancellationToken cancellationToken) + { + await WriteJsonBase64Async(b, cancellationToken); + } + + /// + /// Read in a JSON string, unescaping as appropriate.. Skip Reading from the + /// context if skipContext is true. + /// + private async Task ReadJsonStringAsync(bool skipContext, CancellationToken cancellationToken) + { + using (var buffer = new MemoryStream()) + { + var codeunits = new List(); + + + if (!skipContext) + { + await Context.ReadAsync(cancellationToken); + } + + await ReadJsonSyntaxCharAsync(Quote, cancellationToken); + + while (true) + { + var ch = await Reader.ReadAsync(cancellationToken); + if (ch == Quote[0]) + { + break; + } + + // escaped? + if (ch != _escseq[0]) + { + await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken); + continue; + } + + // distinguish between \uXXXX and \? + ch = await Reader.ReadAsync(cancellationToken); + if (ch != _escseq[1]) // control chars like \n + { + var off = Array.IndexOf(_escapeChars, (char) ch); + if (off == -1) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected control char"); + } + ch = _escapeCharVals[off]; + await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken); + continue; + } + + + // it's \uXXXX + await Trans.ReadAllAsync(_tempBuffer, 0, 4, cancellationToken); + + var wch = (short) ((HexVal(_tempBuffer[0]) << 12) + + (HexVal(_tempBuffer[1]) << 8) + + (HexVal(_tempBuffer[2]) << 4) + + HexVal(_tempBuffer[3])); + + if (char.IsHighSurrogate((char) wch)) + { + if (codeunits.Count > 0) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char"); + } + codeunits.Add((char) wch); + } + else if (char.IsLowSurrogate((char) wch)) + { + if (codeunits.Count == 0) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected high surrogate char"); + } + + codeunits.Add((char) wch); + var tmp = Utf8Encoding.GetBytes(codeunits.ToArray()); + await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken); + codeunits.Clear(); + } + else + { + var tmp = Utf8Encoding.GetBytes(new[] {(char) wch}); + await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken); + } + } + + if (codeunits.Count > 0) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char"); + } + + return buffer.ToArray(); + } + } + + /// + /// Return true if the given byte could be a valid part of a JSON number. + /// + private static bool IsJsonNumeric(byte b) + { + switch (b) + { + case (byte) '+': + case (byte) '-': + case (byte) '.': + case (byte) '0': + case (byte) '1': + case (byte) '2': + case (byte) '3': + case (byte) '4': + case (byte) '5': + case (byte) '6': + case (byte) '7': + case (byte) '8': + case (byte) '9': + case (byte) 'E': + case (byte) 'e': + return true; + } + + return false; + } + + /// + /// Read in a sequence of characters that are all valid in JSON numbers. Does + /// not do a complete regex check to validate that this is actually a number. + /// + private async Task ReadJsonNumericCharsAsync(CancellationToken cancellationToken) + { + var strbld = new StringBuilder(); + while (true) + { + var ch = await Reader.PeekAsync(cancellationToken); + if (!IsJsonNumeric(ch)) + { + break; + } + strbld.Append((char) await Reader.ReadAsync(cancellationToken)); + } + return strbld.ToString(); + } + + /// + /// Read in a JSON number. If the context dictates, Read in enclosing quotes. + /// + private async Task ReadJsonIntegerAsync(CancellationToken cancellationToken) + { + await Context.ReadAsync(cancellationToken); + if (Context.EscapeNumbers()) + { + await ReadJsonSyntaxCharAsync(Quote, cancellationToken); + } + + var str = await ReadJsonNumericCharsAsync(cancellationToken); + if (Context.EscapeNumbers()) + { + await ReadJsonSyntaxCharAsync(Quote, cancellationToken); + } + + try + { + return long.Parse(str); + } + catch (FormatException) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Bad data encounted in numeric data"); + } + } + + /// + /// Read in a JSON double value. Throw if the value is not wrapped in quotes + /// when expected or if wrapped in quotes when not expected. + /// + private async Task ReadJsonDoubleAsync(CancellationToken cancellationToken) + { + await Context.ReadAsync(cancellationToken); + if (await Reader.PeekAsync(cancellationToken) == Quote[0]) + { + var arr = await ReadJsonStringAsync(true, cancellationToken); + var dub = double.Parse(Utf8Encoding.GetString(arr, 0, arr.Length), CultureInfo.InvariantCulture); + + if (!Context.EscapeNumbers() && !double.IsNaN(dub) && !double.IsInfinity(dub)) + { + // Throw exception -- we should not be in a string in this case + throw new TProtocolException(TProtocolException.INVALID_DATA, "Numeric data unexpectedly quoted"); + } + + return dub; + } + + if (Context.EscapeNumbers()) + { + // This will throw - we should have had a quote if escapeNum == true + await ReadJsonSyntaxCharAsync(Quote, cancellationToken); + } + + try + { + return double.Parse(await ReadJsonNumericCharsAsync(cancellationToken), CultureInfo.InvariantCulture); + } + catch (FormatException) + { + throw new TProtocolException(TProtocolException.INVALID_DATA, "Bad data encounted in numeric data"); + } + } + + /// + /// Read in a JSON string containing base-64 encoded data and decode it. + /// + private async Task ReadJsonBase64Async(CancellationToken cancellationToken) + { + var b = await ReadJsonStringAsync(false, cancellationToken); + var len = b.Length; + var off = 0; + var size = 0; + + // reduce len to ignore fill bytes + while ((len > 0) && (b[len - 1] == '=')) + { + --len; + } + + // read & decode full byte triplets = 4 source bytes + while (len > 4) + { + // Decode 4 bytes at a time + TBase64Utils.Decode(b, off, 4, b, size); // NB: decoded in place + off += 4; + len -= 4; + size += 3; + } + + // Don't decode if we hit the end or got a single leftover byte (invalid + // base64 but legal for skip of regular string exType) + if (len > 1) + { + // Decode remainder + TBase64Utils.Decode(b, off, len, b, size); // NB: decoded in place + size += len - 1; + } + + // Sadly we must copy the byte[] (any way around this?) + var result = new byte[size]; + Array.Copy(b, 0, result, 0, size); + return result; + } + + private async Task ReadJsonObjectStartAsync(CancellationToken cancellationToken) + { + await Context.ReadAsync(cancellationToken); + await ReadJsonSyntaxCharAsync(Lbrace, cancellationToken); + PushContext(new JsonPairContext(this)); + } + + private async Task ReadJsonObjectEndAsync(CancellationToken cancellationToken) + { + await ReadJsonSyntaxCharAsync(Rbrace, cancellationToken); + PopContext(); + } + + private async Task ReadJsonArrayStartAsync(CancellationToken cancellationToken) + { + await Context.ReadAsync(cancellationToken); + await ReadJsonSyntaxCharAsync(Lbracket, cancellationToken); + PushContext(new JsonListContext(this)); + } + + private async Task ReadJsonArrayEndAsync(CancellationToken cancellationToken) + { + await ReadJsonSyntaxCharAsync(Rbracket, cancellationToken); + PopContext(); + } + + public override async Task ReadMessageBeginAsync(CancellationToken cancellationToken) + { + var message = new TMessage(); + await ReadJsonArrayStartAsync(cancellationToken); + if (await ReadJsonIntegerAsync(cancellationToken) != Version) + { + throw new TProtocolException(TProtocolException.BAD_VERSION, "Message contained bad version."); + } + + var buf = await ReadJsonStringAsync(false, cancellationToken); + message.Name = Utf8Encoding.GetString(buf, 0, buf.Length); + message.Type = (TMessageType) await ReadJsonIntegerAsync(cancellationToken); + message.SeqID = (int) await ReadJsonIntegerAsync(cancellationToken); + return message; + } + + public override async Task ReadMessageEndAsync(CancellationToken cancellationToken) + { + await ReadJsonArrayEndAsync(cancellationToken); + } + + public override async Task ReadStructBeginAsync(CancellationToken cancellationToken) + { + await ReadJsonObjectStartAsync(cancellationToken); + return new TStruct(); + } + + public override async Task ReadStructEndAsync(CancellationToken cancellationToken) + { + await ReadJsonObjectEndAsync(cancellationToken); + } + + public override async Task ReadFieldBeginAsync(CancellationToken cancellationToken) + { + var field = new TField(); + var ch = await Reader.PeekAsync(cancellationToken); + if (ch == Rbrace[0]) + { + field.Type = TType.Stop; + } + else + { + field.ID = (short) await ReadJsonIntegerAsync(cancellationToken); + await ReadJsonObjectStartAsync(cancellationToken); + field.Type = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken)); + } + return field; + } + + public override async Task ReadFieldEndAsync(CancellationToken cancellationToken) + { + await ReadJsonObjectEndAsync(cancellationToken); + } + + public override async Task ReadMapBeginAsync(CancellationToken cancellationToken) + { + var map = new TMap(); + await ReadJsonArrayStartAsync(cancellationToken); + map.KeyType = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken)); + map.ValueType = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken)); + map.Count = (int) await ReadJsonIntegerAsync(cancellationToken); + await ReadJsonObjectStartAsync(cancellationToken); + return map; + } + + public override async Task ReadMapEndAsync(CancellationToken cancellationToken) + { + await ReadJsonObjectEndAsync(cancellationToken); + await ReadJsonArrayEndAsync(cancellationToken); + } + + public override async Task ReadListBeginAsync(CancellationToken cancellationToken) + { + var list = new TList(); + await ReadJsonArrayStartAsync(cancellationToken); + list.ElementType = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken)); + list.Count = (int) await ReadJsonIntegerAsync(cancellationToken); + return list; + } + + public override async Task ReadListEndAsync(CancellationToken cancellationToken) + { + await ReadJsonArrayEndAsync(cancellationToken); + } + + public override async Task ReadSetBeginAsync(CancellationToken cancellationToken) + { + var set = new TSet(); + await ReadJsonArrayStartAsync(cancellationToken); + set.ElementType = GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken)); + set.Count = (int) await ReadJsonIntegerAsync(cancellationToken); + return set; + } + + public override async Task ReadSetEndAsync(CancellationToken cancellationToken) + { + await ReadJsonArrayEndAsync(cancellationToken); + } + + public override async Task ReadBoolAsync(CancellationToken cancellationToken) + { + return await ReadJsonIntegerAsync(cancellationToken) != 0; + } + + public override async Task ReadByteAsync(CancellationToken cancellationToken) + { + return (sbyte) await ReadJsonIntegerAsync(cancellationToken); + } + + public override async Task ReadI16Async(CancellationToken cancellationToken) + { + return (short) await ReadJsonIntegerAsync(cancellationToken); + } + + public override async Task ReadI32Async(CancellationToken cancellationToken) + { + return (int) await ReadJsonIntegerAsync(cancellationToken); + } + + public override async Task ReadI64Async(CancellationToken cancellationToken) + { + return await ReadJsonIntegerAsync(cancellationToken); + } + + public override async Task ReadDoubleAsync(CancellationToken cancellationToken) + { + return await ReadJsonDoubleAsync(cancellationToken); + } + + public override async Task ReadStringAsync(CancellationToken cancellationToken) + { + var buf = await ReadJsonStringAsync(false, cancellationToken); + return Utf8Encoding.GetString(buf, 0, buf.Length); + } + + public override async Task ReadBinaryAsync(CancellationToken cancellationToken) + { + return await ReadJsonBase64Async(cancellationToken); + } + + /// + /// Factory for JSON protocol objects + /// + public class Factory : ITProtocolFactory + { + public TProtocol GetProtocol(TClientTransport trans) + { + return new TJsonProtocol(trans); + } + } + + /// + /// Base class for tracking JSON contexts that may require + /// inserting/Reading additional JSON syntax characters + /// This base context does nothing. + /// + protected class JsonBaseContext + { + protected TJsonProtocol Proto; + + public JsonBaseContext(TJsonProtocol proto) + { + Proto = proto; + } + + public virtual async Task WriteAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public virtual async Task ReadAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public virtual bool EscapeNumbers() + { + return false; + } + } + + /// + /// Context for JSON lists. Will insert/Read commas before each item except + /// for the first one + /// + protected class JsonListContext : JsonBaseContext + { + private bool _first = true; + + public JsonListContext(TJsonProtocol protocol) + : base(protocol) + { + } + + public override async Task WriteAsync(CancellationToken cancellationToken) + { + if (_first) + { + _first = false; + } + else + { + await Proto.Trans.WriteAsync(Comma, cancellationToken); + } + } + + public override async Task ReadAsync(CancellationToken cancellationToken) + { + if (_first) + { + _first = false; + } + else + { + await Proto.ReadJsonSyntaxCharAsync(Comma, cancellationToken); + } + } + } + + /// + /// Context for JSON records. Will insert/Read colons before the value portion + /// of each record pair, and commas before each key except the first. In + /// addition, will indicate that numbers in the key position need to be + /// escaped in quotes (since JSON keys must be strings). + /// + protected class JsonPairContext : JsonBaseContext + { + private bool _colon = true; + + private bool _first = true; + + public JsonPairContext(TJsonProtocol proto) + : base(proto) + { + } + + public override async Task WriteAsync(CancellationToken cancellationToken) + { + if (_first) + { + _first = false; + _colon = true; + } + else + { + await Proto.Trans.WriteAsync(_colon ? Colon : Comma, cancellationToken); + _colon = !_colon; + } + } + + public override async Task ReadAsync(CancellationToken cancellationToken) + { + if (_first) + { + _first = false; + _colon = true; + } + else + { + await Proto.ReadJsonSyntaxCharAsync(_colon ? Colon : Comma, cancellationToken); + _colon = !_colon; + } + } + + public override bool EscapeNumbers() + { + return _colon; + } + } + + /// + /// Holds up to one byte from the transport + /// + protected class LookaheadReader + { + private readonly byte[] _data = new byte[1]; + + private bool _hasData; + protected TJsonProtocol Proto; + + public LookaheadReader(TJsonProtocol proto) + { + Proto = proto; + } + + /// + /// Return and consume the next byte to be Read, either taking it from the + /// data buffer if present or getting it from the transport otherwise. + /// + public async Task ReadAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + if (_hasData) + { + _hasData = false; + } + else + { + await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken); + } + return _data[0]; + } + + /// + /// Return the next byte to be Read without consuming, filling the data + /// buffer if it has not been filled alReady. + /// + public async Task PeekAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + if (!_hasData) + { + await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken); + } + _hasData = true; + return _data[0]; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs b/lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs new file mode 100644 index 00000000000..5b2202e25fb --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; + +namespace Thrift.Protocols +{ + /** + * TMultiplexedProtocol is a protocol-independent concrete decorator that allows a Thrift + * client to communicate with a multiplexing Thrift server, by prepending the service name + * to the function name during function calls. + * + * NOTE: THIS IS NOT TO BE USED BY SERVERS. + * On the server, use TMultiplexedProcessor to handle requests from a multiplexing client. + * + * This example uses a single socket transport to invoke two services: + * + * TSocketClientTransport transport = new TSocketClientTransport("localhost", 9090); + * transport.open(); + * + * TBinaryProtocol protocol = new TBinaryProtocol(transport); + * + * TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "Calculator"); + * Calculator.Client service = new Calculator.Client(mp); + * + * TMultiplexedProtocol mp2 = new TMultiplexedProtocol(protocol, "WeatherReport"); + * WeatherReport.Client service2 = new WeatherReport.Client(mp2); + * + * System.out.println(service.add(2,2)); + * System.out.println(service2.getTemperature()); + * + */ + + //TODO: implementation of TProtocol + + // ReSharper disable once InconsistentNaming + public class TMultiplexedProtocol : TProtocolDecorator + { + /** Used to delimit the service name from the function name */ + public const string Separator = ":"; + + private readonly string _serviceName; + + /** + * Wrap the specified protocol, allowing it to be used to communicate with a + * multiplexing server. The serviceName is required as it is + * prepended to the message header so that the multiplexing server can broker + * the function call to the proper service. + * + * Args: + * protocol Your communication protocol of choice, e.g. TBinaryProtocol + * serviceName The service name of the service communicating via this protocol. + */ + + public TMultiplexedProtocol(TProtocol protocol, string serviceName) + : base(protocol) + { + _serviceName = serviceName; + } + + /** + * Prepends the service name to the function name, separated by TMultiplexedProtocol.SEPARATOR. + * Args: + * tMessage The original message. + */ + + public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken) + { + switch (message.Type) + { + case TMessageType.Call: + case TMessageType.Oneway: + await + base.WriteMessageBeginAsync( + new TMessage($"{_serviceName}{Separator}{message.Name}", message.Type, message.SeqID), + cancellationToken); + break; + default: + await base.WriteMessageBeginAsync(message, cancellationToken); + break; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TProtocol.cs b/lib/netcore/src/Thrift/Protocols/TProtocol.cs new file mode 100644 index 00000000000..8fef8613b99 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TProtocol.cs @@ -0,0 +1,377 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; +using Thrift.Transports; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public abstract class TProtocol : IDisposable + { + private const int DefaultRecursionDepth = 64; + private bool _isDisposed; + protected int RecursionDepth; + + protected TClientTransport Trans; + + protected TProtocol(TClientTransport trans) + { + Trans = trans; + RecursionLimit = DefaultRecursionDepth; + RecursionDepth = 0; + } + + public TClientTransport Transport => Trans; + + //TODO: check for protected + protected int RecursionLimit { get; set; } + + public void Dispose() + { + Dispose(true); + } + + public void IncrementRecursionDepth() + { + if (RecursionDepth < RecursionLimit) + { + ++RecursionDepth; + } + else + { + throw new TProtocolException(TProtocolException.DEPTH_LIMIT, "Depth limit exceeded"); + } + } + + public void DecrementRecursionDepth() + { + --RecursionDepth; + } + + protected virtual void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + (Trans as IDisposable)?.Dispose(); + } + } + _isDisposed = true; + } + + public virtual async Task WriteMessageBeginAsync(TMessage message) + { + await WriteMessageBeginAsync(message, CancellationToken.None); + } + + public abstract Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken); + + public virtual async Task WriteMessageEndAsync() + { + await WriteMessageEndAsync(CancellationToken.None); + } + + public abstract Task WriteMessageEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteStructBeginAsync(TStruct struc) + { + await WriteStructBeginAsync(struc, CancellationToken.None); + } + + public abstract Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken); + + public virtual async Task WriteStructEndAsync() + { + await WriteStructEndAsync(CancellationToken.None); + } + + public abstract Task WriteStructEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteFieldBeginAsync(TField field) + { + await WriteFieldBeginAsync(field, CancellationToken.None); + } + + public abstract Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken); + + public virtual async Task WriteFieldEndAsync() + { + await WriteFieldEndAsync(CancellationToken.None); + } + + public abstract Task WriteFieldEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteFieldStopAsync() + { + await WriteFieldStopAsync(CancellationToken.None); + } + + public abstract Task WriteFieldStopAsync(CancellationToken cancellationToken); + + public virtual async Task WriteMapBeginAsync(TMap map) + { + await WriteMapBeginAsync(map, CancellationToken.None); + } + + public abstract Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken); + + public virtual async Task WriteMapEndAsync() + { + await WriteMapEndAsync(CancellationToken.None); + } + + public abstract Task WriteMapEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteListBeginAsync(TList list) + { + await WriteListBeginAsync(list, CancellationToken.None); + } + + public abstract Task WriteListBeginAsync(TList list, CancellationToken cancellationToken); + + public virtual async Task WriteListEndAsync() + { + await WriteListEndAsync(CancellationToken.None); + } + + public abstract Task WriteListEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteSetBeginAsync(TSet set) + { + await WriteSetBeginAsync(set, CancellationToken.None); + } + + public abstract Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken); + + public virtual async Task WriteSetEndAsync() + { + await WriteSetEndAsync(CancellationToken.None); + } + + public abstract Task WriteSetEndAsync(CancellationToken cancellationToken); + + public virtual async Task WriteBoolAsync(bool b) + { + await WriteBoolAsync(b, CancellationToken.None); + } + + public abstract Task WriteBoolAsync(bool b, CancellationToken cancellationToken); + + public virtual async Task WriteByteAsync(sbyte b) + { + await WriteByteAsync(b, CancellationToken.None); + } + + public abstract Task WriteByteAsync(sbyte b, CancellationToken cancellationToken); + + public virtual async Task WriteI16Async(short i16) + { + await WriteI16Async(i16, CancellationToken.None); + } + + public abstract Task WriteI16Async(short i16, CancellationToken cancellationToken); + + public virtual async Task WriteI32Async(int i32) + { + await WriteI32Async(i32, CancellationToken.None); + } + + public abstract Task WriteI32Async(int i32, CancellationToken cancellationToken); + + public virtual async Task WriteI64Async(long i64) + { + await WriteI64Async(i64, CancellationToken.None); + } + + public abstract Task WriteI64Async(long i64, CancellationToken cancellationToken); + + public virtual async Task WriteDoubleAsync(double d) + { + await WriteDoubleAsync(d, CancellationToken.None); + } + + public abstract Task WriteDoubleAsync(double d, CancellationToken cancellationToken); + + public virtual async Task WriteStringAsync(string s) + { + await WriteStringAsync(s, CancellationToken.None); + } + + public virtual async Task WriteStringAsync(string s, CancellationToken cancellationToken) + { + var bytes = Encoding.UTF8.GetBytes(s); + await WriteBinaryAsync(bytes, cancellationToken); + } + + public virtual async Task WriteBinaryAsync(byte[] b) + { + await WriteBinaryAsync(b, CancellationToken.None); + } + + public abstract Task WriteBinaryAsync(byte[] b, CancellationToken cancellationToken); + + public virtual async Task ReadMessageBeginAsync() + { + return await ReadMessageBeginAsync(CancellationToken.None); + } + + public abstract Task ReadMessageBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadMessageEndAsync() + { + await ReadMessageEndAsync(CancellationToken.None); + } + + public abstract Task ReadMessageEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadStructBeginAsync() + { + return await ReadStructBeginAsync(CancellationToken.None); + } + + public abstract Task ReadStructBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadStructEndAsync() + { + await ReadStructEndAsync(CancellationToken.None); + } + + public abstract Task ReadStructEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadFieldBeginAsync() + { + return await ReadFieldBeginAsync(CancellationToken.None); + } + + public abstract Task ReadFieldBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadFieldEndAsync() + { + await ReadFieldEndAsync(CancellationToken.None); + } + + public abstract Task ReadFieldEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadMapBeginAsync() + { + return await ReadMapBeginAsync(CancellationToken.None); + } + + public abstract Task ReadMapBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadMapEndAsync() + { + await ReadMapEndAsync(CancellationToken.None); + } + + public abstract Task ReadMapEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadListBeginAsync() + { + return await ReadListBeginAsync(CancellationToken.None); + } + + public abstract Task ReadListBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadListEndAsync() + { + await ReadListEndAsync(CancellationToken.None); + } + + public abstract Task ReadListEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadSetBeginAsync() + { + return await ReadSetBeginAsync(CancellationToken.None); + } + + public abstract Task ReadSetBeginAsync(CancellationToken cancellationToken); + + public virtual async Task ReadSetEndAsync() + { + await ReadSetEndAsync(CancellationToken.None); + } + + public abstract Task ReadSetEndAsync(CancellationToken cancellationToken); + + public virtual async Task ReadBoolAsync() + { + return await ReadBoolAsync(CancellationToken.None); + } + + public abstract Task ReadBoolAsync(CancellationToken cancellationToken); + + public virtual async Task ReadByteAsync() + { + return await ReadByteAsync(CancellationToken.None); + } + + public abstract Task ReadByteAsync(CancellationToken cancellationToken); + + public virtual async Task ReadI16Async() + { + return await ReadI16Async(CancellationToken.None); + } + + public abstract Task ReadI16Async(CancellationToken cancellationToken); + + public virtual async Task ReadI32Async() + { + return await ReadI32Async(CancellationToken.None); + } + + public abstract Task ReadI32Async(CancellationToken cancellationToken); + + public virtual async Task ReadI64Async() + { + return await ReadI64Async(CancellationToken.None); + } + + public abstract Task ReadI64Async(CancellationToken cancellationToken); + + public virtual async Task ReadDoubleAsync() + { + return await ReadDoubleAsync(CancellationToken.None); + } + + public abstract Task ReadDoubleAsync(CancellationToken cancellationToken); + + public virtual async Task ReadStringAsync() + { + return await ReadStringAsync(CancellationToken.None); + } + + public virtual async Task ReadStringAsync(CancellationToken cancellationToken) + { + var buf = await ReadBinaryAsync(cancellationToken); + return Encoding.UTF8.GetString(buf, 0, buf.Length); + } + + public virtual async Task ReadBinaryAsync() + { + return await ReadBinaryAsync(CancellationToken.None); + } + + public abstract Task ReadBinaryAsync(CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs b/lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs new file mode 100644 index 00000000000..458b1172a16 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs @@ -0,0 +1,252 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + /// + /// TProtocolDecorator forwards all requests to an enclosed TProtocol instance, + /// providing a way to author concise concrete decorator subclasses.While it has + /// no abstract methods, it is marked abstract as a reminder that by itself, + /// it does not modify the behaviour of the enclosed TProtocol. + /// + public abstract class TProtocolDecorator : TProtocol + { + private readonly TProtocol _wrappedProtocol; + + protected TProtocolDecorator(TProtocol protocol) + : base(protocol.Transport) + { + if (protocol == null) + { + throw new ArgumentNullException(nameof(protocol)); + } + + _wrappedProtocol = protocol; + } + + public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteMessageBeginAsync(message, cancellationToken); + } + + public override async Task WriteMessageEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteMessageEndAsync(cancellationToken); + } + + public override async Task WriteStructBeginAsync(TStruct struc, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteStructBeginAsync(struc, cancellationToken); + } + + public override async Task WriteStructEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteStructEndAsync(cancellationToken); + } + + public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteFieldBeginAsync(field, cancellationToken); + } + + public override async Task WriteFieldEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteFieldEndAsync(cancellationToken); + } + + public override async Task WriteFieldStopAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteFieldStopAsync(cancellationToken); + } + + public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteMapBeginAsync(map, cancellationToken); + } + + public override async Task WriteMapEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteMapEndAsync(cancellationToken); + } + + public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteListBeginAsync(list, cancellationToken); + } + + public override async Task WriteListEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteListEndAsync(cancellationToken); + } + + public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteSetBeginAsync(set, cancellationToken); + } + + public override async Task WriteSetEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteSetEndAsync(cancellationToken); + } + + public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteBoolAsync(b, cancellationToken); + } + + public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteByteAsync(b, cancellationToken); + } + + public override async Task WriteI16Async(short i16, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteI16Async(i16, cancellationToken); + } + + public override async Task WriteI32Async(int i32, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteI32Async(i32, cancellationToken); + } + + public override async Task WriteI64Async(long i64, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteI64Async(i64, cancellationToken); + } + + public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteDoubleAsync(d, cancellationToken); + } + + public override async Task WriteStringAsync(string s, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteStringAsync(s, cancellationToken); + } + + public override async Task WriteBinaryAsync(byte[] b, CancellationToken cancellationToken) + { + await _wrappedProtocol.WriteBinaryAsync(b, cancellationToken); + } + + public override async Task ReadMessageBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadMessageBeginAsync(cancellationToken); + } + + public override async Task ReadMessageEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadMessageEndAsync(cancellationToken); + } + + public override async Task ReadStructBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadStructBeginAsync(cancellationToken); + } + + public override async Task ReadStructEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadStructEndAsync(cancellationToken); + } + + public override async Task ReadFieldBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadFieldBeginAsync(cancellationToken); + } + + public override async Task ReadFieldEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadFieldEndAsync(cancellationToken); + } + + public override async Task ReadMapBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadMapBeginAsync(cancellationToken); + } + + public override async Task ReadMapEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadMapEndAsync(cancellationToken); + } + + public override async Task ReadListBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadListBeginAsync(cancellationToken); + } + + public override async Task ReadListEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadListEndAsync(cancellationToken); + } + + public override async Task ReadSetBeginAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadSetBeginAsync(cancellationToken); + } + + public override async Task ReadSetEndAsync(CancellationToken cancellationToken) + { + await _wrappedProtocol.ReadSetEndAsync(cancellationToken); + } + + public override async Task ReadBoolAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadBoolAsync(cancellationToken); + } + + public override async Task ReadByteAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadByteAsync(cancellationToken); + } + + public override async Task ReadI16Async(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadI16Async(cancellationToken); + } + + public override async Task ReadI32Async(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadI32Async(cancellationToken); + } + + public override async Task ReadI64Async(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadI64Async(cancellationToken); + } + + public override async Task ReadDoubleAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadDoubleAsync(cancellationToken); + } + + public override async Task ReadStringAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadStringAsync(cancellationToken); + } + + public override async Task ReadBinaryAsync(CancellationToken cancellationToken) + { + return await _wrappedProtocol.ReadBinaryAsync(cancellationToken); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/TProtocolException.cs b/lib/netcore/src/Thrift/Protocols/TProtocolException.cs new file mode 100644 index 00000000000..02d0d3f316e --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/TProtocolException.cs @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Protocols +{ + public class TProtocolException : TException + { + // do not rename public contants - they used in generated files + public const int UNKNOWN = 0; + public const int INVALID_DATA = 1; + public const int NEGATIVE_SIZE = 2; + public const int SIZE_LIMIT = 3; + public const int BAD_VERSION = 4; + public const int NOT_IMPLEMENTED = 5; + public const int DEPTH_LIMIT = 6; + + protected int Type = UNKNOWN; + + public TProtocolException() + { + } + + public TProtocolException(int type) + { + Type = type; + } + + public TProtocolException(int type, string message) + : base(message) + { + Type = type; + } + + public TProtocolException(string message) + : base(message) + { + } + + public int GetExceptionType() + { + return Type; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs b/lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs new file mode 100644 index 00000000000..15fd45cbef9 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; + +namespace Thrift.Protocols.Utilities +{ + // ReSharper disable once InconsistentNaming + internal static class TBase64Utils + { + //TODO: Constants + //TODO: Check for args + //TODO: Unitests + + internal const string EncodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + private static readonly int[] DecodeTable = + { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 + }; + + internal static void Encode(byte[] src, int srcOff, int len, byte[] dst, int dstOff) + { + if (src == null) + { + throw new ArgumentNullException(nameof(src)); + } + + dst[dstOff] = (byte) EncodeTable[(src[srcOff] >> 2) & 0x3F]; + + if (len == 3) + { + dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)]; + dst[dstOff + 2] = (byte) EncodeTable[((src[srcOff + 1] << 2) & 0x3C) | ((src[srcOff + 2] >> 6) & 0x03)]; + dst[dstOff + 3] = (byte) EncodeTable[src[srcOff + 2] & 0x3F]; + } + else if (len == 2) + { + dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)]; + dst[dstOff + 2] = (byte) EncodeTable[(src[srcOff + 1] << 2) & 0x3C]; + } + else + { + // len == 1 + dst[dstOff + 1] = (byte) EncodeTable[(src[srcOff] << 4) & 0x30]; + } + } + + internal static void Decode(byte[] src, int srcOff, int len, byte[] dst, int dstOff) + { + if (src == null) + { + throw new ArgumentNullException(nameof(src)); + } + + dst[dstOff] = (byte) ((DecodeTable[src[srcOff] & 0x0FF] << 2) | (DecodeTable[src[srcOff + 1] & 0x0FF] >> 4)); + + if (len > 2) + { + dst[dstOff + 1] = + (byte) + (((DecodeTable[src[srcOff + 1] & 0x0FF] << 4) & 0xF0) | (DecodeTable[src[srcOff + 2] & 0x0FF] >> 2)); + if (len > 3) + { + dst[dstOff + 2] = + (byte) + (((DecodeTable[src[srcOff + 2] & 0x0FF] << 6) & 0xC0) | DecodeTable[src[srcOff + 3] & 0x0FF]); + } + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs b/lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs new file mode 100644 index 00000000000..62321496425 --- /dev/null +++ b/lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols.Entities; + +namespace Thrift.Protocols +{ + // ReSharper disable once InconsistentNaming + public static class TProtocolUtil + { + public static async Task SkipAsync(TProtocol prot, TType type, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + prot.IncrementRecursionDepth(); + try + { + switch (type) + { + case TType.Bool: + await prot.ReadBoolAsync(cancellationToken); + break; + case TType.Byte: + await prot.ReadByteAsync(cancellationToken); + break; + case TType.I16: + await prot.ReadI16Async(cancellationToken); + break; + case TType.I32: + await prot.ReadI32Async(cancellationToken); + break; + case TType.I64: + await prot.ReadI64Async(cancellationToken); + break; + case TType.Double: + await prot.ReadDoubleAsync(cancellationToken); + break; + case TType.String: + // Don't try to decode the string, just skip it. + await prot.ReadBinaryAsync(cancellationToken); + break; + case TType.Struct: + await prot.ReadStructBeginAsync(cancellationToken); + while (true) + { + var field = await prot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + await SkipAsync(prot, field.Type, cancellationToken); + await prot.ReadFieldEndAsync(cancellationToken); + } + await prot.ReadStructEndAsync(cancellationToken); + break; + case TType.Map: + var map = await prot.ReadMapBeginAsync(cancellationToken); + for (var i = 0; i < map.Count; i++) + { + await SkipAsync(prot, map.KeyType, cancellationToken); + await SkipAsync(prot, map.ValueType, cancellationToken); + } + await prot.ReadMapEndAsync(cancellationToken); + break; + case TType.Set: + var set = await prot.ReadSetBeginAsync(cancellationToken); + for (var i = 0; i < set.Count; i++) + { + await SkipAsync(prot, set.ElementType, cancellationToken); + } + await prot.ReadSetEndAsync(cancellationToken); + break; + case TType.List: + var list = await prot.ReadListBeginAsync(cancellationToken); + for (var i = 0; i < list.Count; i++) + { + await SkipAsync(prot, list.ElementType, cancellationToken); + } + await prot.ReadListEndAsync(cancellationToken); + break; + } + } + finally + { + prot.DecrementRecursionDepth(); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Server/AsyncBaseServer.cs b/lib/netcore/src/Thrift/Server/AsyncBaseServer.cs new file mode 100644 index 00000000000..5ff7a32a2b0 --- /dev/null +++ b/lib/netcore/src/Thrift/Server/AsyncBaseServer.cs @@ -0,0 +1,184 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Thrift.Protocols; +using Thrift.Transports; + +namespace Thrift.Server +{ + //TODO: unhandled exceptions, etc. + + // ReSharper disable once InconsistentNaming + public class AsyncBaseServer : TBaseServer + { + private readonly int _clientWaitingDelay; + private volatile Task _serverTask; + + public AsyncBaseServer(ITAsyncProcessor processor, TServerTransport serverTransport, + ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory, + ILoggerFactory loggerFactory, int clientWaitingDelay = 10) + : this(new SingletonTProcessorFactory(processor), serverTransport, + new TTransportFactory(), new TTransportFactory(), + inputProtocolFactory, outputProtocolFactory, + loggerFactory.CreateLogger(nameof(AsyncBaseServer)), clientWaitingDelay) + { + } + + public AsyncBaseServer(ITProcessorFactory itProcessorFactory, TServerTransport serverTransport, + TTransportFactory inputTransportFactory, TTransportFactory outputTransportFactory, + ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory, + ILogger logger, int clientWaitingDelay = 10) + : base(itProcessorFactory, serverTransport, inputTransportFactory, outputTransportFactory, + inputProtocolFactory, outputProtocolFactory, logger) + { + _clientWaitingDelay = clientWaitingDelay; + } + + public override async Task ServeAsync(CancellationToken cancellationToken) + { + try + { + // cancelation token + _serverTask = Task.Factory.StartNew(() => StartListening(cancellationToken), + TaskCreationOptions.LongRunning); + await _serverTask; + } + catch (Exception ex) + { + Logger.LogError(ex.ToString()); + } + } + + private async Task StartListening(CancellationToken cancellationToken) + { + ServerTransport.Listen(); + + Logger.LogTrace("Started listening at server"); + + if (ServerEventHandler != null) + { + await ServerEventHandler.PreServeAsync(cancellationToken); + } + + while (!cancellationToken.IsCancellationRequested) + { + if (ServerTransport.IsClientPending()) + { + Logger.LogTrace("Waiting for client connection"); + + try + { + var client = await ServerTransport.AcceptAsync(cancellationToken); + await Task.Factory.StartNew(() => Execute(client, cancellationToken)); + } + catch (TTransportException ttx) + { + Logger.LogTrace($"Transport exception: {ttx}"); + + if (ttx.Type != TTransportException.ExceptionType.Interrupted) + { + Logger.LogError(ttx.ToString()); + } + } + } + else + { + await Task.Delay(TimeSpan.FromMilliseconds(_clientWaitingDelay), cancellationToken); + } + } + + ServerTransport.Close(); + + Logger.LogTrace("Completed listening at server"); + } + + public override void Stop() + { + } + + private async Task Execute(TClientTransport client, CancellationToken cancellationToken) + { + Logger.LogTrace("Started client request processing"); + + var processor = ItProcessorFactory.GetAsyncProcessor(client, this); + + TClientTransport inputTransport = null; + TClientTransport outputTransport = null; + TProtocol inputProtocol = null; + TProtocol outputProtocol = null; + object connectionContext = null; + + try + { + inputTransport = InputTransportFactory.GetTransport(client); + outputTransport = OutputTransportFactory.GetTransport(client); + + inputProtocol = InputProtocolFactory.GetProtocol(inputTransport); + outputProtocol = OutputProtocolFactory.GetProtocol(outputTransport); + + if (ServerEventHandler != null) + { + connectionContext = + await ServerEventHandler.CreateContextAsync(inputProtocol, outputProtocol, cancellationToken); + } + + while (!cancellationToken.IsCancellationRequested) + { + if (!await inputTransport.PeekAsync(cancellationToken)) + { + break; + } + + if (ServerEventHandler != null) + { + await + ServerEventHandler.ProcessContextAsync(connectionContext, inputTransport, cancellationToken); + } + + if (!await processor.ProcessAsync(inputProtocol, outputProtocol, cancellationToken)) + { + break; + } + } + } + catch (TTransportException ttx) + { + Logger.LogTrace($"Transport exception: {ttx}"); + } + catch (Exception x) + { + Logger.LogError($"Error: {x}"); + } + + if (ServerEventHandler != null) + { + await + ServerEventHandler.DeleteContextAsync(connectionContext, inputProtocol, outputProtocol, + cancellationToken); + } + + inputTransport?.Close(); + outputTransport?.Close(); + + Logger.LogTrace("Completed client request processing"); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Server/TBaseServer.cs b/lib/netcore/src/Thrift/Server/TBaseServer.cs new file mode 100644 index 00000000000..97cc7ff9ec7 --- /dev/null +++ b/lib/netcore/src/Thrift/Server/TBaseServer.cs @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Thrift.Protocols; +using Thrift.Transports; + +namespace Thrift.Server +{ + // ReSharper disable once InconsistentNaming + public abstract class TBaseServer + { + protected readonly ILogger Logger; + protected ITProtocolFactory InputProtocolFactory; + protected TTransportFactory InputTransportFactory; + protected ITProcessorFactory ItProcessorFactory; + protected ITProtocolFactory OutputProtocolFactory; + protected TTransportFactory OutputTransportFactory; + + protected TServerEventHandler ServerEventHandler; + protected TServerTransport ServerTransport; + + protected TBaseServer(ITProcessorFactory itProcessorFactory, TServerTransport serverTransport, + TTransportFactory inputTransportFactory, TTransportFactory outputTransportFactory, + ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory, + ILogger logger) + { + if (itProcessorFactory == null) throw new ArgumentNullException(nameof(itProcessorFactory)); + if (inputTransportFactory == null) throw new ArgumentNullException(nameof(inputTransportFactory)); + if (outputTransportFactory == null) throw new ArgumentNullException(nameof(outputTransportFactory)); + if (inputProtocolFactory == null) throw new ArgumentNullException(nameof(inputProtocolFactory)); + if (outputProtocolFactory == null) throw new ArgumentNullException(nameof(outputProtocolFactory)); + if (logger == null) throw new ArgumentNullException(nameof(logger)); + + ItProcessorFactory = itProcessorFactory; + ServerTransport = serverTransport; + InputTransportFactory = inputTransportFactory; + OutputTransportFactory = outputTransportFactory; + InputProtocolFactory = inputProtocolFactory; + OutputProtocolFactory = outputProtocolFactory; + Logger = logger; + } + + public void SetEventHandler(TServerEventHandler seh) + { + ServerEventHandler = seh; + } + + public TServerEventHandler GetEventHandler() + { + return ServerEventHandler; + } + + public abstract void Stop(); + + public virtual void Start() + { + // do nothing + } + + public virtual async Task ServeAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Server/TServerEventHandler.cs b/lib/netcore/src/Thrift/Server/TServerEventHandler.cs new file mode 100644 index 00000000000..733bb4bef7c --- /dev/null +++ b/lib/netcore/src/Thrift/Server/TServerEventHandler.cs @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols; +using Thrift.Transports; + +namespace Thrift.Server +{ + //TODO: replacement by event? + + /// + /// Interface implemented by server users to handle events from the server + /// + // ReSharper disable once InconsistentNaming + public interface TServerEventHandler + { + /// + /// Called before the server begins */ + /// + Task PreServeAsync(CancellationToken cancellationToken); + + /// + /// Called when a new client has connected and is about to being processing */ + /// + Task CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken); + + /// + /// Called when a client has finished request-handling to delete server context */ + /// + Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output, + CancellationToken cancellationToken); + + /// + /// Called when a client is about to call the processor */ + /// + Task ProcessContextAsync(object serverContext, TClientTransport transport, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/SingletonTProcessorFactory.cs b/lib/netcore/src/Thrift/SingletonTProcessorFactory.cs new file mode 100644 index 00000000000..c35123348ba --- /dev/null +++ b/lib/netcore/src/Thrift/SingletonTProcessorFactory.cs @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using Thrift.Server; +using Thrift.Transports; + +namespace Thrift +{ + // ReSharper disable once InconsistentNaming + public class SingletonTProcessorFactory : ITProcessorFactory + { + private readonly ITAsyncProcessor _tAsyncProcessor; + + public SingletonTProcessorFactory(ITAsyncProcessor tAsyncProcessor) + { + _tAsyncProcessor = tAsyncProcessor; + } + + public ITAsyncProcessor GetAsyncProcessor(TClientTransport trans, TBaseServer baseServer = null) + { + return _tAsyncProcessor; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/TApplicationException.cs b/lib/netcore/src/Thrift/TApplicationException.cs new file mode 100644 index 00000000000..f1ea252580d --- /dev/null +++ b/lib/netcore/src/Thrift/TApplicationException.cs @@ -0,0 +1,149 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols; +using Thrift.Protocols.Entities; + +namespace Thrift +{ + // ReSharper disable once InconsistentNaming + public class TApplicationException : TException + { + public enum ExceptionType + { + Unknown, + UnknownMethod, + InvalidMessageType, + WrongMethodName, + BadSequenceId, + MissingResult, + InternalError, + ProtocolError, + InvalidTransform, + InvalidProtocol, + UnsupportedClientType + } + + private const int MessageTypeFieldId = 1; + private const int ExTypeFieldId = 2; + + protected ExceptionType Type; + + public TApplicationException() + { + } + + public TApplicationException(ExceptionType type) + { + Type = type; + } + + public TApplicationException(ExceptionType type, string message) + : base(message) + { + Type = type; + } + + public static async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + string message = null; + var type = ExceptionType.Unknown; + + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + var field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case MessageTypeFieldId: + if (field.Type == TType.String) + { + message = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case ExTypeFieldId: + if (field.Type == TType.I32) + { + type = (ExceptionType) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + + return new TApplicationException(type, message); + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + const string messageTypeFieldName = "message"; + const string exTypeFieldName = "exType"; + const string structApplicationExceptionName = "TApplicationException"; + + var struc = new TStruct(structApplicationExceptionName); + var field = new TField(); + + await oprot.WriteStructBeginAsync(struc, cancellationToken); + + if (!string.IsNullOrEmpty(Message)) + { + field.Name = messageTypeFieldName; + field.Type = TType.String; + field.ID = MessageTypeFieldId; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Message, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + + field.Name = exTypeFieldName; + field.Type = TType.I32; + field.ID = ExTypeFieldId; + + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/TBaseClient.cs b/lib/netcore/src/Thrift/TBaseClient.cs new file mode 100644 index 00000000000..24e08cef990 --- /dev/null +++ b/lib/netcore/src/Thrift/TBaseClient.cs @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols; + +namespace Thrift +{ + /// + /// TBaseClient. + /// Base client for generated clients. + /// Do not change this class without checking generated code (namings, etc.) + /// + public abstract class TBaseClient + { + private readonly TProtocol _inputProtocol; + private readonly TProtocol _outputProtocol; + private bool _isDisposed; + private int _seqId; + + protected TBaseClient(TProtocol inputProtocol, TProtocol outputProtocol) + { + if (inputProtocol == null) + { + throw new ArgumentNullException(nameof(inputProtocol)); + } + + if (outputProtocol == null) + { + throw new ArgumentNullException(nameof(outputProtocol)); + } + + _inputProtocol = inputProtocol; + _outputProtocol = outputProtocol; + } + + public TProtocol InputProtocol => _inputProtocol; + + public TProtocol OutputProtocol => _outputProtocol; + + public int SeqId => _seqId; + + public virtual async Task OpenTransportAsync() + { + await OpenTransportAsync(CancellationToken.None); + } + + public virtual async Task OpenTransportAsync(CancellationToken cancellationToken) + { + if (!_inputProtocol.Transport.IsOpen) + { + await _inputProtocol.Transport.OpenAsync(cancellationToken); + } + + if (!_inputProtocol.Transport.IsOpen) + { + await _outputProtocol.Transport.OpenAsync(cancellationToken); + } + } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + _inputProtocol?.Dispose(); + _outputProtocol?.Dispose(); + } + } + + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/TException.cs b/lib/netcore/src/Thrift/TException.cs new file mode 100644 index 00000000000..6aa588d7f34 --- /dev/null +++ b/lib/netcore/src/Thrift/TException.cs @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; + +namespace Thrift +{ + // ReSharper disable once InconsistentNaming + public class TException : Exception + { + public TException() + { + } + + public TException(string message) + : base(message) + { + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/TMultiplexedProcessor.cs b/lib/netcore/src/Thrift/TMultiplexedProcessor.cs new file mode 100644 index 00000000000..ad0e749e071 --- /dev/null +++ b/lib/netcore/src/Thrift/TMultiplexedProcessor.cs @@ -0,0 +1,143 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Protocols; +using Thrift.Protocols.Entities; + +namespace Thrift +{ + // ReSharper disable once InconsistentNaming + public class TMultiplexedProcessor : ITAsyncProcessor + { + //TODO: Localization + + private readonly Dictionary _serviceProcessorMap = + new Dictionary(); + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + try + { + var message = await iprot.ReadMessageBeginAsync(cancellationToken); + + if ((message.Type != TMessageType.Call) && (message.Type != TMessageType.Oneway)) + { + await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidMessageType, + "Message exType CALL or ONEWAY expected", cancellationToken); + return false; + } + + // Extract the service name + var index = message.Name.IndexOf(TMultiplexedProtocol.Separator, StringComparison.Ordinal); + if (index < 0) + { + await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidProtocol, + $"Service name not found in message name: {message.Name}. Did you forget to use a TMultiplexProtocol in your client?", + cancellationToken); + return false; + } + + // Create a new TMessage, something that can be consumed by any TProtocol + var serviceName = message.Name.Substring(0, index); + ITAsyncProcessor actualProcessor; + if (!_serviceProcessorMap.TryGetValue(serviceName, out actualProcessor)) + { + await FailAsync(oprot, message, TApplicationException.ExceptionType.InternalError, + $"Service name not found: {serviceName}. Did you forget to call RegisterProcessor()?", + cancellationToken); + return false; + } + + // Create a new TMessage, removing the service name + var newMessage = new TMessage( + message.Name.Substring(serviceName.Length + TMultiplexedProtocol.Separator.Length), + message.Type, + message.SeqID); + + // Dispatch processing to the stored processor + return + await + actualProcessor.ProcessAsync(new StoredMessageProtocol(iprot, newMessage), oprot, + cancellationToken); + } + catch (IOException) + { + return false; // similar to all other processors + } + } + + public void RegisterProcessor(string serviceName, ITAsyncProcessor processor) + { + if (_serviceProcessorMap.ContainsKey(serviceName)) + { + throw new InvalidOperationException( + $"Processor map already contains processor with name: '{serviceName}'"); + } + + _serviceProcessorMap.Add(serviceName, processor); + } + + private async Task FailAsync(TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, + string etxt, CancellationToken cancellationToken) + { + var appex = new TApplicationException(extype, etxt); + + var newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID); + + await oprot.WriteMessageBeginAsync(newMessage, cancellationToken); + await appex.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + private class StoredMessageProtocol : TProtocolDecorator + { + readonly TMessage _msgBegin; + + public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin) + : base(protocol) + { + _msgBegin = messageBegin; + } + + public override async Task ReadMessageBeginAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + return _msgBegin; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Thrift.xproj b/lib/netcore/src/Thrift/Thrift.xproj new file mode 100644 index 00000000000..b450b9207af --- /dev/null +++ b/lib/netcore/src/Thrift/Thrift.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 6850cf46-5467-4c65-bd78-871581c539fc + Thrift + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs new file mode 100644 index 00000000000..86eb735dcc5 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class TBufferedClientTransport : TClientTransport + { + private readonly int _bufSize; + private readonly MemoryStream _inputBuffer = new MemoryStream(0); + private readonly MemoryStream _outputBuffer = new MemoryStream(0); + private readonly TClientTransport _transport; + private bool _isDisposed; + + //TODO: should support only specified input transport? + public TBufferedClientTransport(TClientTransport transport, int bufSize = 1024) + { + if (transport == null) + { + throw new ArgumentNullException(nameof(transport)); + } + + if (bufSize <= 0) + { + throw new ArgumentOutOfRangeException(nameof(bufSize), "Buffer size must be a positive number."); + } + + _transport = transport; + _bufSize = bufSize; + } + + public TClientTransport UnderlyingTransport + { + get + { + CheckNotDisposed(); + + return _transport; + } + } + + public override bool IsOpen => !_isDisposed && _transport.IsOpen; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + CheckNotDisposed(); + + await _transport.OpenAsync(cancellationToken); + } + + public override void Close() + { + CheckNotDisposed(); + + _transport.Close(); + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + //TODO: investigate how it should work correctly + CheckNotDisposed(); + + ValidateBufferArgs(buffer, offset, length); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + if (_inputBuffer.Capacity < _bufSize) + { + _inputBuffer.Capacity = _bufSize; + } + + var got = await _inputBuffer.ReadAsync(buffer, offset, length, cancellationToken); + if (got > 0) + { + return got; + } + + _inputBuffer.Seek(0, SeekOrigin.Begin); + _inputBuffer.SetLength(_inputBuffer.Capacity); + + ArraySegment bufSegment; + _inputBuffer.TryGetBuffer(out bufSegment); + + // investigate + var filled = await _transport.ReadAsync(bufSegment.Array, 0, (int) _inputBuffer.Length, cancellationToken); + _inputBuffer.SetLength(filled); + + if (filled == 0) + { + return 0; + } + + return await ReadAsync(buffer, offset, length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + CheckNotDisposed(); + + ValidateBufferArgs(buffer, offset, length); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + // Relative offset from "off" argument + var writtenCount = 0; + if (_outputBuffer.Length > 0) + { + var capa = (int) (_outputBuffer.Capacity - _outputBuffer.Length); + var writeSize = capa <= length ? capa : length; + await _outputBuffer.WriteAsync(buffer, offset, writeSize, cancellationToken); + + writtenCount += writeSize; + if (writeSize == capa) + { + //ArraySegment bufSegment; + //_outputBuffer.TryGetBuffer(out bufSegment); + var data = _outputBuffer.ToArray(); + //await _transport.WriteAsync(bufSegment.Array, cancellationToken); + await _transport.WriteAsync(data, cancellationToken); + _outputBuffer.SetLength(0); + } + } + + while (length - writtenCount >= _bufSize) + { + await _transport.WriteAsync(buffer, offset + writtenCount, _bufSize, cancellationToken); + writtenCount += _bufSize; + } + + var remain = length - writtenCount; + if (remain > 0) + { + if (_outputBuffer.Capacity < _bufSize) + { + _outputBuffer.Capacity = _bufSize; + } + await _outputBuffer.WriteAsync(buffer, offset + writtenCount, remain, cancellationToken); + } + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + CheckNotDisposed(); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + if (_outputBuffer.Length > 0) + { + //ArraySegment bufSegment; + var data = _outputBuffer.ToArray(); // TryGetBuffer(out bufSegment); + + await _transport.WriteAsync(data /*bufSegment.Array*/, cancellationToken); + _outputBuffer.SetLength(0); + } + + await _transport.FlushAsync(cancellationToken); + } + + private void CheckNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException(nameof(_transport)); + } + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + _inputBuffer.Dispose(); + _outputBuffer.Dispose(); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs new file mode 100644 index 00000000000..514c1a6e688 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs @@ -0,0 +1,207 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + //TODO: check for correct implementation + + // ReSharper disable once InconsistentNaming + public class TFramedClientTransport : TClientTransport + { + private const int HeaderSize = 4; + private readonly byte[] _headerBuf = new byte[HeaderSize]; + private readonly MemoryStream _readBuffer = new MemoryStream(1024); + private readonly TClientTransport _transport; + private readonly MemoryStream _writeBuffer = new MemoryStream(1024); + + private bool _isDisposed; + + public TFramedClientTransport(TClientTransport transport) + { + throw new NotImplementedException("TFramedClientTransport is not fully ready for usage"); + + if (transport == null) + { + throw new ArgumentNullException(nameof(transport)); + } + + _transport = transport; + + InitWriteBuffer(); + } + + public override bool IsOpen => !_isDisposed && _transport.IsOpen; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + CheckNotDisposed(); + + await _transport.OpenAsync(cancellationToken); + } + + public override void Close() + { + CheckNotDisposed(); + + _transport.Close(); + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + CheckNotDisposed(); + + ValidateBufferArgs(buffer, offset, length); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + var got = await _readBuffer.ReadAsync(buffer, offset, length, cancellationToken); + if (got > 0) + { + return got; + } + + // Read another frame of data + await ReadFrameAsync(cancellationToken); + + return await _readBuffer.ReadAsync(buffer, offset, length, cancellationToken); + } + + private async Task ReadFrameAsync(CancellationToken cancellationToken) + { + await _transport.ReadAllAsync(_headerBuf, 0, HeaderSize, cancellationToken); + + var size = DecodeFrameSize(_headerBuf); + + _readBuffer.SetLength(size); + _readBuffer.Seek(0, SeekOrigin.Begin); + + ArraySegment bufSegment; + _readBuffer.TryGetBuffer(out bufSegment); + + var buff = bufSegment.Array; + + await _transport.ReadAllAsync(buff, 0, size, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + CheckNotDisposed(); + + ValidateBufferArgs(buffer, offset, length); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + if (_writeBuffer.Length + length > int.MaxValue) + { + await FlushAsync(cancellationToken); + } + + await _writeBuffer.WriteAsync(buffer, offset, length, cancellationToken); + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + CheckNotDisposed(); + + if (!IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + //ArraySegment bufSegment; + //_writeBuffer.TryGetBuffer(out bufSegment); + //var buf = bufSegment.Array; + var buf = _writeBuffer.ToArray(); + + //var len = (int)_writeBuffer.Length; + var dataLen = (int) _writeBuffer.Length - HeaderSize; + if (dataLen < 0) + { + throw new InvalidOperationException(); // logic error actually + } + + // Inject message header into the reserved buffer space + EncodeFrameSize(dataLen, buf); + + // Send the entire message at once + await _transport.WriteAsync(buf, cancellationToken); + + InitWriteBuffer(); + + await _transport.FlushAsync(cancellationToken); + } + + private void InitWriteBuffer() + { + // Reserve space for message header to be put right before sending it out + _writeBuffer.SetLength(HeaderSize); + _writeBuffer.Seek(0, SeekOrigin.End); + } + + private static void EncodeFrameSize(int frameSize, byte[] buf) + { + buf[0] = (byte) (0xff & (frameSize >> 24)); + buf[1] = (byte) (0xff & (frameSize >> 16)); + buf[2] = (byte) (0xff & (frameSize >> 8)); + buf[3] = (byte) (0xff & (frameSize)); + } + + private static int DecodeFrameSize(byte[] buf) + { + return + ((buf[0] & 0xff) << 24) | + ((buf[1] & 0xff) << 16) | + ((buf[2] & 0xff) << 8) | + (buf[3] & 0xff); + } + + + private void CheckNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException("TFramedClientTransport"); + } + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + _readBuffer.Dispose(); + _writeBuffer.Dispose(); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs new file mode 100644 index 00000000000..bc36bb3b490 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs @@ -0,0 +1,228 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class THttpClientTransport : TClientTransport + { + private readonly X509Certificate[] _certificates; + private readonly Uri _uri; + + // Timeouts in milliseconds + private int _connectTimeout = 30000; + private HttpClient _httpClient; + private Stream _inputStream; + + private bool _isDisposed; + private MemoryStream _outputStream = new MemoryStream(); + + public THttpClientTransport(Uri u, IDictionary customHeaders) + : this(u, Enumerable.Empty(), customHeaders) + { + } + + public THttpClientTransport(Uri u, IEnumerable certificates, + IDictionary customHeaders) + { + _uri = u; + _certificates = (certificates ?? Enumerable.Empty()).ToArray(); + CustomHeaders = customHeaders; + + // due to current bug with performance of Dispose in netcore https://github.com/dotnet/corefx/issues/8809 + // this can be switched to default way (create client->use->dispose per flush) later + _httpClient = CreateClient(); + } + + public IDictionary CustomHeaders { get; } + + public int ConnectTimeout + { + set { _connectTimeout = value; } + } + + public override bool IsOpen => true; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override void Close() + { + if (_inputStream != null) + { + _inputStream.Dispose(); + _inputStream = null; + } + + if (_outputStream != null) + { + _outputStream.Dispose(); + _outputStream = null; + } + + if (_httpClient != null) + { + _httpClient.Dispose(); + _httpClient = null; + } + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + if (_inputStream == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No request has been sent"); + } + + try + { + var ret = await _inputStream.ReadAsync(buffer, offset, length, cancellationToken); + + if (ret == -1) + { + throw new TTransportException(TTransportException.ExceptionType.EndOfFile, "No more data available"); + } + + return ret; + } + catch (IOException iox) + { + throw new TTransportException(TTransportException.ExceptionType.Unknown, iox.ToString()); + } + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + await _outputStream.WriteAsync(buffer, offset, length, cancellationToken); + } + + private HttpClient CreateClient() + { + var handler = new HttpClientHandler(); + handler.ClientCertificates.AddRange(_certificates); + + var httpClient = new HttpClient(handler); + + if (_connectTimeout > 0) + { + httpClient.Timeout = TimeSpan.FromSeconds(_connectTimeout); + } + + httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-thrift")); + httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "1.0.0")); + + if (CustomHeaders != null) + { + foreach (var item in CustomHeaders) + { + httpClient.DefaultRequestHeaders.Add(item.Key, item.Value); + } + } + + return httpClient; + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + try + { + try + { + if (_outputStream.CanSeek) + { + _outputStream.Seek(0, SeekOrigin.Begin); + } + + using (var outStream = new StreamContent(_outputStream)) + { + var msg = await _httpClient.PostAsync(_uri, outStream, cancellationToken); + + msg.EnsureSuccessStatusCode(); + + if (_inputStream != null) + { + _inputStream.Dispose(); + _inputStream = null; + } + + _inputStream = await msg.Content.ReadAsStreamAsync(); + if (_inputStream.CanSeek) + { + _inputStream.Seek(0, SeekOrigin.Begin); + } + } + } + catch (IOException iox) + { + throw new TTransportException(TTransportException.ExceptionType.Unknown, iox.ToString()); + } + catch (WebException wx) + { + throw new TTransportException(TTransportException.ExceptionType.Unknown, + "Couldn't connect to server: " + wx); + } + } + finally + { + _outputStream = new MemoryStream(); + } + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + _inputStream?.Dispose(); + _outputStream?.Dispose(); + _httpClient?.Dispose(); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs new file mode 100644 index 00000000000..46a55a64a1e --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs @@ -0,0 +1,97 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class TMemoryBufferClientTransport : TClientTransport + { + private readonly MemoryStream _byteStream; + private bool _isDisposed; + + public TMemoryBufferClientTransport() + { + _byteStream = new MemoryStream(); + } + + public TMemoryBufferClientTransport(byte[] buf) + { + _byteStream = new MemoryStream(buf); + } + + public override bool IsOpen => true; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override void Close() + { + /** do nothing **/ + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + return await _byteStream.ReadAsync(buffer, offset, length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, CancellationToken cancellationToken) + { + await _byteStream.WriteAsync(buffer, 0, buffer.Length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + await _byteStream.WriteAsync(buffer, offset, length, cancellationToken); + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public byte[] GetBuffer() + { + return _byteStream.ToArray(); + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + _byteStream?.Dispose(); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs new file mode 100644 index 00000000000..f5e4baf4a12 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.IO.Pipes; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class TNamedPipeClientTransport : TClientTransport + { + private NamedPipeClientStream _client; + + public TNamedPipeClientTransport(string pipe) : this(".", pipe) + { + } + + public TNamedPipeClientTransport(string server, string pipe) + { + var serverName = string.IsNullOrWhiteSpace(server) ? server : "."; + + _client = new NamedPipeClientStream(serverName, pipe, PipeDirection.InOut, PipeOptions.None); + } + + public override bool IsOpen => _client != null && _client.IsConnected; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen); + } + + await _client.ConnectAsync(cancellationToken); + } + + public override void Close() + { + if (_client != null) + { + _client.Dispose(); + _client = null; + } + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + if (_client == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + return await _client.ReadAsync(buffer, offset, length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + if (_client == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + await _client.WriteAsync(buffer, offset, length, cancellationToken); + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + protected override void Dispose(bool disposing) + { + _client.Dispose(); + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs new file mode 100644 index 00000000000..a44efe677b5 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs @@ -0,0 +1,144 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Net; +using System.Net.Sockets; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class TSocketClientTransport : TStreamClientTransport + { + private bool _isDisposed; + + public TSocketClientTransport(TcpClient client) + { + if (client == null) + { + throw new ArgumentNullException(nameof(client)); + } + + TcpClient = client; + + if (IsOpen) + { + InputStream = client.GetStream(); + OutputStream = client.GetStream(); + } + } + + public TSocketClientTransport(IPAddress host, int port) + : this(host, port, 0) + { + } + + public TSocketClientTransport(IPAddress host, int port, int timeout) + { + Host = host; + Port = port; + + TcpClient = new TcpClient(); + TcpClient.ReceiveTimeout = TcpClient.SendTimeout = timeout; + TcpClient.Client.NoDelay = true; + } + + public TcpClient TcpClient { get; private set; } + public IPAddress Host { get; } + public int Port { get; } + + public int Timeout + { + set + { + if (TcpClient != null) + { + TcpClient.ReceiveTimeout = TcpClient.SendTimeout = value; + } + } + } + + public override bool IsOpen + { + get + { + if (TcpClient == null) + { + return false; + } + + return TcpClient.Connected; + } + } + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + + if (IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected"); + } + + if (Port <= 0) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port"); + } + + if (TcpClient == null) + { + throw new InvalidOperationException("Invalid or not initialized tcp client"); + } + + await TcpClient.ConnectAsync(Host, Port); + + InputStream = TcpClient.GetStream(); + OutputStream = TcpClient.GetStream(); + } + + public override void Close() + { + base.Close(); + + if (TcpClient != null) + { + TcpClient.Dispose(); + TcpClient = null; + } + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + TcpClient?.Dispose(); + + base.Dispose(disposing); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs new file mode 100644 index 00000000000..f7164f0454f --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + // ReSharper disable once InconsistentNaming + public class TStreamClientTransport : TClientTransport + { + private bool _isDisposed; + + protected TStreamClientTransport() + { + } + + public TStreamClientTransport(Stream inputStream, Stream outputStream) + { + InputStream = inputStream; + OutputStream = outputStream; + } + + protected Stream OutputStream { get; set; } + + protected Stream InputStream { get; set; } + + public override bool IsOpen => true; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override void Close() + { + if (InputStream != null) + { + InputStream.Dispose(); + InputStream = null; + } + + if (OutputStream != null) + { + OutputStream.Dispose(); + OutputStream = null; + } + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + if (InputStream == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, + "Cannot read from null inputstream"); + } + + return await InputStream.ReadAsync(buffer, offset, length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken) + { + if (OutputStream == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, + "Cannot read from null inputstream"); + } + + await OutputStream.WriteAsync(buffer, offset, length, cancellationToken); + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + await OutputStream.FlushAsync(cancellationToken); + } + + // IDisposable + protected override void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (disposing) + { + InputStream?.Dispose(); + OutputStream?.Dispose(); + } + } + _isDisposed = true; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs b/lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs new file mode 100644 index 00000000000..a21977b2073 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs @@ -0,0 +1,236 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Net; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Client +{ + //TODO: check for correct work + + // ReSharper disable once InconsistentNaming + public class TTlsSocketClientTransport : TStreamClientTransport + { + private readonly X509Certificate2 _certificate; + private readonly RemoteCertificateValidationCallback _certValidator; + private readonly IPAddress _host; + private readonly bool _isServer; + private readonly LocalCertificateSelectionCallback _localCertificateSelectionCallback; + private readonly int _port; + private readonly SslProtocols _sslProtocols; + private TcpClient _client; + private SslStream _secureStream; + private int _timeout; + + public TTlsSocketClientTransport(TcpClient client, X509Certificate2 certificate, bool isServer = false, + RemoteCertificateValidationCallback certValidator = null, + LocalCertificateSelectionCallback localCertificateSelectionCallback = null, + SslProtocols sslProtocols = SslProtocols.Tls12) + { + _client = client; + _certificate = certificate; + _certValidator = certValidator; + _localCertificateSelectionCallback = localCertificateSelectionCallback; + _sslProtocols = sslProtocols; + _isServer = isServer; + + if (isServer && certificate == null) + { + throw new ArgumentException("TTlsSocketClientTransport needs certificate to be used for server", + "certificate"); + } + + if (IsOpen) + { + InputStream = client.GetStream(); + OutputStream = client.GetStream(); + } + } + + public TTlsSocketClientTransport(IPAddress host, int port, string certificatePath, + RemoteCertificateValidationCallback certValidator = null, + LocalCertificateSelectionCallback localCertificateSelectionCallback = null, + SslProtocols sslProtocols = SslProtocols.Tls12) + : this(host, port, 0, + new X509Certificate2(certificatePath), + certValidator, + localCertificateSelectionCallback, + sslProtocols) + { + } + + public TTlsSocketClientTransport(IPAddress host, int port, + X509Certificate2 certificate = null, + RemoteCertificateValidationCallback certValidator = null, + LocalCertificateSelectionCallback localCertificateSelectionCallback = null, + SslProtocols sslProtocols = SslProtocols.Tls12) + : this(host, port, 0, + certificate, + certValidator, + localCertificateSelectionCallback, + sslProtocols) + { + } + + public TTlsSocketClientTransport(IPAddress host, int port, int timeout, + X509Certificate2 certificate, + RemoteCertificateValidationCallback certValidator = null, + LocalCertificateSelectionCallback localCertificateSelectionCallback = null, + SslProtocols sslProtocols = SslProtocols.Tls12) + { + _host = host; + _port = port; + _timeout = timeout; + _certificate = certificate; + _certValidator = certValidator; + _localCertificateSelectionCallback = localCertificateSelectionCallback; + _sslProtocols = sslProtocols; + + InitSocket(); + } + + public int Timeout + { + set { _client.ReceiveTimeout = _client.SendTimeout = _timeout = value; } + } + + public TcpClient TcpClient => _client; + + public IPAddress Host => _host; + + public int Port => _port; + + public override bool IsOpen + { + get + { + if (_client == null) + { + return false; + } + + return _client.Connected; + } + } + + private void InitSocket() + { + _client = new TcpClient(); + _client.ReceiveTimeout = _client.SendTimeout = _timeout; + _client.Client.NoDelay = true; + } + + private bool DefaultCertificateValidator(object sender, X509Certificate certificate, X509Chain chain, + SslPolicyErrors sslValidationErrors) + { + return sslValidationErrors == SslPolicyErrors.None; + } + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected"); + } + + if (_host == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host"); + } + + if (_port <= 0) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port"); + } + + if (_client == null) + { + InitSocket(); + } + + if (_client != null) + { + await _client.ConnectAsync(_host, _port); + await SetupTlsAsync(); + } + } + + public async Task SetupTlsAsync() + { + var validator = _certValidator ?? DefaultCertificateValidator; + + if (_localCertificateSelectionCallback != null) + { + _secureStream = new SslStream(_client.GetStream(), false, validator, _localCertificateSelectionCallback); + } + else + { + _secureStream = new SslStream(_client.GetStream(), false, validator); + } + + try + { + if (_isServer) + { + // Server authentication + await + _secureStream.AuthenticateAsServerAsync(_certificate, _certValidator != null, _sslProtocols, + true); + } + else + { + // Client authentication + var certs = _certificate != null + ? new X509CertificateCollection {_certificate} + : new X509CertificateCollection(); + + await _secureStream.AuthenticateAsClientAsync(_host.ToString(), certs, _sslProtocols, true); + } + } + catch (Exception) + { + Close(); + throw; + } + + InputStream = _secureStream; + OutputStream = _secureStream; + } + + public override void Close() + { + base.Close(); + if (_client != null) + { + _client.Dispose(); + _client = null; + } + + if (_secureStream != null) + { + _secureStream.Dispose(); + _secureStream = null; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs b/lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs new file mode 100644 index 00000000000..607374135ad --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs @@ -0,0 +1,113 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using Thrift.Protocols; +using Thrift.Transports.Client; + +namespace Thrift.Transports.Server +{ + // ReSharper disable once InconsistentNaming + public class THttpServerTransport + { + protected const string ContentType = "application/x-thrift"; + private readonly ILogger _logger; + private readonly RequestDelegate _next; + protected Encoding Encoding = Encoding.UTF8; + + protected ITProtocolFactory InputProtocolFactory; + protected ITProtocolFactory OutputProtocolFactory; + + protected ITAsyncProcessor Processor; + + public THttpServerTransport(ITAsyncProcessor processor, RequestDelegate next, ILoggerFactory loggerFactory) + : this(processor, new TBinaryProtocol.Factory(), next, loggerFactory) + { + } + + public THttpServerTransport(ITAsyncProcessor processor, ITProtocolFactory protocolFactory, RequestDelegate next, + ILoggerFactory loggerFactory) + : this(processor, protocolFactory, protocolFactory, next, loggerFactory) + { + } + + public THttpServerTransport(ITAsyncProcessor processor, ITProtocolFactory inputProtocolFactory, + ITProtocolFactory outputProtocolFactory, RequestDelegate next, ILoggerFactory loggerFactory) + { + if (processor == null) + { + throw new ArgumentNullException(nameof(processor)); + } + + if (inputProtocolFactory == null) + { + throw new ArgumentNullException(nameof(inputProtocolFactory)); + } + + if (outputProtocolFactory == null) + { + throw new ArgumentNullException(nameof(outputProtocolFactory)); + } + + if (loggerFactory == null) + { + throw new ArgumentNullException(nameof(loggerFactory)); + } + + Processor = processor; + InputProtocolFactory = inputProtocolFactory; + OutputProtocolFactory = outputProtocolFactory; + + _next = next; + _logger = loggerFactory.CreateLogger(); + } + + public async Task Invoke(HttpContext context) + { + context.Response.ContentType = ContentType; + await ProcessRequestAsync(context, context.RequestAborted); //TODO: check for correct logic + } + + public async Task ProcessRequestAsync(HttpContext context, CancellationToken cancellationToken) + { + var transport = new TStreamClientTransport(context.Request.Body, context.Response.Body); + + try + { + var input = InputProtocolFactory.GetProtocol(transport); + var output = OutputProtocolFactory.GetProtocol(transport); + + while (await Processor.ProcessAsync(input, output, cancellationToken)) + { + } + } + catch (TTransportException) + { + // Client died, just move on + } + finally + { + transport.Close(); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs b/lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs new file mode 100644 index 00000000000..01195d4a42c --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs @@ -0,0 +1,191 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.IO.Pipes; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports.Server +{ + // ReSharper disable once InconsistentNaming + public class TNamedPipeServerTransport : TServerTransport + { + /// + /// This is the address of the Pipe on the localhost. + /// + private readonly string _pipeAddress; + + private bool _asyncMode = true; + private volatile bool _isPending = true; + + private NamedPipeServerStream _stream = null; + + public TNamedPipeServerTransport(string pipeAddress) + { + _pipeAddress = pipeAddress; + } + + public override void Listen() + { + // nothing to do here + } + + public override void Close() + { + if (_stream != null) + { + try + { + //TODO: check for disconection + _stream.Disconnect(); + _stream.Dispose(); + } + finally + { + _stream = null; + _isPending = false; + } + } + } + + public override bool IsClientPending() + { + return _isPending; + } + + private void EnsurePipeInstance() + { + if (_stream == null) + { + var direction = PipeDirection.InOut; + var maxconn = 254; + var mode = PipeTransmissionMode.Byte; + var options = _asyncMode ? PipeOptions.Asynchronous : PipeOptions.None; + var inbuf = 4096; + var outbuf = 4096; + // TODO: security + + try + { + _stream = new NamedPipeServerStream(_pipeAddress, direction, maxconn, mode, options, inbuf, outbuf); + } + catch (NotImplementedException) // Mono still does not support async, fallback to sync + { + if (_asyncMode) + { + options &= (~PipeOptions.Asynchronous); + _stream = new NamedPipeServerStream(_pipeAddress, direction, maxconn, mode, options, inbuf, + outbuf); + _asyncMode = false; + } + else + { + throw; + } + } + } + } + + protected override async Task AcceptImplementationAsync(CancellationToken cancellationToken) + { + try + { + EnsurePipeInstance(); + + await _stream.WaitForConnectionAsync(cancellationToken); + + var trans = new ServerTransport(_stream); + _stream = null; // pass ownership to ServerTransport + + //_isPending = false; + + return trans; + } + catch (TTransportException) + { + Close(); + throw; + } + catch (Exception e) + { + Close(); + throw new TTransportException(TTransportException.ExceptionType.NotOpen, e.Message); + } + } + + private class ServerTransport : TClientTransport + { + private readonly NamedPipeServerStream _stream; + + public ServerTransport(NamedPipeServerStream stream) + { + _stream = stream; + } + + public override bool IsOpen => _stream != null && _stream.IsConnected; + + public override async Task OpenAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + public override void Close() + { + _stream?.Dispose(); + } + + public override async Task ReadAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + if (_stream == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + return await _stream.ReadAsync(buffer, offset, length, cancellationToken); + } + + public override async Task WriteAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + if (_stream == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen); + } + + await _stream.WriteAsync(buffer, offset, length, cancellationToken); + } + + public override async Task FlushAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + await Task.FromCanceled(cancellationToken); + } + } + + protected override void Dispose(bool disposing) + { + _stream?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs b/lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs new file mode 100644 index 00000000000..af154ef6f85 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs @@ -0,0 +1,162 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Net; +using System.Net.Sockets; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Transports.Client; + +namespace Thrift.Transports.Server +{ + // ReSharper disable once InconsistentNaming + public class TServerSocketTransport : TServerTransport + { + private readonly int _clientTimeout; + private readonly int _port; + private readonly bool _useBufferedSockets; + private TcpListener _server; + + public TServerSocketTransport(TcpListener listener) + : this(listener, 0) + { + } + + public TServerSocketTransport(TcpListener listener, int clientTimeout) + { + _server = listener; + _clientTimeout = clientTimeout; + } + + public TServerSocketTransport(int port) + : this(port, 0) + { + } + + public TServerSocketTransport(int port, int clientTimeout) + : this(port, clientTimeout, false) + { + } + + public TServerSocketTransport(int port, int clientTimeout, bool useBufferedSockets) + { + _port = port; + _clientTimeout = clientTimeout; + _useBufferedSockets = useBufferedSockets; + try + { + // Make server socket + _server = new TcpListener(IPAddress.Any, _port); + _server.Server.NoDelay = true; + } + catch (Exception) + { + _server = null; + throw new TTransportException("Could not create ServerSocket on port " + port + "."); + } + } + + public override void Listen() + { + // Make sure not to block on accept + if (_server != null) + { + try + { + _server.Start(); + } + catch (SocketException sx) + { + throw new TTransportException("Could not accept on listening socket: " + sx.Message); + } + } + } + + public override bool IsClientPending() + { + return _server.Pending(); + } + + protected override async Task AcceptImplementationAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + if (_server == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); + } + + try + { + TSocketClientTransport tSocketTransport = null; + var tcpClient = await _server.AcceptTcpClientAsync(); + + try + { + tSocketTransport = new TSocketClientTransport(tcpClient) + { + Timeout = _clientTimeout + }; + + if (_useBufferedSockets) + { + return new TBufferedClientTransport(tSocketTransport); + } + + return tSocketTransport; + } + catch (Exception) + { + if (tSocketTransport != null) + { + tSocketTransport.Dispose(); + } + else // Otherwise, clean it up ourselves. + { + ((IDisposable) tcpClient).Dispose(); + } + + throw; + } + } + catch (Exception ex) + { + throw new TTransportException(ex.ToString()); + } + } + + public override void Close() + { + if (_server != null) + { + try + { + _server.Stop(); + } + catch (Exception ex) + { + throw new TTransportException("WARNING: Could not close server socket: " + ex); + } + _server = null; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs b/lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs new file mode 100644 index 00000000000..49abdac868d --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs @@ -0,0 +1,156 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Net; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; +using Thrift.Transports.Client; + +namespace Thrift.Transports.Server +{ + // ReSharper disable once InconsistentNaming + public class TTlsServerSocketTransport : TServerTransport + { + private readonly RemoteCertificateValidationCallback _clientCertValidator; + private readonly int _clientTimeout = 0; + private readonly LocalCertificateSelectionCallback _localCertificateSelectionCallback; + private readonly int _port; + private readonly X509Certificate2 _serverCertificate; + private readonly SslProtocols _sslProtocols; + private readonly bool _useBufferedSockets; + private TcpListener _server; + + public TTlsServerSocketTransport(int port, X509Certificate2 certificate) + : this(port, false, certificate) + { + } + + public TTlsServerSocketTransport( + int port, + bool useBufferedSockets, + X509Certificate2 certificate, + RemoteCertificateValidationCallback clientCertValidator = null, + LocalCertificateSelectionCallback localCertificateSelectionCallback = null, + SslProtocols sslProtocols = SslProtocols.Tls12) + { + if (!certificate.HasPrivateKey) + { + throw new TTransportException(TTransportException.ExceptionType.Unknown, + "Your server-certificate needs to have a private key"); + } + + _port = port; + _serverCertificate = certificate; + _useBufferedSockets = useBufferedSockets; + _clientCertValidator = clientCertValidator; + _localCertificateSelectionCallback = localCertificateSelectionCallback; + _sslProtocols = sslProtocols; + + try + { + // Create server socket + _server = new TcpListener(IPAddress.Any, _port); + _server.Server.NoDelay = true; + } + catch (Exception) + { + _server = null; + throw new TTransportException($"Could not create ServerSocket on port {port}."); + } + } + + public override void Listen() + { + // Make sure accept is not blocking + if (_server != null) + { + try + { + _server.Start(); + } + catch (SocketException sx) + { + throw new TTransportException($"Could not accept on listening socket: {sx.Message}"); + } + } + } + + public override bool IsClientPending() + { + return _server.Pending(); + } + + protected override async Task AcceptImplementationAsync(CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + if (_server == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); + } + + try + { + var client = await _server.AcceptTcpClientAsync(); + client.SendTimeout = client.ReceiveTimeout = _clientTimeout; + + //wrap the client in an SSL Socket passing in the SSL cert + var tTlsSocket = new TTlsSocketClientTransport(client, _serverCertificate, true, _clientCertValidator, + _localCertificateSelectionCallback, _sslProtocols); + + await tTlsSocket.SetupTlsAsync(); + + if (_useBufferedSockets) + { + var trans = new TBufferedClientTransport(tTlsSocket); + return trans; + } + + return tTlsSocket; + } + catch (Exception ex) + { + throw new TTransportException(ex.ToString()); + } + } + + public override void Close() + { + if (_server != null) + { + try + { + _server.Stop(); + } + catch (Exception ex) + { + throw new TTransportException($"WARNING: Could not close server socket: {ex}"); + } + + _server = null; + } + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/TClientTransport.cs b/lib/netcore/src/Thrift/Transports/TClientTransport.cs new file mode 100644 index 00000000000..cee0a0075cb --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/TClientTransport.cs @@ -0,0 +1,178 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports +{ + //TODO: think about client info + // ReSharper disable once InconsistentNaming + public abstract class TClientTransport : IDisposable + { + private readonly byte[] _peekBuffer = new byte[1]; + private bool _hasPeekByte; + public abstract bool IsOpen { get; } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + public async Task PeekAsync(CancellationToken cancellationToken) + { + //If we already have a byte read but not consumed, do nothing. + if (_hasPeekByte) + { + return true; + } + + //If transport closed we can't peek. + if (!IsOpen) + { + return false; + } + + //Try to read one byte. If succeeds we will need to store it for the next read. + try + { + var bytes = await ReadAsync(_peekBuffer, 0, 1, cancellationToken); + if (bytes == 0) + { + return false; + } + } + catch (IOException) + { + return false; + } + + _hasPeekByte = true; + return true; + } + + public virtual async Task OpenAsync() + { + await OpenAsync(CancellationToken.None); + } + + public abstract Task OpenAsync(CancellationToken cancellationToken); + + public abstract void Close(); + + protected static void ValidateBufferArgs(byte[] buffer, int offset, int length) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (offset < 0) + { + throw new ArgumentOutOfRangeException(nameof(offset), "Buffer offset is smaller than zero."); + } + + if (length < 0) + { + throw new ArgumentOutOfRangeException(nameof(length), "Buffer length is smaller than zero."); + } + + if (offset + length > buffer.Length) + { + throw new ArgumentOutOfRangeException(nameof(buffer), "Not enough data."); + } + } + + public virtual async Task ReadAsync(byte[] buffer, int offset, int length) + { + return await ReadAsync(buffer, offset, length, CancellationToken.None); + } + + public abstract Task ReadAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken); + + public virtual async Task ReadAllAsync(byte[] buffer, int offset, int length) + { + return await ReadAllAsync(buffer, offset, length, CancellationToken.None); + } + + public virtual async Task ReadAllAsync(byte[] buffer, int offset, int length, + CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, length); + + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var retrieved = 0; + + //If we previously peeked a byte, we need to use that first. + if (_hasPeekByte) + { + buffer[offset + retrieved++] = _peekBuffer[0]; + _hasPeekByte = false; + } + + while (retrieved < length) + { + if (cancellationToken.IsCancellationRequested) + { + return await Task.FromCanceled(cancellationToken); + } + + var returnedCount = await ReadAsync(buffer, offset + retrieved, length - retrieved, cancellationToken); + if (returnedCount <= 0) + { + throw new TTransportException(TTransportException.ExceptionType.EndOfFile, + "Cannot read, Remote side has closed"); + } + retrieved += returnedCount; + } + return retrieved; + } + + public virtual async Task WriteAsync(byte[] buffer) + { + await WriteAsync(buffer, CancellationToken.None); + } + + public virtual async Task WriteAsync(byte[] buffer, CancellationToken cancellationToken) + { + await WriteAsync(buffer, 0, buffer.Length, CancellationToken.None); + } + + public virtual async Task WriteAsync(byte[] buffer, int offset, int length) + { + await WriteAsync(buffer, offset, length, CancellationToken.None); + } + + public abstract Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken); + + public virtual async Task FlushAsync() + { + await FlushAsync(CancellationToken.None); + } + + public abstract Task FlushAsync(CancellationToken cancellationToken); + + protected abstract void Dispose(bool disposing); + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/TServerTransport.cs b/lib/netcore/src/Thrift/Transports/TServerTransport.cs new file mode 100644 index 00000000000..d49feb6a075 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/TServerTransport.cs @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Threading; +using System.Threading.Tasks; + +namespace Thrift.Transports +{ + // ReSharper disable once InconsistentNaming + public abstract class TServerTransport + { + public abstract void Listen(); + public abstract void Close(); + public abstract bool IsClientPending(); + + protected virtual async Task AcceptImplementationAsync() + { + return await AcceptImplementationAsync(CancellationToken.None); + } + + protected abstract Task AcceptImplementationAsync(CancellationToken cancellationToken); + + public async Task AcceptAsync() + { + return await AcceptAsync(CancellationToken.None); + } + + public async Task AcceptAsync(CancellationToken cancellationToken) + { + var transport = await AcceptImplementationAsync(cancellationToken); + + if (transport == null) + { + throw new TTransportException("AcceptAsync() should not return null"); + } + + return transport; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/TTransportException.cs b/lib/netcore/src/Thrift/Transports/TTransportException.cs new file mode 100644 index 00000000000..b7c42e33a87 --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/TTransportException.cs @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Transports +{ + // ReSharper disable once InconsistentNaming + public class TTransportException : TException + { + public enum ExceptionType + { + Unknown, + NotOpen, + AlreadyOpen, + TimedOut, + EndOfFile, + Interrupted + } + + protected ExceptionType ExType; + + public TTransportException() + { + } + + public TTransportException(ExceptionType exType) + : this() + { + ExType = exType; + } + + public TTransportException(ExceptionType exType, string message) + : base(message) + { + ExType = exType; + } + + public TTransportException(string message) + : base(message) + { + } + + public ExceptionType Type => ExType; + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/Transports/TTransportFactory.cs b/lib/netcore/src/Thrift/Transports/TTransportFactory.cs new file mode 100644 index 00000000000..26c3cc4714d --- /dev/null +++ b/lib/netcore/src/Thrift/Transports/TTransportFactory.cs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Transports +{ + /// + /// From Mark Slee & Aditya Agarwal of Facebook: + /// Factory class used to create wrapped instance of Transports. + /// This is used primarily in servers, which get Transports from + /// a ServerTransport and then may want to mutate them (i.e. create + /// a BufferedTransport from the underlying base transport) + /// + // ReSharper disable once InconsistentNaming + public class TTransportFactory + { + public virtual TClientTransport GetTransport(TClientTransport trans) + { + return trans; + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/Thrift/project.json b/lib/netcore/src/Thrift/project.json new file mode 100644 index 00000000000..0eda41eac23 --- /dev/null +++ b/lib/netcore/src/Thrift/project.json @@ -0,0 +1,19 @@ +{ + "version": "1.0.0-*", + "dependencies": { + "Microsoft.AspNetCore.Http": "1.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "NETStandard.Library": "1.6.0", + "System.IO.Pipes": "4.0.0", + "System.Net.NameResolution": "4.0.0", + "System.Net.Requests": "4.0.11", + "System.Net.Security": "4.0.0" + }, + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} \ No newline at end of file diff --git a/lib/netcore/src/global.json b/lib/netcore/src/global.json new file mode 100644 index 00000000000..8c0927574d9 --- /dev/null +++ b/lib/netcore/src/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "." ] +} \ No newline at end of file diff --git a/test/netcore/.gitignore b/test/netcore/.gitignore new file mode 100644 index 00000000000..f7842c38f0e --- /dev/null +++ b/test/netcore/.gitignore @@ -0,0 +1,5 @@ +# generic ignores +!gen-* +bin/ +obj/ +*.lock.json \ No newline at end of file diff --git a/test/netcore/ThriftTest/Program.cs b/test/netcore/ThriftTest/Program.cs new file mode 100644 index 00000000000..d8aea1df481 --- /dev/null +++ b/test/netcore/ThriftTest/Program.cs @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using Test; + +namespace ThirftTest +{ + public class Program + { + public static int Main(string[] args) + { + if (args.Length == 0) + { + Console.WriteLine("must provide 'server' or 'client' arg"); + return -1; + } + + try + { + Console.SetBufferSize(Console.BufferWidth, 4096); + } + catch (Exception) + { + Console.WriteLine("Failed to grow scroll-back buffer"); + } + + var subArgs = new string[args.Length - 1]; + for (var i = 1; i < args.Length; i++) + { + subArgs[i - 1] = args[i]; + } + + if (args[0] == "client") + { + return TestClient.Execute(subArgs); + } + + if (args[0] == "server") + { + return TestServer.Execute(subArgs) ? 0 : 1; + } + + Console.WriteLine("first argument must be 'server' or 'client'"); + return 0; + } + } +} + + diff --git a/test/netcore/ThriftTest/Properties/AssemblyInfo.cs b/test/netcore/ThriftTest/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..f6801b4f38c --- /dev/null +++ b/test/netcore/ThriftTest/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ThirftTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("$safeprojectname$")] +[assembly: AssemblyCopyright("Copyright © 116")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("B0C13DA0-3117-4844-8AE8-B1775E46223D")] + diff --git a/test/netcore/ThriftTest/Properties/launchSettings.json b/test/netcore/ThriftTest/Properties/launchSettings.json new file mode 100644 index 00000000000..ddafa79a4ab --- /dev/null +++ b/test/netcore/ThriftTest/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "ThriftTest": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/test/netcore/ThriftTest/TestClient.cs b/test/netcore/ThriftTest/TestClient.cs new file mode 100644 index 00000000000..7226d8017ff --- /dev/null +++ b/test/netcore/ThriftTest/TestClient.cs @@ -0,0 +1,862 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using thrift.test; +using Thrift.Collections; +using Thrift.Protocols; +using Thrift.Transports; +using Thrift.Transports.Client; + +namespace Test +{ + public class TestClient + { + private class TestParams + { + public int numIterations = 1; + public IPAddress host = IPAddress.Loopback; + public int port = 9090; + public string url; + public string pipe; + public bool buffered; + public bool framed; + public string protocol; + public bool encrypted = false; + + public TClientTransport CreateTransport() + { + if (url == null) + { + // endpoint transport + TClientTransport trans = null; + + if (pipe != null) + { + trans = new TNamedPipeClientTransport(pipe); + } + else + { + if (encrypted) + { + var certPath = "../../keys/client.p12"; + var cert = new X509Certificate2(certPath, "thrift"); + trans = new TTlsSocketClientTransport(host, port, 0, cert, (o, c, chain, errors) => true, null, SslProtocols.Tls); + } + else + { + trans = new TSocketClientTransport(host, port); + } + } + + // layered transport + if (buffered) + { + trans = new TBufferedClientTransport(trans); + } + + if (framed) + { + trans = new TFramedClientTransport(trans); + } + + return trans; + } + + return new THttpClientTransport(new Uri(url), null); + } + + public TProtocol CreateProtocol(TClientTransport transport) + { + if (protocol == "compact") + { + return new TCompactProtocol(transport); + } + + if (protocol == "json") + { + return new TJsonProtocol(transport); + } + + return new TBinaryProtocol(transport); + } + } + + private const int ErrorBaseTypes = 1; + private const int ErrorStructs = 2; + private const int ErrorContainers = 4; + private const int ErrorExceptions = 8; + private const int ErrorUnknown = 64; + + private class ClientTest + { + private readonly TClientTransport transport; + private readonly ThriftTest.Client client; + private readonly int numIterations; + private bool done; + + public int ReturnCode { get; set; } + + public ClientTest(TestParams param) + { + transport = param.CreateTransport(); + client = new ThriftTest.Client(param.CreateProtocol(transport)); + numIterations = param.numIterations; + } + + public void Execute() + { + var token = CancellationToken.None; + + if (done) + { + Console.WriteLine("Execute called more than once"); + throw new InvalidOperationException(); + } + + for (var i = 0; i < numIterations; i++) + { + try + { + if (!transport.IsOpen) + { + transport.OpenAsync(token).GetAwaiter().GetResult(); + } + } + catch (TTransportException ex) + { + Console.WriteLine("*** FAILED ***"); + Console.WriteLine("Connect failed: " + ex.Message); + ReturnCode |= ErrorUnknown; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + continue; + } + + try + { + ReturnCode |= ExecuteClientTestAsync(client).GetAwaiter().GetResult(); ; + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + ReturnCode |= ErrorUnknown; + } + } + try + { + transport.Close(); + } + catch (Exception ex) + { + Console.WriteLine("Error while closing transport"); + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + done = true; + } + } + + public static int Execute(string[] args) + { + try + { + var param = new TestParams(); + var numThreads = 1; + try + { + for (var i = 0; i < args.Length; i++) + { + if (args[i] == "-u") + { + param.url = args[++i]; + } + else if (args[i] == "-n") + { + param.numIterations = Convert.ToInt32(args[++i]); + } + else if (args[i] == "-pipe") // -pipe + { + param.pipe = args[++i]; + Console.WriteLine("Using named pipes transport"); + } + else if (args[i].Contains("--host=")) + { + // check there for ipaddress + param.host = new IPAddress(Encoding.Unicode.GetBytes(args[i].Substring(args[i].IndexOf("=") + 1))); + } + else if (args[i].Contains("--port=")) + { + param.port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); + } + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") + { + param.buffered = true; + Console.WriteLine("Using buffered sockets"); + } + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") + { + param.framed = true; + Console.WriteLine("Using framed transport"); + } + else if (args[i] == "-t") + { + numThreads = Convert.ToInt32(args[++i]); + } + else if (args[i] == "--compact" || args[i] == "--protocol=compact") + { + param.protocol = "compact"; + Console.WriteLine("Using compact protocol"); + } + else if (args[i] == "--json" || args[i] == "--protocol=json") + { + param.protocol = "json"; + Console.WriteLine("Using JSON protocol"); + } + else if (args[i] == "--ssl") + { + param.encrypted = true; + Console.WriteLine("Using encrypted transport"); + } + } + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + Console.WriteLine("Error while parsing arguments"); + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + return ErrorUnknown; + } + + var tests = Enumerable.Range(0, numThreads).Select(_ => new ClientTest(param)).ToArray(); + + //issue tests on separate threads simultaneously + var threads = tests.Select(test => new Thread(test.Execute)).ToArray(); + var start = DateTime.Now; + foreach (var t in threads) + { + t.Start(); + } + + foreach (var t in threads) + { + t.Join(); + } + + Console.WriteLine("Total time: " + (DateTime.Now - start)); + Console.WriteLine(); + return tests.Select(t => t.ReturnCode).Aggregate((r1, r2) => r1 | r2); + } + catch (Exception outerEx) + { + Console.WriteLine("*** FAILED ***"); + Console.WriteLine("Unexpected error"); + Console.WriteLine(outerEx.Message + " ST: " + outerEx.StackTrace); + return ErrorUnknown; + } + } + + public static string BytesToHex(byte[] data) + { + return BitConverter.ToString(data).Replace("-", string.Empty); + } + + public static byte[] PrepareTestData(bool randomDist) + { + var retval = new byte[0x100]; + var initLen = Math.Min(0x100, retval.Length); + + // linear distribution, unless random is requested + if (!randomDist) + { + for (var i = 0; i < initLen; ++i) + { + retval[i] = (byte)i; + } + return retval; + } + + // random distribution + for (var i = 0; i < initLen; ++i) + { + retval[i] = (byte)0; + } + var rnd = new Random(); + for (var i = 1; i < initLen; ++i) + { + while (true) + { + var nextPos = rnd.Next() % initLen; + if (retval[nextPos] == 0) + { + retval[nextPos] = (byte)i; + break; + } + } + } + return retval; + } + + public static async Task ExecuteClientTestAsync(ThriftTest.Client client) + { + var token = CancellationToken.None; + var returnCode = 0; + + Console.Write("testVoid()"); + await client.testVoidAsync(token); + Console.WriteLine(" = void"); + + Console.Write("testString(\"Test\")"); + var s = await client.testStringAsync("Test", token); + Console.WriteLine(" = \"" + s + "\""); + if ("Test" != s) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + Console.Write("testBool(true)"); + var t = await client.testBoolAsync((bool)true, token); + Console.WriteLine(" = " + t); + if (!t) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + Console.Write("testBool(false)"); + var f = await client.testBoolAsync((bool)false, token); + Console.WriteLine(" = " + f); + if (f) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + Console.Write("testByte(1)"); + var i8 = await client.testByteAsync((sbyte)1, token); + Console.WriteLine(" = " + i8); + if (1 != i8) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + Console.Write("testI32(-1)"); + var i32 = await client.testI32Async(-1, token); + Console.WriteLine(" = " + i32); + if (-1 != i32) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + Console.Write("testI64(-34359738368)"); + var i64 = await client.testI64Async(-34359738368, token); + Console.WriteLine(" = " + i64); + if (-34359738368 != i64) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + // TODO: Validate received message + Console.Write("testDouble(5.325098235)"); + var dub = await client.testDoubleAsync(5.325098235, token); + Console.WriteLine(" = " + dub); + if (5.325098235 != dub) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + Console.Write("testDouble(-0.000341012439638598279)"); + dub = await client.testDoubleAsync(-0.000341012439638598279, token); + Console.WriteLine(" = " + dub); + if (-0.000341012439638598279 != dub) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + var binOut = PrepareTestData(true); + Console.Write("testBinary(" + BytesToHex(binOut) + ")"); + try + { + var binIn = await client.testBinaryAsync(binOut, token); + Console.WriteLine(" = " + BytesToHex(binIn)); + if (binIn.Length != binOut.Length) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + for (var ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs) + if (binIn[ofs] != binOut[ofs]) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + } + catch (Thrift.TApplicationException ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + + // binary equals? only with hashcode option enabled ... + Console.WriteLine("Test CrazyNesting"); + var one = new CrazyNesting(); + var two = new CrazyNesting(); + one.String_field = "crazy"; + two.String_field = "crazy"; + one.Binary_field = new byte[] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; + two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; + if (typeof(CrazyNesting).GetMethod("Equals")?.DeclaringType == typeof(CrazyNesting)) + { + if (!one.Equals(two)) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorContainers; + throw new Exception("CrazyNesting.Equals failed"); + } + } + + // TODO: Validate received message + Console.Write("testStruct({\"Zero\", 1, -3, -5})"); + var o = new Xtruct(); + o.String_thing = "Zero"; + o.Byte_thing = (sbyte)1; + o.I32_thing = -3; + o.I64_thing = -5; + var i = await client.testStructAsync(o, token); + Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}"); + + // TODO: Validate received message + Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})"); + var o2 = new Xtruct2(); + o2.Byte_thing = (sbyte)1; + o2.Struct_thing = o; + o2.I32_thing = 5; + var i2 = await client.testNestAsync(o2, token); + i = i2.Struct_thing; + Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}"); + + var mapout = new Dictionary(); + for (var j = 0; j < 5; j++) + { + mapout[j] = j - 10; + } + Console.Write("testMap({"); + var first = true; + foreach (var key in mapout.Keys) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(key + " => " + mapout[key]); + } + Console.Write("})"); + + var mapin = await client.testMapAsync(mapout, token); + + Console.Write(" = {"); + first = true; + foreach (var key in mapin.Keys) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(key + " => " + mapin[key]); + } + Console.WriteLine("}"); + + // TODO: Validate received message + var listout = new List(); + for (var j = -2; j < 3; j++) + { + listout.Add(j); + } + Console.Write("testList({"); + first = true; + foreach (var j in listout) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(j); + } + Console.Write("})"); + + var listin = await client.testListAsync(listout, token); + + Console.Write(" = {"); + first = true; + foreach (var j in listin) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(j); + } + Console.WriteLine("}"); + + //set + // TODO: Validate received message + var setout = new THashSet(); + for (var j = -2; j < 3; j++) + { + setout.Add(j); + } + Console.Write("testSet({"); + first = true; + foreach (int j in setout) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(j); + } + Console.Write("})"); + + var setin = await client.testSetAsync(setout, token); + + Console.Write(" = {"); + first = true; + foreach (int j in setin) + { + if (first) + { + first = false; + } + else + { + Console.Write(", "); + } + Console.Write(j); + } + Console.WriteLine("}"); + + + Console.Write("testEnum(ONE)"); + var ret = await client.testEnumAsync(Numberz.ONE, token); + Console.WriteLine(" = " + ret); + if (Numberz.ONE != ret) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + Console.Write("testEnum(TWO)"); + ret = await client.testEnumAsync(Numberz.TWO, token); + Console.WriteLine(" = " + ret); + if (Numberz.TWO != ret) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + Console.Write("testEnum(THREE)"); + ret = await client.testEnumAsync(Numberz.THREE, token); + Console.WriteLine(" = " + ret); + if (Numberz.THREE != ret) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + Console.Write("testEnum(FIVE)"); + ret = await client.testEnumAsync(Numberz.FIVE, token); + Console.WriteLine(" = " + ret); + if (Numberz.FIVE != ret) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + Console.Write("testEnum(EIGHT)"); + ret = await client.testEnumAsync(Numberz.EIGHT, token); + Console.WriteLine(" = " + ret); + if (Numberz.EIGHT != ret) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + Console.Write("testTypedef(309858235082523)"); + var uid = await client.testTypedefAsync(309858235082523L, token); + Console.WriteLine(" = " + uid); + if (309858235082523L != uid) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorStructs; + } + + // TODO: Validate received message + Console.Write("testMapMap(1)"); + var mm = await client.testMapMapAsync(1, token); + Console.Write(" = {"); + foreach (var key in mm.Keys) + { + Console.Write(key + " => {"); + var m2 = mm[key]; + foreach (var k2 in m2.Keys) + { + Console.Write(k2 + " => " + m2[k2] + ", "); + } + Console.Write("}, "); + } + Console.WriteLine("}"); + + // TODO: Validate received message + var insane = new Insanity(); + insane.UserMap = new Dictionary(); + insane.UserMap[Numberz.FIVE] = 5000L; + var truck = new Xtruct(); + truck.String_thing = "Truck"; + truck.Byte_thing = (sbyte)8; + truck.I32_thing = 8; + truck.I64_thing = 8; + insane.Xtructs = new List(); + insane.Xtructs.Add(truck); + Console.Write("testInsanity()"); + var whoa = await client.testInsanityAsync(insane, token); + Console.Write(" = {"); + foreach (var key in whoa.Keys) + { + var val = whoa[key]; + Console.Write(key + " => {"); + + foreach (var k2 in val.Keys) + { + var v2 = val[k2]; + + Console.Write(k2 + " => {"); + var userMap = v2.UserMap; + + Console.Write("{"); + if (userMap != null) + { + foreach (var k3 in userMap.Keys) + { + Console.Write(k3 + " => " + userMap[k3] + ", "); + } + } + else + { + Console.Write("null"); + } + Console.Write("}, "); + + var xtructs = v2.Xtructs; + + Console.Write("{"); + if (xtructs != null) + { + foreach (var x in xtructs) + { + Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, "); + } + } + else + { + Console.Write("null"); + } + Console.Write("}"); + + Console.Write("}, "); + } + Console.Write("}, "); + } + Console.WriteLine("}"); + + sbyte arg0 = 1; + var arg1 = 2; + var arg2 = long.MaxValue; + var multiDict = new Dictionary(); + multiDict[1] = "one"; + var arg4 = Numberz.FIVE; + long arg5 = 5000000; + Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")"); + var multiResponse = await client.testMultiAsync(arg0, arg1, arg2, multiDict, arg4, arg5, token); + Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); + + try + { + Console.WriteLine("testException(\"Xception\")"); + await client.testExceptionAsync("Xception", token); + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + catch (Xception ex) + { + if (ex.ErrorCode != 1001 || ex.Message != "Xception") + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + try + { + Console.WriteLine("testException(\"TException\")"); + await client.testExceptionAsync("TException", token); + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + catch (Thrift.TException) + { + // OK + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + try + { + Console.WriteLine("testException(\"ok\")"); + await client.testExceptionAsync("ok", token); + // OK + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + + try + { + Console.WriteLine("testMultiException(\"Xception\", ...)"); + await client.testMultiExceptionAsync("Xception", "ignore", token); + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + catch (Xception ex) + { + if (ex.ErrorCode != 1001 || ex.Message != "This is an Xception") + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + try + { + Console.WriteLine("testMultiException(\"Xception2\", ...)"); + await client.testMultiExceptionAsync("Xception2", "ignore", token); + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + catch (Xception2 ex) + { + if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2") + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + try + { + Console.WriteLine("testMultiException(\"success\", \"OK\")"); + if ("OK" != (await client.testMultiExceptionAsync("success", "OK", token)).String_thing) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + } + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorExceptions; + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + } + + var sw = new Stopwatch(); + sw.Start(); + Console.WriteLine("Test Oneway(1)"); + await client.testOnewayAsync(1, token); + sw.Stop(); + if (sw.ElapsedMilliseconds > 1000) + { + Console.WriteLine("*** FAILED ***"); + returnCode |= ErrorBaseTypes; + } + + Console.Write("Test Calltime()"); + var times = 50; + sw.Reset(); + sw.Start(); + for (var k = 0; k < times; ++k) + await client.testVoidAsync(token); + sw.Stop(); + Console.WriteLine(" = {0} ms a testVoid() call", sw.ElapsedMilliseconds / times); + return returnCode; + } + } +} \ No newline at end of file diff --git a/test/netcore/ThriftTest/TestServer.cs b/test/netcore/ThriftTest/TestServer.cs new file mode 100644 index 00000000000..ad26ffd2819 --- /dev/null +++ b/test/netcore/ThriftTest/TestServer.cs @@ -0,0 +1,527 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using thrift.test; +using Thrift; +using Thrift.Collections; +using Thrift.Protocols; +using Thrift.Server; +using Thrift.Transports; +using Thrift.Transports.Server; + +namespace Test +{ + public class TestServer + { + public static int _clientID = -1; + public delegate void TestLogDelegate(string msg, params object[] values); + + public class TradeServerEventHandler : TServerEventHandler + { + public int callCount = 0; + + public Task PreServeAsync(CancellationToken cancellationToken) + { + callCount++; + return Task.CompletedTask; + } + + public Task CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken) + { + callCount++; + return Task.FromResult(null); + } + + public Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output, CancellationToken cancellationToken) + { + callCount++; + return Task.CompletedTask; + } + + public Task ProcessContextAsync(object serverContext, TClientTransport transport, CancellationToken cancellationToken) + { + callCount++; + return Task.CompletedTask; + } + }; + + public class TestHandlerAsync : ThriftTest.IAsync + { + public TBaseServer server { get; set; } + private int handlerID; + private StringBuilder reusableStringBuilder = new StringBuilder(); + private TestLogDelegate testLogDelegate; + + public TestHandlerAsync() + { + handlerID = Interlocked.Increment(ref _clientID); + testLogDelegate += testConsoleLogger; + testLogDelegate.Invoke("New TestHandler instance created"); + } + + public void testConsoleLogger(string msg, params object[] values) + { + reusableStringBuilder.Clear(); + reusableStringBuilder.AppendFormat("handler{0:D3}:", handlerID); + reusableStringBuilder.AppendFormat(msg, values); + reusableStringBuilder.AppendLine(); + Console.Write(reusableStringBuilder.ToString()); + } + + public Task testVoidAsync(CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testVoid()"); + return Task.CompletedTask; + } + + public Task testStringAsync(string thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testString({0})", thing); + return Task.FromResult(thing); + } + + public Task testBoolAsync(bool thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testBool({0})", thing); + return Task.FromResult(thing); + } + + public Task testByteAsync(sbyte thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testByte({0})", thing); + return Task.FromResult(thing); + } + + public Task testI32Async(int thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testI32({0})", thing); + return Task.FromResult(thing); + } + + public Task testI64Async(long thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testI64({0})", thing); + return Task.FromResult(thing); + } + + public Task testDoubleAsync(double thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testDouble({0})", thing); + return Task.FromResult(thing); + } + + public Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) + { + var hex = BitConverter.ToString(thing).Replace("-", string.Empty); + testLogDelegate.Invoke("testBinary({0:X})", hex); + return Task.FromResult(thing); + } + + public Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing.String_thing, thing.Byte_thing, thing.I32_thing, thing.I64_thing); + return Task.FromResult(thing); + } + + public Task testNestAsync(Xtruct2 nest, CancellationToken cancellationToken) + { + var thing = nest.Struct_thing; + testLogDelegate.Invoke("testNest({{{0}, {{\"{1}\", {2}, {3}, {4}, {5}}}}})", + nest.Byte_thing, + thing.String_thing, + thing.Byte_thing, + thing.I32_thing, + thing.I64_thing, + nest.I32_thing); + return Task.FromResult(nest); + } + + public Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken) + { + reusableStringBuilder.Clear(); + reusableStringBuilder.Append("testMap({{"); + var first = true; + foreach (var key in thing.Keys) + { + if (first) + { + first = false; + } + else + { + reusableStringBuilder.Append(", "); + } + reusableStringBuilder.AppendFormat("{0} => {1}", key, thing[key]); + } + reusableStringBuilder.Append("}})"); + testLogDelegate.Invoke(reusableStringBuilder.ToString()); + return Task.FromResult(thing); + } + + public Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken) + { + reusableStringBuilder.Clear(); + reusableStringBuilder.Append("testStringMap({{"); + var first = true; + foreach (var key in thing.Keys) + { + if (first) + { + first = false; + } + else + { + reusableStringBuilder.Append(", "); + } + reusableStringBuilder.AppendFormat("{0} => {1}", key, thing[key]); + } + reusableStringBuilder.Append("}})"); + testLogDelegate.Invoke(reusableStringBuilder.ToString()); + return Task.FromResult(thing); + } + + public Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) + { + reusableStringBuilder.Clear(); + reusableStringBuilder.Append("testSet({{"); + var first = true; + foreach (int elem in thing) + { + if (first) + { + first = false; + } + else + { + reusableStringBuilder.Append(", "); + } + reusableStringBuilder.AppendFormat("{0}", elem); + } + reusableStringBuilder.Append("}})"); + testLogDelegate.Invoke(reusableStringBuilder.ToString()); + return Task.FromResult(thing); + } + + public Task> testListAsync(List thing, CancellationToken cancellationToken) + { + reusableStringBuilder.Clear(); + reusableStringBuilder.Append("testList({{"); + var first = true; + foreach (var elem in thing) + { + if (first) + { + first = false; + } + else + { + reusableStringBuilder.Append(", "); + } + reusableStringBuilder.AppendFormat("{0}", elem); + } + reusableStringBuilder.Append("}})"); + testLogDelegate.Invoke(reusableStringBuilder.ToString()); + return Task.FromResult(thing); + } + + public Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testEnum({0})", thing); + return Task.FromResult(thing); + } + + public Task testTypedefAsync(long thing, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testTypedef({0})", thing); + return Task.FromResult(thing); + } + + public Task>> testMapMapAsync(int hello, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testMapMap({0})", hello); + var mapmap = new Dictionary>(); + + var pos = new Dictionary(); + var neg = new Dictionary(); + for (var i = 1; i < 5; i++) + { + pos[i] = i; + neg[-i] = -i; + } + + mapmap[4] = pos; + mapmap[-4] = neg; + + return Task.FromResult(mapmap); + } + + public Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testInsanity()"); + + var hello = new Xtruct + { + String_thing = "Hello2", + Byte_thing = 2, + I32_thing = 2, + I64_thing = 2 + }; + + var goodbye = new Xtruct + { + String_thing = "Goodbye4", + Byte_thing = 4, + I32_thing = 4, + I64_thing = 4 + }; + + var crazy = new Insanity + { + UserMap = new Dictionary {[Numberz.EIGHT] = 8}, + Xtructs = new List {goodbye} + }; + + var looney = new Insanity + { + UserMap = new Dictionary { [Numberz.FIVE] = 5}, + Xtructs = new List() + }; + + looney.Xtructs.Add(hello); + + var first_map = new Dictionary(); + var second_map = new Dictionary(); ; + + first_map[Numberz.TWO] = crazy; + first_map[Numberz.THREE] = crazy; + + second_map[Numberz.SIX] = looney; + + var insane = new Dictionary> + { + [1] = first_map, + [2] = second_map + }; + + return Task.FromResult(insane); + } + + public Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, + CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testMulti()"); + + var hello = new Xtruct(); ; + hello.String_thing = "Hello2"; + hello.Byte_thing = arg0; + hello.I32_thing = arg1; + hello.I64_thing = arg2; + return Task.FromResult(hello); + } + + public Task testExceptionAsync(string arg, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testException({0})", arg); + if (arg == "Xception") + { + var x = new Xception + { + ErrorCode = 1001, + Message = arg + }; + throw x; + } + if (arg == "TException") + { + throw new TException(); + } + return Task.CompletedTask; + } + + public Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testMultiException({0}, {1})", arg0, arg1); + if (arg0 == "Xception") + { + var x = new Xception + { + ErrorCode = 1001, + Message = "This is an Xception" + }; + throw x; + } + + if (arg0 == "Xception2") + { + var x = new Xception2 + { + ErrorCode = 2002, + Struct_thing = new Xtruct {String_thing = "This is an Xception2"} + }; + throw x; + } + + var result = new Xtruct {String_thing = arg1}; + return Task.FromResult(result); + } + + public Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) + { + testLogDelegate.Invoke("testOneway({0}), sleeping...", secondsToSleep); + Thread.Sleep(secondsToSleep * 1000); + testLogDelegate.Invoke("testOneway finished"); + + return Task.CompletedTask; + } + } + + + private enum ProcessorFactoryType + { + TSingletonProcessorFactory, + TPrototypeProcessorFactory, + } + + public static bool Execute(string[] args) + { + var logger = new LoggerFactory().CreateLogger("Test"); + + try + { + bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false; + + var port = 9090; + string pipe = null; + for (var i = 0; i < args.Length; i++) + { + if (args[i] == "-pipe") // -pipe name + { + pipe = args[++i]; + } + else if (args[i].Contains("--port=")) + { + port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); + } + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") + { + useBufferedSockets = true; + } + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") + { + useFramed = true; + } + else if (args[i] == "--compact" || args[i] == "--protocol=compact") + { + compact = true; + } + else if (args[i] == "--json" || args[i] == "--protocol=json") + { + json = true; + } + else if (args[i] == "--threaded" || args[i] == "--server-type=threaded") + { + } + else if (args[i] == "--threadpool" || args[i] == "--server-type=threadpool") + { + } + else if (args[i] == "--prototype" || args[i] == "--processor=prototype") + { + } + else if (args[i] == "--ssl") + { + useEncryption = true; + } + } + + // Transport + TServerTransport trans; + if (pipe != null) + { + trans = new TNamedPipeServerTransport(pipe); + } + else + { + if (useEncryption) + { + var certPath = "../keys/server.p12"; + trans = new TTlsServerSocketTransport(port, useBufferedSockets, new X509Certificate2(certPath, "thrift"), null, null, SslProtocols.Tls12); + } + else + { + trans = new TServerSocketTransport(port, 0, useBufferedSockets); + } + } + + ITProtocolFactory proto; + if (compact) + proto = new TCompactProtocol.Factory(); + else if (json) + proto = new TJsonProtocol.Factory(); + else + proto = new TBinaryProtocol.Factory(); + + ITProcessorFactory processorFactory; + + // Processor + var testHandler = new TestHandlerAsync(); + var testProcessor = new ThriftTest.AsyncProcessor(testHandler); + processorFactory = new SingletonTProcessorFactory(testProcessor); + + + TTransportFactory transFactory; + //if (useFramed) + // transFactory = new TFramedTransport.Factory(); + //else + transFactory = new TTransportFactory(); + + TBaseServer serverEngine = new AsyncBaseServer(processorFactory, trans, transFactory, transFactory, proto, proto, logger); + + //Server event handler + var serverEvents = new TradeServerEventHandler(); + serverEngine.SetEventHandler(serverEvents); + + // Run it + var where = (pipe != null ? "on pipe " + pipe : "on port " + port); + Console.WriteLine("Starting the AsyncBaseServer " + where + + " with processor TPrototypeProcessorFactory prototype factory " + + (useBufferedSockets ? " with buffered socket" : "") + + (useFramed ? " with framed transport" : "") + + (useEncryption ? " with encryption" : "") + + (compact ? " with compact protocol" : "") + + (json ? " with json protocol" : "") + + "..."); + serverEngine.ServeAsync(CancellationToken.None).GetAwaiter().GetResult(); + Console.ReadLine(); + } + catch (Exception x) + { + Console.Error.Write(x); + return false; + } + Console.WriteLine("done."); + return true; + } + } +} \ No newline at end of file diff --git a/test/netcore/ThriftTest/ThirftTest.sln b/test/netcore/ThriftTest/ThirftTest.sln new file mode 100644 index 00000000000..2687eab2238 --- /dev/null +++ b/test/netcore/ThriftTest/ThirftTest.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ThirftTest", "ThirftTest.xproj", "{B0C13DA0-3117-4844-8AE8-B1775E46223D}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "..\..\..\lib\netcore\src\Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{839DBA0F-2D58-4266-A30D-3392BD710A59}" + ProjectSection(SolutionItems) = preProject + ..\global.json = ..\global.json + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C13DA0-3117-4844-8AE8-B1775E46223D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C13DA0-3117-4844-8AE8-B1775E46223D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C13DA0-3117-4844-8AE8-B1775E46223D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C13DA0-3117-4844-8AE8-B1775E46223D}.Release|Any CPU.Build.0 = Release|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/test/netcore/ThriftTest/ThirftTest.xproj b/test/netcore/ThriftTest/ThirftTest.xproj new file mode 100644 index 00000000000..69022c665a5 --- /dev/null +++ b/test/netcore/ThriftTest/ThirftTest.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + B0C13DA0-3117-4844-8AE8-B1775E46223D + ThirftTest + obj\$(MSBuildProjectName) + bin\$(MSBuildProjectName)\ + v4.5.2 + + + + 2.0 + + + diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs new file mode 100644 index 00000000000..38a43061fa1 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs @@ -0,0 +1,182 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Bonk : TBase + { + private string _message; + private int _type; + + public string Message + { + get + { + return _message; + } + set + { + __isset.message = true; + this._message = value; + } + } + + public int Type + { + get + { + return _type; + } + set + { + __isset.type = true; + this._type = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool message; + public bool type; + } + + public Bonk() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Message = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Type = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Bonk"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Message != null && __isset.message) + { + field.Name = "message"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Message, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.type) + { + field.Name = "type"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Type, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Bonk("); + bool __first = true; + if (Message != null && __isset.message) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Message: "); + sb.Append(Message); + } + if (__isset.type) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Type: "); + sb.Append(Type); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs new file mode 100644 index 00000000000..47c005b760a --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs @@ -0,0 +1,186 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class BoolTest : TBase + { + private bool _b; + private string _s; + + public bool B + { + get + { + return _b; + } + set + { + __isset.b = true; + this._b = value; + } + } + + public string S + { + get + { + return _s; + } + set + { + __isset.s = true; + this._s = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool b; + public bool s; + } + + public BoolTest() + { + this._b = true; + this.__isset.b = true; + this._s = "true"; + this.__isset.s = true; + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + B = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + S = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("BoolTest"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.b) + { + field.Name = "b"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(B, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (S != null && __isset.s) + { + field.Name = "s"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(S, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("BoolTest("); + bool __first = true; + if (__isset.b) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("B: "); + sb.Append(B); + } + if (S != null && __isset.s) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("S: "); + sb.Append(S); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs new file mode 100644 index 00000000000..83c13db765f --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs @@ -0,0 +1,182 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Bools : TBase + { + private bool _im_true; + private bool _im_false; + + public bool Im_true + { + get + { + return _im_true; + } + set + { + __isset.im_true = true; + this._im_true = value; + } + } + + public bool Im_false + { + get + { + return _im_false; + } + set + { + __isset.im_false = true; + this._im_false = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool im_true; + public bool im_false; + } + + public Bools() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + Im_true = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Bool) + { + Im_false = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Bools"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.im_true) + { + field.Name = "im_true"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Im_true, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.im_false) + { + field.Name = "im_false"; + field.Type = TType.Bool; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Im_false, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Bools("); + bool __first = true; + if (__isset.im_true) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Im_true: "); + sb.Append(Im_true); + } + if (__isset.im_false) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Im_false: "); + sb.Append(Im_false); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs new file mode 100644 index 00000000000..e0f26011343 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs @@ -0,0 +1,400 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class CrazyNesting : TBase + { + private string _string_field; + private THashSet _set_field; + private byte[] _binary_field; + + public string String_field + { + get + { + return _string_field; + } + set + { + __isset.string_field = true; + this._string_field = value; + } + } + + public THashSet Set_field + { + get + { + return _set_field; + } + set + { + __isset.set_field = true; + this._set_field = value; + } + } + + public List, Dictionary>>>>> List_field { get; set; } + + public byte[] Binary_field + { + get + { + return _binary_field; + } + set + { + __isset.binary_field = true; + this._binary_field = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool string_field; + public bool set_field; + public bool binary_field; + } + + public CrazyNesting() + { + } + + public CrazyNesting(List, Dictionary>>>>> list_field) : this() + { + this.List_field = list_field; + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_list_field = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_field = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Set) + { + { + Set_field = new THashSet(); + TSet _set9 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i10 = 0; _i10 < _set9.Count; ++_i10) + { + Insanity _elem11; + _elem11 = new Insanity(); + await _elem11.ReadAsync(iprot, cancellationToken); + Set_field.Add(_elem11); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + List_field = new List, Dictionary>>>>>(); + TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i13 = 0; _i13 < _list12.Count; ++_i13) + { + Dictionary, Dictionary>>>> _elem14; + { + _elem14 = new Dictionary, Dictionary>>>>(); + TMap _map15 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i16 = 0; _i16 < _map15.Count; ++_i16) + { + THashSet _key17; + Dictionary>>> _val18; + { + _key17 = new THashSet(); + TSet _set19 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i20 = 0; _i20 < _set19.Count; ++_i20) + { + int _elem21; + _elem21 = await iprot.ReadI32Async(cancellationToken); + _key17.Add(_elem21); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + { + _val18 = new Dictionary>>>(); + TMap _map22 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i23 = 0; _i23 < _map22.Count; ++_i23) + { + int _key24; + THashSet>> _val25; + _key24 = await iprot.ReadI32Async(cancellationToken); + { + _val25 = new THashSet>>(); + TSet _set26 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i27 = 0; _i27 < _set26.Count; ++_i27) + { + List> _elem28; + { + _elem28 = new List>(); + TList _list29 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i30 = 0; _i30 < _list29.Count; ++_i30) + { + Dictionary _elem31; + { + _elem31 = new Dictionary(); + TMap _map32 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i33 = 0; _i33 < _map32.Count; ++_i33) + { + Insanity _key34; + string _val35; + _key34 = new Insanity(); + await _key34.ReadAsync(iprot, cancellationToken); + _val35 = await iprot.ReadStringAsync(cancellationToken); + _elem31[_key34] = _val35; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + _elem28.Add(_elem31); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _val25.Add(_elem28); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + _val18[_key24] = _val25; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + _elem14[_key17] = _val18; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + List_field.Add(_elem14); + } + await iprot.ReadListEndAsync(cancellationToken); + } + isset_list_field = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Binary_field = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_list_field) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("CrazyNesting"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_field != null && __isset.string_field) + { + field.Name = "string_field"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_field, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Set_field != null && __isset.set_field) + { + field.Name = "set_field"; + field.Type = TType.Set; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.Struct, Set_field.Count), cancellationToken); + foreach (Insanity _iter36 in Set_field) + { + await _iter36.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "list_field"; + field.Type = TType.List; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Map, List_field.Count), cancellationToken); + foreach (Dictionary, Dictionary>>>> _iter37 in List_field) + { + { + await oprot.WriteMapBeginAsync(new TMap(TType.Set, TType.Map, _iter37.Count), cancellationToken); + foreach (THashSet _iter38 in _iter37.Keys) + { + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter38.Count), cancellationToken); + foreach (int _iter39 in _iter38) + { + await oprot.WriteI32Async(_iter39, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter37[_iter38].Count), cancellationToken); + foreach (int _iter40 in _iter37[_iter38].Keys) + { + await oprot.WriteI32Async(_iter40, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.List, _iter37[_iter38][_iter40].Count), cancellationToken); + foreach (List> _iter41 in _iter37[_iter38][_iter40]) + { + { + await oprot.WriteListBeginAsync(new TList(TType.Map, _iter41.Count), cancellationToken); + foreach (Dictionary _iter42 in _iter41) + { + { + await oprot.WriteMapBeginAsync(new TMap(TType.Struct, TType.String, _iter42.Count), cancellationToken); + foreach (Insanity _iter43 in _iter42.Keys) + { + await _iter43.WriteAsync(oprot, cancellationToken); + await oprot.WriteStringAsync(_iter42[_iter43], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + if (Binary_field != null && __isset.binary_field) + { + field.Name = "binary_field"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Binary_field, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("CrazyNesting("); + bool __first = true; + if (String_field != null && __isset.string_field) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("String_field: "); + sb.Append(String_field); + } + if (Set_field != null && __isset.set_field) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Set_field: "); + sb.Append(Set_field); + } + if(!__first) { sb.Append(", "); } + sb.Append("List_field: "); + sb.Append(List_field); + if (Binary_field != null && __isset.binary_field) + { + sb.Append(", Binary_field: "); + sb.Append(Binary_field); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs new file mode 100644 index 00000000000..4825ca4df9e --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs @@ -0,0 +1,92 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class EmptyStruct : TBase + { + + public EmptyStruct() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("EmptyStruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("EmptyStruct("); + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs new file mode 100644 index 00000000000..2667fc84db7 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs @@ -0,0 +1,161 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class GuessProtocolStruct : TBase + { + private Dictionary _map_field; + + public Dictionary Map_field + { + get + { + return _map_field; + } + set + { + __isset.map_field = true; + this._map_field = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool map_field; + } + + public GuessProtocolStruct() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 7: + if (field.Type == TType.Map) + { + { + Map_field = new Dictionary(); + TMap _map65 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i66 = 0; _i66 < _map65.Count; ++_i66) + { + string _key67; + string _val68; + _key67 = await iprot.ReadStringAsync(cancellationToken); + _val68 = await iprot.ReadStringAsync(cancellationToken); + Map_field[_key67] = _val68; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("GuessProtocolStruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Map_field != null && __isset.map_field) + { + field.Name = "map_field"; + field.Type = TType.Map; + field.ID = 7; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Map_field.Count), cancellationToken); + foreach (string _iter69 in Map_field.Keys) + { + await oprot.WriteStringAsync(_iter69, cancellationToken); + await oprot.WriteStringAsync(Map_field[_iter69], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("GuessProtocolStruct("); + bool __first = true; + if (Map_field != null && __isset.map_field) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Map_field: "); + sb.Append(Map_field); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs new file mode 100644 index 00000000000..87ad0f99d92 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs @@ -0,0 +1,220 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Insanity : TBase + { + private Dictionary _userMap; + private List _xtructs; + + public Dictionary UserMap + { + get + { + return _userMap; + } + set + { + __isset.userMap = true; + this._userMap = value; + } + } + + public List Xtructs + { + get + { + return _xtructs; + } + set + { + __isset.xtructs = true; + this._xtructs = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool userMap; + public bool xtructs; + } + + public Insanity() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + UserMap = new Dictionary(); + TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i1 = 0; _i1 < _map0.Count; ++_i1) + { + Numberz _key2; + long _val3; + _key2 = (Numberz)await iprot.ReadI32Async(cancellationToken); + _val3 = await iprot.ReadI64Async(cancellationToken); + UserMap[_key2] = _val3; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.List) + { + { + Xtructs = new List(); + TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i5 = 0; _i5 < _list4.Count; ++_i5) + { + Xtruct _elem6; + _elem6 = new Xtruct(); + await _elem6.ReadAsync(iprot, cancellationToken); + Xtructs.Add(_elem6); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Insanity"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (UserMap != null && __isset.userMap) + { + field.Name = "userMap"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I64, UserMap.Count), cancellationToken); + foreach (Numberz _iter7 in UserMap.Keys) + { + await oprot.WriteI32Async((int)_iter7, cancellationToken); + await oprot.WriteI64Async(UserMap[_iter7], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Xtructs != null && __isset.xtructs) + { + field.Name = "xtructs"; + field.Type = TType.List; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Xtructs.Count), cancellationToken); + foreach (Xtruct _iter8 in Xtructs) + { + await _iter8.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Insanity("); + bool __first = true; + if (UserMap != null && __isset.userMap) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("UserMap: "); + sb.Append(UserMap); + } + if (Xtructs != null && __isset.xtructs) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Xtructs: "); + sb.Append(Xtructs); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs new file mode 100644 index 00000000000..db4b5a0891b --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs @@ -0,0 +1,550 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class LargeDeltas : TBase + { + private Bools _b1; + private Bools _b10; + private Bools _b100; + private bool _check_true; + private Bools _b1000; + private bool _check_false; + private VersioningTestV2 _vertwo2000; + private THashSet _a_set2500; + private VersioningTestV2 _vertwo3000; + private List _big_numbers; + + public Bools B1 + { + get + { + return _b1; + } + set + { + __isset.b1 = true; + this._b1 = value; + } + } + + public Bools B10 + { + get + { + return _b10; + } + set + { + __isset.b10 = true; + this._b10 = value; + } + } + + public Bools B100 + { + get + { + return _b100; + } + set + { + __isset.b100 = true; + this._b100 = value; + } + } + + public bool Check_true + { + get + { + return _check_true; + } + set + { + __isset.check_true = true; + this._check_true = value; + } + } + + public Bools B1000 + { + get + { + return _b1000; + } + set + { + __isset.b1000 = true; + this._b1000 = value; + } + } + + public bool Check_false + { + get + { + return _check_false; + } + set + { + __isset.check_false = true; + this._check_false = value; + } + } + + public VersioningTestV2 Vertwo2000 + { + get + { + return _vertwo2000; + } + set + { + __isset.vertwo2000 = true; + this._vertwo2000 = value; + } + } + + public THashSet A_set2500 + { + get + { + return _a_set2500; + } + set + { + __isset.a_set2500 = true; + this._a_set2500 = value; + } + } + + public VersioningTestV2 Vertwo3000 + { + get + { + return _vertwo3000; + } + set + { + __isset.vertwo3000 = true; + this._vertwo3000 = value; + } + } + + public List Big_numbers + { + get + { + return _big_numbers; + } + set + { + __isset.big_numbers = true; + this._big_numbers = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool b1; + public bool b10; + public bool b100; + public bool check_true; + public bool b1000; + public bool check_false; + public bool vertwo2000; + public bool a_set2500; + public bool vertwo3000; + public bool big_numbers; + } + + public LargeDeltas() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + B1 = new Bools(); + await B1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 10: + if (field.Type == TType.Struct) + { + B10 = new Bools(); + await B10.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 100: + if (field.Type == TType.Struct) + { + B100 = new Bools(); + await B100.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 500: + if (field.Type == TType.Bool) + { + Check_true = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1000: + if (field.Type == TType.Struct) + { + B1000 = new Bools(); + await B1000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1500: + if (field.Type == TType.Bool) + { + Check_false = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2000: + if (field.Type == TType.Struct) + { + Vertwo2000 = new VersioningTestV2(); + await Vertwo2000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2500: + if (field.Type == TType.Set) + { + { + A_set2500 = new THashSet(); + TSet _set70 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i71 = 0; _i71 < _set70.Count; ++_i71) + { + string _elem72; + _elem72 = await iprot.ReadStringAsync(cancellationToken); + A_set2500.Add(_elem72); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3000: + if (field.Type == TType.Struct) + { + Vertwo3000 = new VersioningTestV2(); + await Vertwo3000.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4000: + if (field.Type == TType.List) + { + { + Big_numbers = new List(); + TList _list73 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i74 = 0; _i74 < _list73.Count; ++_i74) + { + int _elem75; + _elem75 = await iprot.ReadI32Async(cancellationToken); + Big_numbers.Add(_elem75); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("LargeDeltas"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (B1 != null && __isset.b1) + { + field.Name = "b1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B10 != null && __isset.b10) + { + field.Name = "b10"; + field.Type = TType.Struct; + field.ID = 10; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B10.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B100 != null && __isset.b100) + { + field.Name = "b100"; + field.Type = TType.Struct; + field.ID = 100; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B100.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.check_true) + { + field.Name = "check_true"; + field.Type = TType.Bool; + field.ID = 500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Check_true, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (B1000 != null && __isset.b1000) + { + field.Name = "b1000"; + field.Type = TType.Struct; + field.ID = 1000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await B1000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.check_false) + { + field.Name = "check_false"; + field.Type = TType.Bool; + field.ID = 1500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Check_false, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Vertwo2000 != null && __isset.vertwo2000) + { + field.Name = "vertwo2000"; + field.Type = TType.Struct; + field.ID = 2000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Vertwo2000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (A_set2500 != null && __isset.a_set2500) + { + field.Name = "a_set2500"; + field.Type = TType.Set; + field.ID = 2500; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.String, A_set2500.Count), cancellationToken); + foreach (string _iter76 in A_set2500) + { + await oprot.WriteStringAsync(_iter76, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Vertwo3000 != null && __isset.vertwo3000) + { + field.Name = "vertwo3000"; + field.Type = TType.Struct; + field.ID = 3000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Vertwo3000.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Big_numbers != null && __isset.big_numbers) + { + field.Name = "big_numbers"; + field.Type = TType.List; + field.ID = 4000; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Big_numbers.Count), cancellationToken); + foreach (int _iter77 in Big_numbers) + { + await oprot.WriteI32Async(_iter77, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("LargeDeltas("); + bool __first = true; + if (B1 != null && __isset.b1) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("B1: "); + sb.Append(B1== null ? "" : B1.ToString()); + } + if (B10 != null && __isset.b10) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("B10: "); + sb.Append(B10== null ? "" : B10.ToString()); + } + if (B100 != null && __isset.b100) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("B100: "); + sb.Append(B100== null ? "" : B100.ToString()); + } + if (__isset.check_true) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Check_true: "); + sb.Append(Check_true); + } + if (B1000 != null && __isset.b1000) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("B1000: "); + sb.Append(B1000== null ? "" : B1000.ToString()); + } + if (__isset.check_false) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Check_false: "); + sb.Append(Check_false); + } + if (Vertwo2000 != null && __isset.vertwo2000) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Vertwo2000: "); + sb.Append(Vertwo2000== null ? "" : Vertwo2000.ToString()); + } + if (A_set2500 != null && __isset.a_set2500) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("A_set2500: "); + sb.Append(A_set2500); + } + if (Vertwo3000 != null && __isset.vertwo3000) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Vertwo3000: "); + sb.Append(Vertwo3000== null ? "" : Vertwo3000.ToString()); + } + if (Big_numbers != null && __isset.big_numbers) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Big_numbers: "); + sb.Append(Big_numbers); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs new file mode 100644 index 00000000000..d04e404339a --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs @@ -0,0 +1,159 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class ListBonks : TBase + { + private List _bonk; + + public List Bonk + { + get + { + return _bonk; + } + set + { + __isset.bonk = true; + this._bonk = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool bonk; + } + + public ListBonks() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Bonk = new List(); + TList _list128 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i129 = 0; _i129 < _list128.Count; ++_i129) + { + Bonk _elem130; + _elem130 = new Bonk(); + await _elem130.ReadAsync(iprot, cancellationToken); + Bonk.Add(_elem130); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListBonks"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Bonk != null && __isset.bonk) + { + field.Name = "bonk"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, Bonk.Count), cancellationToken); + foreach (Bonk _iter131 in Bonk) + { + await _iter131.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ListBonks("); + bool __first = true; + if (Bonk != null && __isset.bonk) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Bonk: "); + sb.Append(Bonk); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs new file mode 100644 index 00000000000..258da1a074b --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs @@ -0,0 +1,199 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class ListTypeVersioningV1 : TBase + { + private List _myints; + private string _hello; + + public List Myints + { + get + { + return _myints; + } + set + { + __isset.myints = true; + this._myints = value; + } + } + + public string Hello + { + get + { + return _hello; + } + set + { + __isset.hello = true; + this._hello = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool myints; + public bool hello; + } + + public ListTypeVersioningV1() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Myints = new List(); + TList _list57 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i58 = 0; _i58 < _list57.Count; ++_i58) + { + int _elem59; + _elem59 = await iprot.ReadI32Async(cancellationToken); + Myints.Add(_elem59); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Hello = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListTypeVersioningV1"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Myints != null && __isset.myints) + { + field.Name = "myints"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Myints.Count), cancellationToken); + foreach (int _iter60 in Myints) + { + await oprot.WriteI32Async(_iter60, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Hello != null && __isset.hello) + { + field.Name = "hello"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ListTypeVersioningV1("); + bool __first = true; + if (Myints != null && __isset.myints) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Myints: "); + sb.Append(Myints); + } + if (Hello != null && __isset.hello) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs new file mode 100644 index 00000000000..e05e6a090f4 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs @@ -0,0 +1,199 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class ListTypeVersioningV2 : TBase + { + private List _strings; + private string _hello; + + public List Strings + { + get + { + return _strings; + } + set + { + __isset.strings = true; + this._strings = value; + } + } + + public string Hello + { + get + { + return _hello; + } + set + { + __isset.hello = true; + this._hello = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool strings; + public bool hello; + } + + public ListTypeVersioningV2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Strings = new List(); + TList _list61 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i62 = 0; _i62 < _list61.Count; ++_i62) + { + string _elem63; + _elem63 = await iprot.ReadStringAsync(cancellationToken); + Strings.Add(_elem63); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Hello = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("ListTypeVersioningV2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Strings != null && __isset.strings) + { + field.Name = "strings"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.String, Strings.Count), cancellationToken); + foreach (string _iter64 in Strings) + { + await oprot.WriteStringAsync(_iter64, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Hello != null && __isset.hello) + { + field.Name = "hello"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("ListTypeVersioningV2("); + bool __first = true; + if (Strings != null && __isset.strings) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Strings: "); + sb.Append(Strings); + } + if (Hello != null && __isset.hello) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs new file mode 100644 index 00000000000..4c4f30e9b1f --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs @@ -0,0 +1,193 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class NestedListsBonk : TBase + { + private List>> _bonk; + + public List>> Bonk + { + get + { + return _bonk; + } + set + { + __isset.bonk = true; + this._bonk = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool bonk; + } + + public NestedListsBonk() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Bonk = new List>>(); + TList _list132 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i133 = 0; _i133 < _list132.Count; ++_i133) + { + List> _elem134; + { + _elem134 = new List>(); + TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i136 = 0; _i136 < _list135.Count; ++_i136) + { + List _elem137; + { + _elem137 = new List(); + TList _list138 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i139 = 0; _i139 < _list138.Count; ++_i139) + { + Bonk _elem140; + _elem140 = new Bonk(); + await _elem140.ReadAsync(iprot, cancellationToken); + _elem137.Add(_elem140); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _elem134.Add(_elem137); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Bonk.Add(_elem134); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsBonk"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Bonk != null && __isset.bonk) + { + field.Name = "bonk"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Bonk.Count), cancellationToken); + foreach (List> _iter141 in Bonk) + { + { + await oprot.WriteListBeginAsync(new TList(TType.List, _iter141.Count), cancellationToken); + foreach (List _iter142 in _iter141) + { + { + await oprot.WriteListBeginAsync(new TList(TType.Struct, _iter142.Count), cancellationToken); + foreach (Bonk _iter143 in _iter142) + { + await _iter143.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NestedListsBonk("); + bool __first = true; + if (Bonk != null && __isset.bonk) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Bonk: "); + sb.Append(Bonk); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs new file mode 100644 index 00000000000..fe83204fdc0 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs @@ -0,0 +1,175 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class NestedListsI32x2 : TBase + { + private List> _integerlist; + + public List> Integerlist + { + get + { + return _integerlist; + } + set + { + __isset.integerlist = true; + this._integerlist = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool integerlist; + } + + public NestedListsI32x2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Integerlist = new List>(); + TList _list78 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i79 = 0; _i79 < _list78.Count; ++_i79) + { + List _elem80; + { + _elem80 = new List(); + TList _list81 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i82 = 0; _i82 < _list81.Count; ++_i82) + { + int _elem83; + _elem83 = await iprot.ReadI32Async(cancellationToken); + _elem80.Add(_elem83); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Integerlist.Add(_elem80); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsI32x2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Integerlist != null && __isset.integerlist) + { + field.Name = "integerlist"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); + foreach (List _iter84 in Integerlist) + { + { + await oprot.WriteListBeginAsync(new TList(TType.I32, _iter84.Count), cancellationToken); + foreach (int _iter85 in _iter84) + { + await oprot.WriteI32Async(_iter85, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NestedListsI32x2("); + bool __first = true; + if (Integerlist != null && __isset.integerlist) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Integerlist: "); + sb.Append(Integerlist); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs new file mode 100644 index 00000000000..b2988804d82 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs @@ -0,0 +1,192 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class NestedListsI32x3 : TBase + { + private List>> _integerlist; + + public List>> Integerlist + { + get + { + return _integerlist; + } + set + { + __isset.integerlist = true; + this._integerlist = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool integerlist; + } + + public NestedListsI32x3() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Integerlist = new List>>(); + TList _list86 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i87 = 0; _i87 < _list86.Count; ++_i87) + { + List> _elem88; + { + _elem88 = new List>(); + TList _list89 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i90 = 0; _i90 < _list89.Count; ++_i90) + { + List _elem91; + { + _elem91 = new List(); + TList _list92 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i93 = 0; _i93 < _list92.Count; ++_i93) + { + int _elem94; + _elem94 = await iprot.ReadI32Async(cancellationToken); + _elem91.Add(_elem94); + } + await iprot.ReadListEndAsync(cancellationToken); + } + _elem88.Add(_elem91); + } + await iprot.ReadListEndAsync(cancellationToken); + } + Integerlist.Add(_elem88); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedListsI32x3"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Integerlist != null && __isset.integerlist) + { + field.Name = "integerlist"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); + foreach (List> _iter95 in Integerlist) + { + { + await oprot.WriteListBeginAsync(new TList(TType.List, _iter95.Count), cancellationToken); + foreach (List _iter96 in _iter95) + { + { + await oprot.WriteListBeginAsync(new TList(TType.I32, _iter96.Count), cancellationToken); + foreach (int _iter97 in _iter96) + { + await oprot.WriteI32Async(_iter97, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NestedListsI32x3("); + bool __first = true; + if (Integerlist != null && __isset.integerlist) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Integerlist: "); + sb.Append(Integerlist); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs new file mode 100644 index 00000000000..28da88f2bb8 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs @@ -0,0 +1,348 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class NestedMixedx2 : TBase + { + private List> _int_set_list; + private Dictionary> _map_int_strset; + private List>> _map_int_strset_list; + + public List> Int_set_list + { + get + { + return _int_set_list; + } + set + { + __isset.int_set_list = true; + this._int_set_list = value; + } + } + + public Dictionary> Map_int_strset + { + get + { + return _map_int_strset; + } + set + { + __isset.map_int_strset = true; + this._map_int_strset = value; + } + } + + public List>> Map_int_strset_list + { + get + { + return _map_int_strset_list; + } + set + { + __isset.map_int_strset_list = true; + this._map_int_strset_list = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool int_set_list; + public bool map_int_strset; + public bool map_int_strset_list; + } + + public NestedMixedx2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Int_set_list = new List>(); + TList _list98 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i99 = 0; _i99 < _list98.Count; ++_i99) + { + THashSet _elem100; + { + _elem100 = new THashSet(); + TSet _set101 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i102 = 0; _i102 < _set101.Count; ++_i102) + { + int _elem103; + _elem103 = await iprot.ReadI32Async(cancellationToken); + _elem100.Add(_elem103); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + Int_set_list.Add(_elem100); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Map) + { + { + Map_int_strset = new Dictionary>(); + TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i105 = 0; _i105 < _map104.Count; ++_i105) + { + int _key106; + THashSet _val107; + _key106 = await iprot.ReadI32Async(cancellationToken); + { + _val107 = new THashSet(); + TSet _set108 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i109 = 0; _i109 < _set108.Count; ++_i109) + { + string _elem110; + _elem110 = await iprot.ReadStringAsync(cancellationToken); + _val107.Add(_elem110); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + Map_int_strset[_key106] = _val107; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.List) + { + { + Map_int_strset_list = new List>>(); + TList _list111 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i112 = 0; _i112 < _list111.Count; ++_i112) + { + Dictionary> _elem113; + { + _elem113 = new Dictionary>(); + TMap _map114 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i115 = 0; _i115 < _map114.Count; ++_i115) + { + int _key116; + THashSet _val117; + _key116 = await iprot.ReadI32Async(cancellationToken); + { + _val117 = new THashSet(); + TSet _set118 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i119 = 0; _i119 < _set118.Count; ++_i119) + { + string _elem120; + _elem120 = await iprot.ReadStringAsync(cancellationToken); + _val117.Add(_elem120); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + _elem113[_key116] = _val117; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Map_int_strset_list.Add(_elem113); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("NestedMixedx2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Int_set_list != null && __isset.int_set_list) + { + field.Name = "int_set_list"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Set, Int_set_list.Count), cancellationToken); + foreach (THashSet _iter121 in Int_set_list) + { + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter121.Count), cancellationToken); + foreach (int _iter122 in _iter121) + { + await oprot.WriteI32Async(_iter122, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Map_int_strset != null && __isset.map_int_strset) + { + field.Name = "map_int_strset"; + field.Type = TType.Map; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, Map_int_strset.Count), cancellationToken); + foreach (int _iter123 in Map_int_strset.Keys) + { + await oprot.WriteI32Async(_iter123, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.String, Map_int_strset[_iter123].Count), cancellationToken); + foreach (string _iter124 in Map_int_strset[_iter123]) + { + await oprot.WriteStringAsync(_iter124, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Map_int_strset_list != null && __isset.map_int_strset_list) + { + field.Name = "map_int_strset_list"; + field.Type = TType.List; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.Map, Map_int_strset_list.Count), cancellationToken); + foreach (Dictionary> _iter125 in Map_int_strset_list) + { + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter125.Count), cancellationToken); + foreach (int _iter126 in _iter125.Keys) + { + await oprot.WriteI32Async(_iter126, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.String, _iter125[_iter126].Count), cancellationToken); + foreach (string _iter127 in _iter125[_iter126]) + { + await oprot.WriteStringAsync(_iter127, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("NestedMixedx2("); + bool __first = true; + if (Int_set_list != null && __isset.int_set_list) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Int_set_list: "); + sb.Append(Int_set_list); + } + if (Map_int_strset != null && __isset.map_int_strset) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Map_int_strset: "); + sb.Append(Map_int_strset); + } + if (Map_int_strset_list != null && __isset.map_int_strset_list) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Map_int_strset_list: "); + sb.Append(Map_int_strset_list); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs new file mode 100644 index 00000000000..a8fcc901fc6 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs @@ -0,0 +1,22 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +namespace thrift.test +{ + /// + /// Docstring! + /// + public enum Numberz + { + ONE = 1, + TWO = 2, + THREE = 3, + FIVE = 5, + SIX = 6, + EIGHT = 8, + } +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs new file mode 100644 index 00000000000..cbcca3d9b09 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs @@ -0,0 +1,142 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class OneField : TBase + { + private EmptyStruct _field; + + public EmptyStruct Field + { + get + { + return _field; + } + set + { + __isset.field = true; + this._field = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool field; + } + + public OneField() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Field = new EmptyStruct(); + await Field.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("OneField"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Field != null && __isset.field) + { + field.Name = "field"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Field.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("OneField("); + bool __first = true; + if (Field != null && __isset.field) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Field: "); + sb.Append(Field== null ? "" : Field.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs new file mode 100644 index 00000000000..4740018a2a9 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs @@ -0,0 +1,581 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + public partial class SecondService + { + public interface IAsync + { + Task blahBlahAsync(CancellationToken cancellationToken); + + /// + /// Prints 'testString("%s")' with thing as '%s' + /// @param string thing - the string to print + /// @return string - returns the string 'thing' + /// + /// + Task secondtestStringAsync(string thing, CancellationToken cancellationToken); + + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) { + } + public async Task blahBlahAsync(CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Call, SeqId), cancellationToken); + + var args = new blahBlahArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new blahBlahResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task secondtestStringAsync(string thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Call, SeqId), cancellationToken); + + var args = new secondtestStringArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new secondtestStringResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "secondtestString failed: unknown result"); + } + + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["blahBlah"] = blahBlah_ProcessAsync; + processMap_["secondtestString"] = secondtestString_ProcessAsync; + } + + protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + protected Dictionary processMap_ = new Dictionary(); + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'"); + await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task blahBlah_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new blahBlahArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new blahBlahResult(); + try + { + await _iAsync.blahBlahAsync(cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task secondtestString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new secondtestStringArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new secondtestStringResult(); + try + { + result.Success = await _iAsync.secondtestStringAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + } + + + public partial class blahBlahArgs : TBase + { + + public blahBlahArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("blahBlah_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("blahBlah_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class blahBlahResult : TBase + { + + public blahBlahResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("blahBlah_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("blahBlah_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class secondtestStringArgs : TBase + { + private string _thing; + + public string Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public secondtestStringArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("secondtestString_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("secondtestString_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class secondtestStringResult : TBase + { + private string _success; + + public string Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public secondtestStringResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("secondtestString_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("secondtestString_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + } +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs new file mode 100644 index 00000000000..ea7ede32c86 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs @@ -0,0 +1,124 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class StructA : TBase + { + + public string S { get; set; } + + public StructA() + { + } + + public StructA(string s) : this() + { + this.S = s; + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_s = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + S = await iprot.ReadStringAsync(cancellationToken); + isset_s = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_s) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("StructA"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + field.Name = "s"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(S, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("StructA("); + sb.Append(", S: "); + sb.Append(S); + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs new file mode 100644 index 00000000000..f398cca0fe3 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs @@ -0,0 +1,175 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class StructB : TBase + { + private StructA _aa; + + public StructA Aa + { + get + { + return _aa; + } + set + { + __isset.aa = true; + this._aa = value; + } + } + + public StructA Ab { get; set; } + + + public Isset __isset; + public struct Isset + { + public bool aa; + } + + public StructB() + { + } + + public StructB(StructA ab) : this() + { + this.Ab = ab; + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + bool isset_ab = false; + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Aa = new StructA(); + await Aa.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Ab = new StructA(); + await Ab.ReadAsync(iprot, cancellationToken); + isset_ab = true; + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + if (!isset_ab) + { + throw new TProtocolException(TProtocolException.INVALID_DATA); + } + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("StructB"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Aa != null && __isset.aa) + { + field.Name = "aa"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Aa.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + field.Name = "ab"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ab.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("StructB("); + bool __first = true; + if (Aa != null && __isset.aa) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Aa: "); + sb.Append(Aa== null ? "" : Aa.ToString()); + } + if(!__first) { sb.Append(", "); } + sb.Append("Ab: "); + sb.Append(Ab== null ? "" : Ab.ToString()); + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs new file mode 100644 index 00000000000..84811fe8a63 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs @@ -0,0 +1,24 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + + +namespace thrift.test +{ + public static class ThriftTestConstants + { + public static Numberz myNumberz = Numberz.ONE; + } +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs new file mode 100644 index 00000000000..655868d3a87 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs @@ -0,0 +1,7046 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + public partial class ThriftTest + { + public interface IAsync + { + /// + /// Prints "testVoid()" and returns nothing. + /// + Task testVoidAsync(CancellationToken cancellationToken); + + /// + /// Prints 'testString("%s")' with thing as '%s' + /// @param string thing - the string to print + /// @return string - returns the string 'thing' + /// + /// + Task testStringAsync(string thing, CancellationToken cancellationToken); + + /// + /// Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' + /// @param bool thing - the bool data to print + /// @return bool - returns the bool 'thing' + /// + /// + Task testBoolAsync(bool thing, CancellationToken cancellationToken); + + /// + /// Prints 'testByte("%d")' with thing as '%d' + /// The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. + /// @param byte thing - the i8/byte to print + /// @return i8 - returns the i8/byte 'thing' + /// + /// + Task testByteAsync(sbyte thing, CancellationToken cancellationToken); + + /// + /// Prints 'testI32("%d")' with thing as '%d' + /// @param i32 thing - the i32 to print + /// @return i32 - returns the i32 'thing' + /// + /// + Task testI32Async(int thing, CancellationToken cancellationToken); + + /// + /// Prints 'testI64("%d")' with thing as '%d' + /// @param i64 thing - the i64 to print + /// @return i64 - returns the i64 'thing' + /// + /// + Task testI64Async(long thing, CancellationToken cancellationToken); + + /// + /// Prints 'testDouble("%f")' with thing as '%f' + /// @param double thing - the double to print + /// @return double - returns the double 'thing' + /// + /// + Task testDoubleAsync(double thing, CancellationToken cancellationToken); + + /// + /// Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data + /// @param binary thing - the binary data to print + /// @return binary - returns the binary 'thing' + /// + /// + Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken); + + /// + /// Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values + /// @param Xtruct thing - the Xtruct to print + /// @return Xtruct - returns the Xtruct 'thing' + /// + /// + Task testStructAsync(Xtruct thing, CancellationToken cancellationToken); + + /// + /// Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct + /// @param Xtruct2 thing - the Xtruct2 to print + /// @return Xtruct2 - returns the Xtruct2 'thing' + /// + /// + Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken); + + /// + /// Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs + /// separated by commas and new lines + /// @param map thing - the map to print + /// @return map - returns the map 'thing' + /// + /// + Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken); + + /// + /// Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs + /// separated by commas and new lines + /// @param map thing - the map to print + /// @return map - returns the map 'thing' + /// + /// + Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken); + + /// + /// Prints 'testSet("{%s}")' where thing has been formatted into a string of values + /// separated by commas and new lines + /// @param set thing - the set to print + /// @return set - returns the set 'thing' + /// + /// + Task> testSetAsync(THashSet thing, CancellationToken cancellationToken); + + /// + /// Prints 'testList("{%s}")' where thing has been formatted into a string of values + /// separated by commas and new lines + /// @param list thing - the list to print + /// @return list - returns the list 'thing' + /// + /// + Task> testListAsync(List thing, CancellationToken cancellationToken); + + /// + /// Prints 'testEnum("%d")' where thing has been formatted into it's numeric value + /// @param Numberz thing - the Numberz to print + /// @return Numberz - returns the Numberz 'thing' + /// + /// + Task testEnumAsync(Numberz thing, CancellationToken cancellationToken); + + /// + /// Prints 'testTypedef("%d")' with thing as '%d' + /// @param UserId thing - the UserId to print + /// @return UserId - returns the UserId 'thing' + /// + /// + Task testTypedefAsync(long thing, CancellationToken cancellationToken); + + /// + /// Prints 'testMapMap("%d")' with hello as '%d' + /// @param i32 hello - the i32 to print + /// @return map> - returns a dictionary with these values: + /// {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } + /// + /// + Task>> testMapMapAsync(int hello, CancellationToken cancellationToken); + + /// + /// So you think you've got this all worked, out eh? + /// + /// Creates a the returned map with these values and prints it out: + /// { 1 => { 2 => argument, + /// 3 => argument, + /// }, + /// 2 => { 6 => , }, + /// } + /// @return map> - a map with the above values + /// + /// + Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken); + + /// + /// Prints 'testMulti()' + /// @param i8 arg0 - + /// @param i32 arg1 - + /// @param i64 arg2 - + /// @param map arg3 - + /// @param Numberz arg4 - + /// @param UserId arg5 - + /// @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 + /// and i64_thing = arg2 + /// + /// + /// + /// + /// + /// + /// + Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, CancellationToken cancellationToken); + + /// + /// Print 'testException(%s)' with arg as '%s' + /// @param string arg - a string indication what type of exception to throw + /// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg + /// elsen if arg == "TException" throw TException + /// else do not throw anything + /// + /// + Task testExceptionAsync(string arg, CancellationToken cancellationToken); + + /// + /// Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' + /// @param string arg - a string indication what type of exception to throw + /// if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" + /// elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2" + /// else do not throw anything + /// @return Xtruct - an Xtruct with string_thing = arg1 + /// + /// + /// + Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken); + + /// + /// Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' + /// sleep 'secondsToSleep' + /// Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' + /// @param i32 secondsToSleep - the number of seconds to sleep + /// + /// + Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken); + + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) { + } + public async Task testVoidAsync(CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Call, SeqId), cancellationToken); + + var args = new testVoidArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testVoidResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task testStringAsync(string thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Call, SeqId), cancellationToken); + + var args = new testStringArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStringResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testString failed: unknown result"); + } + + public async Task testBoolAsync(bool thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Call, SeqId), cancellationToken); + + var args = new testBoolArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testBoolResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testBool failed: unknown result"); + } + + public async Task testByteAsync(sbyte thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Call, SeqId), cancellationToken); + + var args = new testByteArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testByteResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testByte failed: unknown result"); + } + + public async Task testI32Async(int thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Call, SeqId), cancellationToken); + + var args = new testI32Args(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testI32Result(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testI32 failed: unknown result"); + } + + public async Task testI64Async(long thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Call, SeqId), cancellationToken); + + var args = new testI64Args(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testI64Result(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testI64 failed: unknown result"); + } + + public async Task testDoubleAsync(double thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Call, SeqId), cancellationToken); + + var args = new testDoubleArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testDoubleResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testDouble failed: unknown result"); + } + + public async Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Call, SeqId), cancellationToken); + + var args = new testBinaryArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testBinaryResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testBinary failed: unknown result"); + } + + public async Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Call, SeqId), cancellationToken); + + var args = new testStructArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStructResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testStruct failed: unknown result"); + } + + public async Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Call, SeqId), cancellationToken); + + var args = new testNestArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testNestResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testNest failed: unknown result"); + } + + public async Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Call, SeqId), cancellationToken); + + var args = new testMapArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMap failed: unknown result"); + } + + public async Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Call, SeqId), cancellationToken); + + var args = new testStringMapArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testStringMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testStringMap failed: unknown result"); + } + + public async Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Call, SeqId), cancellationToken); + + var args = new testSetArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testSetResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testSet failed: unknown result"); + } + + public async Task> testListAsync(List thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Call, SeqId), cancellationToken); + + var args = new testListArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testListResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testList failed: unknown result"); + } + + public async Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Call, SeqId), cancellationToken); + + var args = new testEnumArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testEnumResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testEnum failed: unknown result"); + } + + public async Task testTypedefAsync(long thing, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Call, SeqId), cancellationToken); + + var args = new testTypedefArgs(); + args.Thing = thing; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testTypedefResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testTypedef failed: unknown result"); + } + + public async Task>> testMapMapAsync(int hello, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Call, SeqId), cancellationToken); + + var args = new testMapMapArgs(); + args.Hello = hello; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMapMapResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMapMap failed: unknown result"); + } + + public async Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Call, SeqId), cancellationToken); + + var args = new testInsanityArgs(); + args.Argument = argument; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testInsanityResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testInsanity failed: unknown result"); + } + + public async Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Call, SeqId), cancellationToken); + + var args = new testMultiArgs(); + args.Arg0 = arg0; + args.Arg1 = arg1; + args.Arg2 = arg2; + args.Arg3 = arg3; + args.Arg4 = arg4; + args.Arg5 = arg5; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMultiResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMulti failed: unknown result"); + } + + public async Task testExceptionAsync(string arg, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Call, SeqId), cancellationToken); + + var args = new testExceptionArgs(); + args.Arg = arg; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testExceptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.err1) + { + throw result.Err1; + } + return; + } + + public async Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Call, SeqId), cancellationToken); + + var args = new testMultiExceptionArgs(); + args.Arg0 = arg0; + args.Arg1 = arg1; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new testMultiExceptionResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.err1) + { + throw result.Err1; + } + if (result.__isset.err2) + { + throw result.Err2; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMultiException failed: unknown result"); + } + + public async Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) + { + await OutputProtocol.WriteMessageBeginAsync(new TMessage("testOneway", TMessageType.Oneway, SeqId), cancellationToken); + + var args = new testOnewayArgs(); + args.SecondsToSleep = secondsToSleep; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["testVoid"] = testVoid_ProcessAsync; + processMap_["testString"] = testString_ProcessAsync; + processMap_["testBool"] = testBool_ProcessAsync; + processMap_["testByte"] = testByte_ProcessAsync; + processMap_["testI32"] = testI32_ProcessAsync; + processMap_["testI64"] = testI64_ProcessAsync; + processMap_["testDouble"] = testDouble_ProcessAsync; + processMap_["testBinary"] = testBinary_ProcessAsync; + processMap_["testStruct"] = testStruct_ProcessAsync; + processMap_["testNest"] = testNest_ProcessAsync; + processMap_["testMap"] = testMap_ProcessAsync; + processMap_["testStringMap"] = testStringMap_ProcessAsync; + processMap_["testSet"] = testSet_ProcessAsync; + processMap_["testList"] = testList_ProcessAsync; + processMap_["testEnum"] = testEnum_ProcessAsync; + processMap_["testTypedef"] = testTypedef_ProcessAsync; + processMap_["testMapMap"] = testMapMap_ProcessAsync; + processMap_["testInsanity"] = testInsanity_ProcessAsync; + processMap_["testMulti"] = testMulti_ProcessAsync; + processMap_["testException"] = testException_ProcessAsync; + processMap_["testMultiException"] = testMultiException_ProcessAsync; + processMap_["testOneway"] = testOneway_ProcessAsync; + } + + protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + protected Dictionary processMap_ = new Dictionary(); + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'"); + await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task testVoid_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testVoidArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testVoidResult(); + try + { + await _iAsync.testVoidAsync(cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testStringArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStringResult(); + try + { + result.Success = await _iAsync.testStringAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testBool_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testBoolArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testBoolResult(); + try + { + result.Success = await _iAsync.testBoolAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testByte_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testByteArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testByteResult(); + try + { + result.Success = await _iAsync.testByteAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testI32_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testI32Args(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testI32Result(); + try + { + result.Success = await _iAsync.testI32Async(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testI64_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testI64Args(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testI64Result(); + try + { + result.Success = await _iAsync.testI64Async(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testDouble_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testDoubleArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testDoubleResult(); + try + { + result.Success = await _iAsync.testDoubleAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testBinary_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testBinaryArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testBinaryResult(); + try + { + result.Success = await _iAsync.testBinaryAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testStructArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStructResult(); + try + { + result.Success = await _iAsync.testStructAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testNest_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testNestArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testNestResult(); + try + { + result.Success = await _iAsync.testNestAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMapResult(); + try + { + result.Success = await _iAsync.testMapAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testStringMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testStringMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testStringMapResult(); + try + { + result.Success = await _iAsync.testStringMapAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testSet_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testSetArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testSetResult(); + try + { + result.Success = await _iAsync.testSetAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testList_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testListArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testListResult(); + try + { + result.Success = await _iAsync.testListAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testEnum_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testEnumArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testEnumResult(); + try + { + result.Success = await _iAsync.testEnumAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testTypedef_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testTypedefArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testTypedefResult(); + try + { + result.Success = await _iAsync.testTypedefAsync(args.Thing, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMapMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testMapMapArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMapMapResult(); + try + { + result.Success = await _iAsync.testMapMapAsync(args.Hello, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testInsanity_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testInsanityArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testInsanityResult(); + try + { + result.Success = await _iAsync.testInsanityAsync(args.Argument, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMulti_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testMultiArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMultiResult(); + try + { + result.Success = await _iAsync.testMultiAsync(args.Arg0, args.Arg1, args.Arg2, args.Arg3, args.Arg4, args.Arg5, cancellationToken); + await oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testExceptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testExceptionResult(); + try + { + try + { + await _iAsync.testExceptionAsync(args.Arg, cancellationToken); + } + catch (Xception err1) + { + result.Err1 = err1; + } + await oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testMultiException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testMultiExceptionArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new testMultiExceptionResult(); + try + { + try + { + result.Success = await _iAsync.testMultiExceptionAsync(args.Arg0, args.Arg1, cancellationToken); + } + catch (Xception err1) + { + result.Err1 = err1; + } + catch (Xception2 err2) + { + result.Err2 = err2; + } + await oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); + await oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Exception, seqid), cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task testOneway_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + var args = new testOnewayArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + try + { + await _iAsync.testOnewayAsync(args.SecondsToSleep, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + } + } + + } + + + public partial class testVoidArgs : TBase + { + + public testVoidArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testVoid_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testVoid_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testVoidResult : TBase + { + + public testVoidResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testVoid_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testVoid_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStringArgs : TBase + { + private string _thing; + + public string Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testStringArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testString_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testString_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStringResult : TBase + { + private string _success; + + public string Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testStringResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testString_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testString_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testBoolArgs : TBase + { + private bool _thing; + + public bool Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testBoolArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Bool) + { + Thing = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBool_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Bool; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testBool_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testBoolResult : TBase + { + private bool _success; + + public bool Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testBoolResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Bool) + { + Success = await iprot.ReadBoolAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBool_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Bool; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBoolAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testBool_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testByteArgs : TBase + { + private sbyte _thing; + + public sbyte Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testByteArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testByte_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testByte_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testByteResult : TBase + { + private sbyte _success; + + public sbyte Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testByteResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Byte) + { + Success = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testByte_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Byte; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testByte_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testI32Args : TBase + { + private int _thing; + + public int Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testI32Args() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI32_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testI32_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testI32Result : TBase + { + private int _success; + + public int Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testI32Result() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI32_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testI32_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testI64Args : TBase + { + private long _thing; + + public long Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testI64Args() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I64) + { + Thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI64_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I64; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testI64_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testI64Result : TBase + { + private long _success; + + public long Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testI64Result() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testI64_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testI64_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testDoubleArgs : TBase + { + private double _thing; + + public double Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testDoubleArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Double) + { + Thing = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testDouble_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.Double; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testDouble_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testDoubleResult : TBase + { + private double _success; + + public double Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testDoubleResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Double) + { + Success = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testDouble_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.Double; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testDouble_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testBinaryArgs : TBase + { + private byte[] _thing; + + public byte[] Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testBinaryArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Thing = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBinary_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testBinary_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testBinaryResult : TBase + { + private byte[] _success; + + public byte[] Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testBinaryResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.String) + { + Success = await iprot.ReadBinaryAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testBinary_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.String; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteBinaryAsync(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testBinary_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStructArgs : TBase + { + private Xtruct _thing; + + public Xtruct Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testStructArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Thing = new Xtruct(); + await Thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStruct_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testStruct_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing== null ? "" : Thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStructResult : TBase + { + private Xtruct _success; + + public Xtruct Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testStructResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStruct_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testStruct_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success== null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testNestArgs : TBase + { + private Xtruct2 _thing; + + public Xtruct2 Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testNestArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Thing = new Xtruct2(); + await Thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testNest_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testNest_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing== null ? "" : Thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testNestResult : TBase + { + private Xtruct2 _success; + + public Xtruct2 Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testNestResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct2(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testNest_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testNest_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success== null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMapArgs : TBase + { + private Dictionary _thing; + + public Dictionary Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testMapArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Thing = new Dictionary(); + TMap _map144 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i145 = 0; _i145 < _map144.Count; ++_i145) + { + int _key146; + int _val147; + _key146 = await iprot.ReadI32Async(cancellationToken); + _val147 = await iprot.ReadI32Async(cancellationToken); + Thing[_key146] = _val147; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Thing.Count), cancellationToken); + foreach (int _iter148 in Thing.Keys) + { + await oprot.WriteI32Async(_iter148, cancellationToken); + await oprot.WriteI32Async(Thing[_iter148], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMap_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMapResult : TBase + { + private Dictionary _success; + + public Dictionary Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testMapResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map149 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i150 = 0; _i150 < _map149.Count; ++_i150) + { + int _key151; + int _val152; + _key151 = await iprot.ReadI32Async(cancellationToken); + _val152 = await iprot.ReadI32Async(cancellationToken); + Success[_key151] = _val152; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success.Count), cancellationToken); + foreach (int _iter153 in Success.Keys) + { + await oprot.WriteI32Async(_iter153, cancellationToken); + await oprot.WriteI32Async(Success[_iter153], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStringMapArgs : TBase + { + private Dictionary _thing; + + public Dictionary Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testStringMapArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Map) + { + { + Thing = new Dictionary(); + TMap _map154 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i155 = 0; _i155 < _map154.Count; ++_i155) + { + string _key156; + string _val157; + _key156 = await iprot.ReadStringAsync(cancellationToken); + _val157 = await iprot.ReadStringAsync(cancellationToken); + Thing[_key156] = _val157; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStringMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Map; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Thing.Count), cancellationToken); + foreach (string _iter158 in Thing.Keys) + { + await oprot.WriteStringAsync(_iter158, cancellationToken); + await oprot.WriteStringAsync(Thing[_iter158], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testStringMap_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testStringMapResult : TBase + { + private Dictionary _success; + + public Dictionary Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testStringMapResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary(); + TMap _map159 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i160 = 0; _i160 < _map159.Count; ++_i160) + { + string _key161; + string _val162; + _key161 = await iprot.ReadStringAsync(cancellationToken); + _val162 = await iprot.ReadStringAsync(cancellationToken); + Success[_key161] = _val162; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testStringMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), cancellationToken); + foreach (string _iter163 in Success.Keys) + { + await oprot.WriteStringAsync(_iter163, cancellationToken); + await oprot.WriteStringAsync(Success[_iter163], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testStringMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testSetArgs : TBase + { + private THashSet _thing; + + public THashSet Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testSetArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Set) + { + { + Thing = new THashSet(); + TSet _set164 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i165 = 0; _i165 < _set164.Count; ++_i165) + { + int _elem166; + _elem166 = await iprot.ReadI32Async(cancellationToken); + Thing.Add(_elem166); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testSet_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.Set; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Thing.Count), cancellationToken); + foreach (int _iter167 in Thing) + { + await oprot.WriteI32Async(_iter167, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testSet_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testSetResult : TBase + { + private THashSet _success; + + public THashSet Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testSetResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Set) + { + { + Success = new THashSet(); + TSet _set168 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i169 = 0; _i169 < _set168.Count; ++_i169) + { + int _elem170; + _elem170 = await iprot.ReadI32Async(cancellationToken); + Success.Add(_elem170); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testSet_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Set; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Success.Count), cancellationToken); + foreach (int _iter171 in Success) + { + await oprot.WriteI32Async(_iter171, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testSet_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testListArgs : TBase + { + private List _thing; + + public List Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testListArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.List) + { + { + Thing = new List(); + TList _list172 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i173 = 0; _i173 < _list172.Count; ++_i173) + { + int _elem174; + _elem174 = await iprot.ReadI32Async(cancellationToken); + Thing.Add(_elem174); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testList_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Thing != null && __isset.thing) + { + field.Name = "thing"; + field.Type = TType.List; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Thing.Count), cancellationToken); + foreach (int _iter175 in Thing) + { + await oprot.WriteI32Async(_iter175, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testList_args("); + bool __first = true; + if (Thing != null && __isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testListResult : TBase + { + private List _success; + + public List Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testListResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.List) + { + { + Success = new List(); + TList _list176 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i177 = 0; _i177 < _list176.Count; ++_i177) + { + int _elem178; + _elem178 = await iprot.ReadI32Async(cancellationToken); + Success.Add(_elem178); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testList_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.List; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Success.Count), cancellationToken); + foreach (int _iter179 in Success) + { + await oprot.WriteI32Async(_iter179, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testList_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testEnumArgs : TBase + { + private Numberz _thing; + + /// + /// + /// + /// + public Numberz Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testEnumArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Thing = (Numberz)await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testEnum_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int)Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testEnum_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testEnumResult : TBase + { + private Numberz _success; + + /// + /// + /// + /// + public Numberz Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testEnumResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = (Numberz)await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testEnum_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int)Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testEnum_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testTypedefArgs : TBase + { + private long _thing; + + public long Thing + { + get + { + return _thing; + } + set + { + __isset.thing = true; + this._thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool thing; + } + + public testTypedefArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I64) + { + Thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testTypedef_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.thing) + { + field.Name = "thing"; + field.Type = TType.I64; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testTypedef_args("); + bool __first = true; + if (__isset.thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Thing: "); + sb.Append(Thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testTypedefResult : TBase + { + private long _success; + + public long Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testTypedefResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I64) + { + Success = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testTypedef_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I64; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testTypedef_result("); + bool __first = true; + if (__isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMapMapArgs : TBase + { + private int _hello; + + public int Hello + { + get + { + return _hello; + } + set + { + __isset.hello = true; + this._hello = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool hello; + } + + public testMapMapArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Hello = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMapMap_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.hello) + { + field.Name = "hello"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Hello, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMapMap_args("); + bool __first = true; + if (__isset.hello) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Hello: "); + sb.Append(Hello); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMapMapResult : TBase + { + private Dictionary> _success; + + public Dictionary> Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testMapMapResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map180 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i181 = 0; _i181 < _map180.Count; ++_i181) + { + int _key182; + Dictionary _val183; + _key182 = await iprot.ReadI32Async(cancellationToken); + { + _val183 = new Dictionary(); + TMap _map184 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i185 = 0; _i185 < _map184.Count; ++_i185) + { + int _key186; + int _val187; + _key186 = await iprot.ReadI32Async(cancellationToken); + _val187 = await iprot.ReadI32Async(cancellationToken); + _val183[_key186] = _val187; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Success[_key182] = _val183; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMapMap_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Map, Success.Count), cancellationToken); + foreach (int _iter188 in Success.Keys) + { + await oprot.WriteI32Async(_iter188, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success[_iter188].Count), cancellationToken); + foreach (int _iter189 in Success[_iter188].Keys) + { + await oprot.WriteI32Async(_iter189, cancellationToken); + await oprot.WriteI32Async(Success[_iter188][_iter189], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMapMap_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testInsanityArgs : TBase + { + private Insanity _argument; + + public Insanity Argument + { + get + { + return _argument; + } + set + { + __isset.argument = true; + this._argument = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool argument; + } + + public testInsanityArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Argument = new Insanity(); + await Argument.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testInsanity_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Argument != null && __isset.argument) + { + field.Name = "argument"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Argument.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testInsanity_args("); + bool __first = true; + if (Argument != null && __isset.argument) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Argument: "); + sb.Append(Argument== null ? "" : Argument.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testInsanityResult : TBase + { + private Dictionary> _success; + + public Dictionary> Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testInsanityResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Map) + { + { + Success = new Dictionary>(); + TMap _map190 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i191 = 0; _i191 < _map190.Count; ++_i191) + { + long _key192; + Dictionary _val193; + _key192 = await iprot.ReadI64Async(cancellationToken); + { + _val193 = new Dictionary(); + TMap _map194 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i195 = 0; _i195 < _map194.Count; ++_i195) + { + Numberz _key196; + Insanity _val197; + _key196 = (Numberz)await iprot.ReadI32Async(cancellationToken); + _val197 = new Insanity(); + await _val197.ReadAsync(iprot, cancellationToken); + _val193[_key196] = _val197; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + Success[_key192] = _val193; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testInsanity_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Map; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I64, TType.Map, Success.Count), cancellationToken); + foreach (long _iter198 in Success.Keys) + { + await oprot.WriteI64Async(_iter198, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Struct, Success[_iter198].Count), cancellationToken); + foreach (Numberz _iter199 in Success[_iter198].Keys) + { + await oprot.WriteI32Async((int)_iter199, cancellationToken); + await Success[_iter198][_iter199].WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testInsanity_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMultiArgs : TBase + { + private sbyte _arg0; + private int _arg1; + private long _arg2; + private Dictionary _arg3; + private Numberz _arg4; + private long _arg5; + + public sbyte Arg0 + { + get + { + return _arg0; + } + set + { + __isset.arg0 = true; + this._arg0 = value; + } + } + + public int Arg1 + { + get + { + return _arg1; + } + set + { + __isset.arg1 = true; + this._arg1 = value; + } + } + + public long Arg2 + { + get + { + return _arg2; + } + set + { + __isset.arg2 = true; + this._arg2 = value; + } + } + + public Dictionary Arg3 + { + get + { + return _arg3; + } + set + { + __isset.arg3 = true; + this._arg3 = value; + } + } + + /// + /// + /// + /// + public Numberz Arg4 + { + get + { + return _arg4; + } + set + { + __isset.arg4 = true; + this._arg4 = value; + } + } + + public long Arg5 + { + get + { + return _arg5; + } + set + { + __isset.arg5 = true; + this._arg5 = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool arg0; + public bool arg1; + public bool arg2; + public bool arg3; + public bool arg4; + public bool arg5; + } + + public testMultiArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Arg0 = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Arg1 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I64) + { + Arg2 = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Map) + { + { + Arg3 = new Dictionary(); + TMap _map200 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i201 = 0; _i201 < _map200.Count; ++_i201) + { + short _key202; + string _val203; + _key202 = await iprot.ReadI16Async(cancellationToken); + _val203 = await iprot.ReadStringAsync(cancellationToken); + Arg3[_key202] = _val203; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.I32) + { + Arg4 = (Numberz)await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.I64) + { + Arg5 = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMulti_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.arg0) + { + field.Name = "arg0"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Arg0, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg1) + { + field.Name = "arg1"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Arg1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg2) + { + field.Name = "arg2"; + field.Type = TType.I64; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Arg2, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Arg3 != null && __isset.arg3) + { + field.Name = "arg3"; + field.Type = TType.Map; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I16, TType.String, Arg3.Count), cancellationToken); + foreach (short _iter204 in Arg3.Keys) + { + await oprot.WriteI16Async(_iter204, cancellationToken); + await oprot.WriteStringAsync(Arg3[_iter204], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg4) + { + field.Name = "arg4"; + field.Type = TType.I32; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int)Arg4, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.arg5) + { + field.Name = "arg5"; + field.Type = TType.I64; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Arg5, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMulti_args("); + bool __first = true; + if (__isset.arg0) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg0: "); + sb.Append(Arg0); + } + if (__isset.arg1) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg1: "); + sb.Append(Arg1); + } + if (__isset.arg2) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg2: "); + sb.Append(Arg2); + } + if (Arg3 != null && __isset.arg3) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg3: "); + sb.Append(Arg3); + } + if (__isset.arg4) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg4: "); + sb.Append(Arg4); + } + if (__isset.arg5) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg5: "); + sb.Append(Arg5); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMultiResult : TBase + { + private Xtruct _success; + + public Xtruct Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + } + + public testMultiResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMulti_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMulti_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success== null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testExceptionArgs : TBase + { + private string _arg; + + public string Arg + { + get + { + return _arg; + } + set + { + __isset.arg = true; + this._arg = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool arg; + } + + public testExceptionArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Arg = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testException_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Arg != null && __isset.arg) + { + field.Name = "arg"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testException_args("); + bool __first = true; + if (Arg != null && __isset.arg) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg: "); + sb.Append(Arg); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testExceptionResult : TBase + { + private Xception _err1; + + public Xception Err1 + { + get + { + return _err1; + } + set + { + __isset.err1 = true; + this._err1 = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool err1; + } + + public testExceptionResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Struct) + { + Err1 = new Xception(); + await Err1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testException_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.err1) + { + if (Err1 != null) + { + field.Name = "Err1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testException_result("); + bool __first = true; + if (Err1 != null && __isset.err1) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Err1: "); + sb.Append(Err1== null ? "" : Err1.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMultiExceptionArgs : TBase + { + private string _arg0; + private string _arg1; + + public string Arg0 + { + get + { + return _arg0; + } + set + { + __isset.arg0 = true; + this._arg0 = value; + } + } + + public string Arg1 + { + get + { + return _arg1; + } + set + { + __isset.arg1 = true; + this._arg1 = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool arg0; + public bool arg1; + } + + public testMultiExceptionArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + Arg0 = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Arg1 = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMultiException_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (Arg0 != null && __isset.arg0) + { + field.Name = "arg0"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg0, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Arg1 != null && __isset.arg1) + { + field.Name = "arg1"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Arg1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMultiException_args("); + bool __first = true; + if (Arg0 != null && __isset.arg0) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg0: "); + sb.Append(Arg0); + } + if (Arg1 != null && __isset.arg1) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Arg1: "); + sb.Append(Arg1); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testMultiExceptionResult : TBase + { + private Xtruct _success; + private Xception _err1; + private Xception2 _err2; + + public Xtruct Success + { + get + { + return _success; + } + set + { + __isset.success = true; + this._success = value; + } + } + + public Xception Err1 + { + get + { + return _err1; + } + set + { + __isset.err1 = true; + this._err1 = value; + } + } + + public Xception2 Err2 + { + get + { + return _err2; + } + set + { + __isset.err2 = true; + this._err2 = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool success; + public bool err1; + public bool err2; + } + + public testMultiExceptionResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new Xtruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Err1 = new Xception(); + await Err1.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Err2 = new Xception2(); + await Err2.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testMultiException_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if(this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if(this.__isset.err1) + { + if (Err1 != null) + { + field.Name = "Err1"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err1.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + else if(this.__isset.err2) + { + if (Err2 != null) + { + field.Name = "Err2"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Err2.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testMultiException_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Success: "); + sb.Append(Success== null ? "" : Success.ToString()); + } + if (Err1 != null && __isset.err1) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Err1: "); + sb.Append(Err1== null ? "" : Err1.ToString()); + } + if (Err2 != null && __isset.err2) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Err2: "); + sb.Append(Err2== null ? "" : Err2.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + + + public partial class testOnewayArgs : TBase + { + private int _secondsToSleep; + + public int SecondsToSleep + { + get + { + return _secondsToSleep; + } + set + { + __isset.secondsToSleep = true; + this._secondsToSleep = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool secondsToSleep; + } + + public testOnewayArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + SecondsToSleep = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("testOneway_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.secondsToSleep) + { + field.Name = "secondsToSleep"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(SecondsToSleep, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("testOneway_args("); + bool __first = true; + if (__isset.secondsToSleep) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("SecondsToSleep: "); + sb.Append(SecondsToSleep); + } + sb.Append(")"); + return sb.ToString(); + } + } + + } +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs new file mode 100644 index 00000000000..8b6108405b9 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs @@ -0,0 +1,223 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class VersioningTestV1 : TBase + { + private int _begin_in_both; + private string _old_string; + private int _end_in_both; + + public int Begin_in_both + { + get + { + return _begin_in_both; + } + set + { + __isset.begin_in_both = true; + this._begin_in_both = value; + } + } + + public string Old_string + { + get + { + return _old_string; + } + set + { + __isset.old_string = true; + this._old_string = value; + } + } + + public int End_in_both + { + get + { + return _end_in_both; + } + set + { + __isset.end_in_both = true; + this._end_in_both = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool begin_in_both; + public bool old_string; + public bool end_in_both; + } + + public VersioningTestV1() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Begin_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.String) + { + Old_string = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 12: + if (field.Type == TType.I32) + { + End_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("VersioningTestV1"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.begin_in_both) + { + field.Name = "begin_in_both"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Begin_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Old_string != null && __isset.old_string) + { + field.Name = "old_string"; + field.Type = TType.String; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Old_string, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.end_in_both) + { + field.Name = "end_in_both"; + field.Type = TType.I32; + field.ID = 12; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(End_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("VersioningTestV1("); + bool __first = true; + if (__isset.begin_in_both) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Begin_in_both: "); + sb.Append(Begin_in_both); + } + if (Old_string != null && __isset.old_string) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Old_string: "); + sb.Append(Old_string); + } + if (__isset.end_in_both) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("End_in_both: "); + sb.Append(End_in_both); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs new file mode 100644 index 00000000000..994ced5f0cc --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs @@ -0,0 +1,647 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class VersioningTestV2 : TBase + { + private int _begin_in_both; + private int _newint; + private sbyte _newbyte; + private short _newshort; + private long _newlong; + private double _newdouble; + private Bonk _newstruct; + private List _newlist; + private THashSet _newset; + private Dictionary _newmap; + private string _newstring; + private int _end_in_both; + + public int Begin_in_both + { + get + { + return _begin_in_both; + } + set + { + __isset.begin_in_both = true; + this._begin_in_both = value; + } + } + + public int Newint + { + get + { + return _newint; + } + set + { + __isset.newint = true; + this._newint = value; + } + } + + public sbyte Newbyte + { + get + { + return _newbyte; + } + set + { + __isset.newbyte = true; + this._newbyte = value; + } + } + + public short Newshort + { + get + { + return _newshort; + } + set + { + __isset.newshort = true; + this._newshort = value; + } + } + + public long Newlong + { + get + { + return _newlong; + } + set + { + __isset.newlong = true; + this._newlong = value; + } + } + + public double Newdouble + { + get + { + return _newdouble; + } + set + { + __isset.newdouble = true; + this._newdouble = value; + } + } + + public Bonk Newstruct + { + get + { + return _newstruct; + } + set + { + __isset.newstruct = true; + this._newstruct = value; + } + } + + public List Newlist + { + get + { + return _newlist; + } + set + { + __isset.newlist = true; + this._newlist = value; + } + } + + public THashSet Newset + { + get + { + return _newset; + } + set + { + __isset.newset = true; + this._newset = value; + } + } + + public Dictionary Newmap + { + get + { + return _newmap; + } + set + { + __isset.newmap = true; + this._newmap = value; + } + } + + public string Newstring + { + get + { + return _newstring; + } + set + { + __isset.newstring = true; + this._newstring = value; + } + } + + public int End_in_both + { + get + { + return _end_in_both; + } + set + { + __isset.end_in_both = true; + this._end_in_both = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool begin_in_both; + public bool newint; + public bool newbyte; + public bool newshort; + public bool newlong; + public bool newdouble; + public bool newstruct; + public bool newlist; + public bool newset; + public bool newmap; + public bool newstring; + public bool end_in_both; + } + + public VersioningTestV2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Begin_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Newint = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.Byte) + { + Newbyte = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I16) + { + Newshort = await iprot.ReadI16Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 5: + if (field.Type == TType.I64) + { + Newlong = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 6: + if (field.Type == TType.Double) + { + Newdouble = await iprot.ReadDoubleAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 7: + if (field.Type == TType.Struct) + { + Newstruct = new Bonk(); + await Newstruct.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 8: + if (field.Type == TType.List) + { + { + Newlist = new List(); + TList _list44 = await iprot.ReadListBeginAsync(cancellationToken); + for(int _i45 = 0; _i45 < _list44.Count; ++_i45) + { + int _elem46; + _elem46 = await iprot.ReadI32Async(cancellationToken); + Newlist.Add(_elem46); + } + await iprot.ReadListEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.Set) + { + { + Newset = new THashSet(); + TSet _set47 = await iprot.ReadSetBeginAsync(cancellationToken); + for(int _i48 = 0; _i48 < _set47.Count; ++_i48) + { + int _elem49; + _elem49 = await iprot.ReadI32Async(cancellationToken); + Newset.Add(_elem49); + } + await iprot.ReadSetEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 10: + if (field.Type == TType.Map) + { + { + Newmap = new Dictionary(); + TMap _map50 = await iprot.ReadMapBeginAsync(cancellationToken); + for(int _i51 = 0; _i51 < _map50.Count; ++_i51) + { + int _key52; + int _val53; + _key52 = await iprot.ReadI32Async(cancellationToken); + _val53 = await iprot.ReadI32Async(cancellationToken); + Newmap[_key52] = _val53; + } + await iprot.ReadMapEndAsync(cancellationToken); + } + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.String) + { + Newstring = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 12: + if (field.Type == TType.I32) + { + End_in_both = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("VersioningTestV2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.begin_in_both) + { + field.Name = "begin_in_both"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Begin_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newint) + { + field.Name = "newint"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Newint, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newbyte) + { + field.Name = "newbyte"; + field.Type = TType.Byte; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Newbyte, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newshort) + { + field.Name = "newshort"; + field.Type = TType.I16; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI16Async(Newshort, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newlong) + { + field.Name = "newlong"; + field.Type = TType.I64; + field.ID = 5; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(Newlong, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.newdouble) + { + field.Name = "newdouble"; + field.Type = TType.Double; + field.ID = 6; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteDoubleAsync(Newdouble, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newstruct != null && __isset.newstruct) + { + field.Name = "newstruct"; + field.Type = TType.Struct; + field.ID = 7; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Newstruct.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newlist != null && __isset.newlist) + { + field.Name = "newlist"; + field.Type = TType.List; + field.ID = 8; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteListBeginAsync(new TList(TType.I32, Newlist.Count), cancellationToken); + foreach (int _iter54 in Newlist) + { + await oprot.WriteI32Async(_iter54, cancellationToken); + } + await oprot.WriteListEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newset != null && __isset.newset) + { + field.Name = "newset"; + field.Type = TType.Set; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteSetBeginAsync(new TSet(TType.I32, Newset.Count), cancellationToken); + foreach (int _iter55 in Newset) + { + await oprot.WriteI32Async(_iter55, cancellationToken); + } + await oprot.WriteSetEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newmap != null && __isset.newmap) + { + field.Name = "newmap"; + field.Type = TType.Map; + field.ID = 10; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + { + await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Newmap.Count), cancellationToken); + foreach (int _iter56 in Newmap.Keys) + { + await oprot.WriteI32Async(_iter56, cancellationToken); + await oprot.WriteI32Async(Newmap[_iter56], cancellationToken); + } + await oprot.WriteMapEndAsync(cancellationToken); + } + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Newstring != null && __isset.newstring) + { + field.Name = "newstring"; + field.Type = TType.String; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Newstring, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.end_in_both) + { + field.Name = "end_in_both"; + field.Type = TType.I32; + field.ID = 12; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(End_in_both, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("VersioningTestV2("); + bool __first = true; + if (__isset.begin_in_both) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Begin_in_both: "); + sb.Append(Begin_in_both); + } + if (__isset.newint) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newint: "); + sb.Append(Newint); + } + if (__isset.newbyte) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newbyte: "); + sb.Append(Newbyte); + } + if (__isset.newshort) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newshort: "); + sb.Append(Newshort); + } + if (__isset.newlong) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newlong: "); + sb.Append(Newlong); + } + if (__isset.newdouble) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newdouble: "); + sb.Append(Newdouble); + } + if (Newstruct != null && __isset.newstruct) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newstruct: "); + sb.Append(Newstruct== null ? "" : Newstruct.ToString()); + } + if (Newlist != null && __isset.newlist) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newlist: "); + sb.Append(Newlist); + } + if (Newset != null && __isset.newset) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newset: "); + sb.Append(Newset); + } + if (Newmap != null && __isset.newmap) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newmap: "); + sb.Append(Newmap); + } + if (Newstring != null && __isset.newstring) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Newstring: "); + sb.Append(Newstring); + } + if (__isset.end_in_both) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("End_in_both: "); + sb.Append(End_in_both); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs new file mode 100644 index 00000000000..25bad84ae4b --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs @@ -0,0 +1,182 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Xception : TException, TBase + { + private int _errorCode; + private string _message; + + public int ErrorCode + { + get + { + return _errorCode; + } + set + { + __isset.errorCode = true; + this._errorCode = value; + } + } + + public string Message + { + get + { + return _message; + } + set + { + __isset.message = true; + this._message = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool errorCode; + public bool message; + } + + public Xception() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ErrorCode = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Message = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xception"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.errorCode) + { + field.Name = "errorCode"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ErrorCode, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Message != null && __isset.message) + { + field.Name = "message"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Message, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xception("); + bool __first = true; + if (__isset.errorCode) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("ErrorCode: "); + sb.Append(ErrorCode); + } + if (Message != null && __isset.message) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Message: "); + sb.Append(Message); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs new file mode 100644 index 00000000000..075f5cd0cd6 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs @@ -0,0 +1,183 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Xception2 : TException, TBase + { + private int _errorCode; + private Xtruct _struct_thing; + + public int ErrorCode + { + get + { + return _errorCode; + } + set + { + __isset.errorCode = true; + this._errorCode = value; + } + } + + public Xtruct Struct_thing + { + get + { + return _struct_thing; + } + set + { + __isset.struct_thing = true; + this._struct_thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool errorCode; + public bool struct_thing; + } + + public Xception2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + ErrorCode = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Struct_thing = new Xtruct(); + await Struct_thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xception2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.errorCode) + { + field.Name = "errorCode"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(ErrorCode, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Struct_thing != null && __isset.struct_thing) + { + field.Name = "struct_thing"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Struct_thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xception2("); + bool __first = true; + if (__isset.errorCode) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("ErrorCode: "); + sb.Append(ErrorCode); + } + if (Struct_thing != null && __isset.struct_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Struct_thing: "); + sb.Append(Struct_thing== null ? "" : Struct_thing.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs new file mode 100644 index 00000000000..947430b1ce1 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs @@ -0,0 +1,264 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Xtruct : TBase + { + private string _string_thing; + private sbyte _byte_thing; + private int _i32_thing; + private long _i64_thing; + + public string String_thing + { + get + { + return _string_thing; + } + set + { + __isset.string_thing = true; + this._string_thing = value; + } + } + + public sbyte Byte_thing + { + get + { + return _byte_thing; + } + set + { + __isset.byte_thing = true; + this._byte_thing = value; + } + } + + public int I32_thing + { + get + { + return _i32_thing; + } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + public long I64_thing + { + get + { + return _i64_thing; + } + set + { + __isset.i64_thing = true; + this._i64_thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool string_thing; + public bool byte_thing; + public bool i32_thing; + public bool i64_thing; + } + + public Xtruct() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.Byte) + { + Byte_thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.I64) + { + I64_thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_thing != null && __isset.string_thing) + { + field.Name = "string_thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.byte_thing) + { + field.Name = "byte_thing"; + field.Type = TType.Byte; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Byte_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i64_thing) + { + field.Name = "i64_thing"; + field.Type = TType.I64; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(I64_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct("); + bool __first = true; + if (String_thing != null && __isset.string_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("String_thing: "); + sb.Append(String_thing); + } + if (__isset.byte_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Byte_thing: "); + sb.Append(Byte_thing); + } + if (__isset.i32_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + if (__isset.i64_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("I64_thing: "); + sb.Append(I64_thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs new file mode 100644 index 00000000000..6c9afe29339 --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs @@ -0,0 +1,224 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Xtruct2 : TBase + { + private sbyte _byte_thing; + private Xtruct _struct_thing; + private int _i32_thing; + + public sbyte Byte_thing + { + get + { + return _byte_thing; + } + set + { + __isset.byte_thing = true; + this._byte_thing = value; + } + } + + public Xtruct Struct_thing + { + get + { + return _struct_thing; + } + set + { + __isset.struct_thing = true; + this._struct_thing = value; + } + } + + public int I32_thing + { + get + { + return _i32_thing; + } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool byte_thing; + public bool struct_thing; + public bool i32_thing; + } + + public Xtruct2() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.Byte) + { + Byte_thing = await iprot.ReadByteAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + Struct_thing = new Xtruct(); + await Struct_thing.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct2"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.byte_thing) + { + field.Name = "byte_thing"; + field.Type = TType.Byte; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteByteAsync(Byte_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Struct_thing != null && __isset.struct_thing) + { + field.Name = "struct_thing"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Struct_thing.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct2("); + bool __first = true; + if (__isset.byte_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Byte_thing: "); + sb.Append(Byte_thing); + } + if (Struct_thing != null && __isset.struct_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Struct_thing: "); + sb.Append(Struct_thing== null ? "" : Struct_thing.ToString()); + } + if (__isset.i32_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs new file mode 100644 index 00000000000..f76168dfaaf --- /dev/null +++ b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs @@ -0,0 +1,264 @@ +/** + * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; + +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace thrift.test +{ + + public partial class Xtruct3 : TBase + { + private string _string_thing; + private int _changed; + private int _i32_thing; + private long _i64_thing; + + public string String_thing + { + get + { + return _string_thing; + } + set + { + __isset.string_thing = true; + this._string_thing = value; + } + } + + public int Changed + { + get + { + return _changed; + } + set + { + __isset.changed = true; + this._changed = value; + } + } + + public int I32_thing + { + get + { + return _i32_thing; + } + set + { + __isset.i32_thing = true; + this._i32_thing = value; + } + } + + public long I64_thing + { + get + { + return _i64_thing; + } + set + { + __isset.i64_thing = true; + this._i64_thing = value; + } + } + + + public Isset __isset; + public struct Isset + { + public bool string_thing; + public bool changed; + public bool i32_thing; + public bool i64_thing; + } + + public Xtruct3() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.String) + { + String_thing = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.I32) + { + Changed = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 9: + if (field.Type == TType.I32) + { + I32_thing = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 11: + if (field.Type == TType.I64) + { + I64_thing = await iprot.ReadI64Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Xtruct3"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (String_thing != null && __isset.string_thing) + { + field.Name = "string_thing"; + field.Type = TType.String; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(String_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.changed) + { + field.Name = "changed"; + field.Type = TType.I32; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Changed, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i32_thing) + { + field.Name = "i32_thing"; + field.Type = TType.I32; + field.ID = 9; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(I32_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.i64_thing) + { + field.Name = "i64_thing"; + field.Type = TType.I64; + field.ID = 11; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI64Async(I64_thing, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Xtruct3("); + bool __first = true; + if (String_thing != null && __isset.string_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("String_thing: "); + sb.Append(String_thing); + } + if (__isset.changed) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("Changed: "); + sb.Append(Changed); + } + if (__isset.i32_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("I32_thing: "); + sb.Append(I32_thing); + } + if (__isset.i64_thing) + { + if(!__first) { sb.Append(", "); } + __first = false; + sb.Append("I64_thing: "); + sb.Append(I64_thing); + } + sb.Append(")"); + return sb.ToString(); + } + } + +} diff --git a/test/netcore/ThriftTest/project.json b/test/netcore/ThriftTest/project.json new file mode 100644 index 00000000000..1f552361e30 --- /dev/null +++ b/test/netcore/ThriftTest/project.json @@ -0,0 +1,27 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true + }, + + "runtimes": { + "win10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.16.04-x64": {} + }, + + "dependencies": { + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50", + "dependencies": { + "Thrift": "1.0.0-*", + "Microsoft.NETCore.App": { + "version": "1.0.0" + } + } + } + } +} diff --git a/test/netcore/global.json b/test/netcore/global.json new file mode 100644 index 00000000000..c1f3637ee87 --- /dev/null +++ b/test/netcore/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "../../lib/netcore/src" ] +} \ No newline at end of file diff --git a/test/tests.json b/test/tests.json index 2460b837e26..b101bfda54d 100644 --- a/test/tests.json +++ b/test/tests.json @@ -363,6 +363,34 @@ }, "workdir": "csharp" }, + { + "name": "netcore", + "transports": [ + "buffered", + "framed" + ], + "sockets": [ + "ip", + "ip-ssl" + ], + "protocols": [ + "binary", + "compact", + "json" + ], + "server": { + "command": [ + "dotnet restore && dotnet run server" + ] + }, + "client": { + "timeout": 10, + "command": [ + "dotnet run client" + ] + }, + "workdir": "netcore/ThriftTest" + }, { "name": "perl", "transports": [ diff --git a/tutorial/netcore/.gitignore b/tutorial/netcore/.gitignore new file mode 100644 index 00000000000..9938bb237a0 --- /dev/null +++ b/tutorial/netcore/.gitignore @@ -0,0 +1 @@ +!**/*.pfx \ No newline at end of file diff --git a/tutorial/netcore/Client/Client.xproj b/tutorial/netcore/Client/Client.xproj new file mode 100644 index 00000000000..87261821207 --- /dev/null +++ b/tutorial/netcore/Client/Client.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + de78a01b-f7c6-49d1-97da-669d2ed37641 + Client + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/tutorial/netcore/Client/Program.cs b/tutorial/netcore/Client/Program.cs new file mode 100644 index 00000000000..ff4474dd50e --- /dev/null +++ b/tutorial/netcore/Client/Program.cs @@ -0,0 +1,276 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Thrift; +using Thrift.Protocols; +using Thrift.Samples; +using Thrift.Transports; +using Thrift.Transports.Client; + +namespace Client +{ + public class Program + { + private static readonly ILogger Logger = new LoggerFactory().CreateLogger(nameof(Client)); + + private static void DisplayHelp() + { + Console.WriteLine(@" +Usage: + Client.exe -h + will diplay help information + + Client.exe -t: -p: + will run client with specified arguments (tcp transport and binary protocol by default) + +Options: + -t (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + tcpbuffered - buffered transport over tcp will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (address - ""http://localhost:9090"") + tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090) + + -p (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + +Sample: + Client.exe -t:tcp -p:binary +"); + } + + public static void Main(string[] args) + { + args = args ?? new string[0]; + + if (args.Any(x => x.StartsWith("-h", StringComparison.OrdinalIgnoreCase))) + { + DisplayHelp(); + return; + } + + + using (var source = new CancellationTokenSource()) + { + RunAsync(args, source.Token).GetAwaiter().GetResult(); + } + } + + private static async Task RunAsync(string[] args, CancellationToken cancellationToken) + { + var clientTransport = GetTransport(args); + + Logger.LogInformation($"Selected client transport: {clientTransport}"); + + var clientProtocol = GetProtocol(args, clientTransport); + + Logger.LogInformation($"Selected client protocol: {clientProtocol}"); + + await RunClientAsync(clientProtocol, cancellationToken); + } + + private static TClientTransport GetTransport(string[] args) + { + var transport = args.FirstOrDefault(x => x.StartsWith("-t"))?.Split(':')?[1]; + + Transport selectedTransport; + if (Enum.TryParse(transport, true, out selectedTransport)) + { + switch (selectedTransport) + { + case Transport.Tcp: + return new TSocketClientTransport(IPAddress.Loopback, 9090); + case Transport.NamedPipe: + return new TNamedPipeClientTransport(".test"); + case Transport.Http: + return new THttpClientTransport(new Uri("http://localhost:9090"), null); + case Transport.TcpBuffered: + return + new TBufferedClientTransport( + new TSocketClientTransport(IPAddress.Loopback, 9090)); + case Transport.TcpTls: + return new TTlsSocketClientTransport(IPAddress.Loopback, 9090, + GetCertificate(), CertValidator, LocalCertificateSelectionCallback); + case Transport.Framed: + throw new NotSupportedException("Framed is not ready for samples"); + } + } + + return new TSocketClientTransport(IPAddress.Loopback, 9090); + } + + private static X509Certificate2 GetCertificate() + { + // due to files location in net core better to take certs from top folder + var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory())); + return new X509Certificate2(certFile, "ThriftTest"); + } + + private static string GetCertPath(DirectoryInfo di, int maxCount = 6) + { + var topDir = di; + var certFile = + topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories) + .FirstOrDefault(); + if (certFile == null) + { + if (maxCount == 0) + throw new FileNotFoundException("Cannot find file in directories"); + return GetCertPath(di.Parent, maxCount - 1); + } + + return certFile.FullName; + } + + private static X509Certificate LocalCertificateSelectionCallback(object sender, + string targetHost, X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, string[] acceptableIssuers) + { + return GetCertificate(); + } + + private static bool CertValidator(object sender, X509Certificate certificate, + X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return true; + } + + private static TProtocol GetProtocol(string[] args, TClientTransport transport) + { + var protocol = args.FirstOrDefault(x => x.StartsWith("-p"))?.Split(':')?[1]; + + Protocol selectedProtocol; + if (Enum.TryParse(protocol, true, out selectedProtocol)) + { + switch (selectedProtocol) + { + case Protocol.Binary: + return new TBinaryProtocol(transport); + case Protocol.Compact: + return new TCompactProtocol(transport); + case Protocol.Json: + return new TJsonProtocol(transport); + } + } + + return new TBinaryProtocol(transport); + } + + private static async Task RunClientAsync(TProtocol protocol, + CancellationToken cancellationToken) + { + try + { + var client = new Calculator.Client(protocol); + await client.OpenTransportAsync(cancellationToken); + + try + { + // Async version + + Logger.LogInformation("PingAsync()"); + await client.PingAsync(cancellationToken); + + Logger.LogInformation("AddAsync(1,1)"); + var sum = await client.AddAsync(1, 1, cancellationToken); + Logger.LogInformation($"AddAsync(1,1)={sum}"); + + var work = new Work + { + Op = Operation.Divide, + Num1 = 1, + Num2 = 0 + }; + + try + { + Logger.LogInformation("CalculateAsync(1)"); + await client.CalculateAsync(1, work, cancellationToken); + Logger.LogInformation("Whoa we can divide by 0"); + } + catch (InvalidOperation io) + { + Logger.LogInformation("Invalid operation: " + io); + } + + work.Op = Operation.Substract; + work.Num1 = 15; + work.Num2 = 10; + + try + { + Logger.LogInformation("CalculateAsync(1)"); + var diff = await client.CalculateAsync(1, work, cancellationToken); + Logger.LogInformation($"15-10={diff}"); + } + catch (InvalidOperation io) + { + Logger.LogInformation("Invalid operation: " + io); + } + + Logger.LogInformation("GetStructAsync(1)"); + var log = await client.GetStructAsync(1, cancellationToken); + Logger.LogInformation($"Check log: {log.Value}"); + + Logger.LogInformation("ZipAsync() with delay 100mc on server side"); + await client.ZipAsync(cancellationToken); + } + catch (Exception ex) + { + Logger.LogError(ex.ToString()); + } + finally + { + protocol.Transport.Close(); + } + } + catch (TApplicationException x) + { + Logger.LogError(x.ToString()); + } + } + + private enum Transport + { + Tcp, + NamedPipe, + Http, + TcpBuffered, + Framed, + TcpTls + } + + private enum Protocol + { + Binary, + Compact, + Json, + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Client/Properties/AssemblyInfo.cs b/tutorial/netcore/Client/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..935f130638e --- /dev/null +++ b/tutorial/netcore/Client/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Client")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("de78a01b-f7c6-49d1-97da-669d2ed37641")] \ No newline at end of file diff --git a/tutorial/netcore/Client/Properties/launchSettings.json b/tutorial/netcore/Client/Properties/launchSettings.json new file mode 100644 index 00000000000..f351eeb0919 --- /dev/null +++ b/tutorial/netcore/Client/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Client": { + "commandName": "Project", + "commandLineArgs": "-t:tcptls" + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Client/ThriftTest.pfx b/tutorial/netcore/Client/ThriftTest.pfx new file mode 100644 index 0000000000000000000000000000000000000000..f0ded28173dc2c33cebbb2b74e1e9e9e870b5876 GIT binary patch literal 2661 zcmY+Fc{r5q7ssC&Gb1!J$(kiQNi-_kNTzK}lBB4-#%>tDNgCV8K7;IKOK6d75tC&a zp={ZTH)}K@WXZmpv83PB^)A`wF(pXt7XpsY=bHUSlV3;5-A{d&ZS=A9rAjL!JLlxE zU_0M6u}dL5dyZUM*eZRTK7%!HnQk@RhDO-B4XYapVO%Fw7K^smqmrq9#TGaL=NEIm z?!`FK&>hR?Z@)%UKPau-%?m`A(>#}=i#q*6>Xe+P#mwBs6Q0@@Ixp|5@9I+wut zA#tRevtir~_G0T(aAFKzvy!O$=C`*W)A|(nrt(YY1n}Kp^LEZq_lyzXl)hwOG@G=i zxbiB-SnTQD^sz>x%QCdt1fw!Er?MpQ>#O~U^B1Ih|GdFM1{`4ISt#RHN4|ZYyq|=< z{j;$~n=*954;otf@)^47LvcfPIKt$_Y2BL+D}7sV7s{aov!F89pkkhg#@d`RVvtv8 zqhf(QFGtL@?Vi^c`LJWbZE9|TN_1?X9?l3DaIjMO5`V9F;~;j1FwiWFV#DZK zPZjSTs!0RAwSeaugCPfE_z~82e~?}o;1!SDpMJeV`Q?+Y@TQRE z%jhKjwXIG1?LW{8%1ry~$CvoFtuttc!kQ${aiZfTlsc}(9#g1pD3VzLU3ij7h2^CD z;6Lz8^m(Xe5?)8Y0Gr#QxBP*P)`mX~ycEnzpRed9N46To2eUk?5^Lp}$Xu=>65C8xu{J&6G(`>&f z-~~7X>HrGR1atr=u0{d&fFqaa0!O&99#K(?2gPlgcy9MFU_Ez}9Obs^@?Q}%0v{+j;MU>669QYwovF;u<-Oys<_RI{b3>F|lw0+!xJ>$_T%M|8 z*-&MWR7IRjyg|Rdz}Y^1c3>+=Wp`aAotnEcJk{mR2!9S=p@lzc?XYcYm9LJXMtHbTOVA7ageNhdBfi0|v1eLr9PtqI`)XEsA zC0p*r#f2MT4Hybzy5V<-3)*Qcno)THYn1lrjq6Dik zc86XkszLcvn;9QTVpJ9nk<@$OqssciMrRF6FvCqZbspu(u*qkj2*`%Mz8yK zJdDp2+luWj&vuSBXbE_thM;=6A| zTxptZh*kG4;p+`oVSXP~RY=Ckmncb%Q_UISo?$+pr{w0qs^nnM(Hjvem6Iv&+#MtM zv{NJq4}S()s9l6QL`u&D)**e1PVG7Kle}4G&E6j*6WUk@Gf{A7t$m7Kzgxiio)Vux zaUZfKT(@FZ>2x``Vy-=XKo?(27vH5gZ(9I{TgrlFvqh3z9qJGySLfwbj9a-H4Nq*qFpUg@ld}K z)hFz#CqBwVT7Rl=a|*hQAa-`0o9X{L*g@fX}@vnbf G^#21?=Cu0& literal 0 HcmV?d00001 diff --git a/tutorial/netcore/Client/project.json b/tutorial/netcore/Client/project.json new file mode 100644 index 00000000000..8b0884bda92 --- /dev/null +++ b/tutorial/netcore/Client/project.json @@ -0,0 +1,26 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + + "dependencies": { + "Interfaces": "1.0.0-*", + "Microsoft.NETCore.App": { + "version": "1.0.0" + }, + "Thrift": "1.0.0-*" }, + + "runtimes": { + "win10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.16.04-x64": {} + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/tutorial/netcore/Interfaces/Interfaces.xproj b/tutorial/netcore/Interfaces/Interfaces.xproj new file mode 100644 index 00000000000..d472ce6d3c6 --- /dev/null +++ b/tutorial/netcore/Interfaces/Interfaces.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 4d13163d-9067-4c9c-8af0-64e08451397d + Interfaces + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs b/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..a22f945e6a9 --- /dev/null +++ b/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Interfaces")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("4d13163d-9067-4c9c-8af0-64e08451397d")] \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs new file mode 100644 index 00000000000..ab84e328c08 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs @@ -0,0 +1,1230 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Thrift.Samples +{ + public partial class Calculator + { + /// + /// Ahh, now onto the cool part, defining a service. Services just need a name + /// and can optionally inherit from another service using the extends keyword. + /// + [ServiceContract(Namespace = "")] + public interface IAsync : SharedService.IAsync + { + /// + /// A method definition looks like C code. It has a return type, arguments, + /// and optionally a list of exceptions that it may throw. Note that argument + /// lists and exception lists are specified using the exact same syntax as + /// field lists in struct or exception definitions. + /// + [OperationContract] + Task PingAsync(CancellationToken cancellationToken); + + [OperationContract] + Task @AddAsync(int num1, int num2, CancellationToken cancellationToken); + + [OperationContract] + [FaultContract(typeof(InvalidOperationFault))] + Task CalculateAsync(int logid, Work w, CancellationToken cancellationToken); + + /// + /// This method has a oneway modifier. That means the client only makes + /// a request and does not listen for any response at all. Oneway methods + /// must be void. + /// + [OperationContract] + Task ZipAsync(CancellationToken cancellationToken); + } + + + /// + /// Ahh, now onto the cool part, defining a service. Services just need a name + /// and can optionally inherit from another service using the extends keyword. + /// + public class Client : SharedService.Client, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task PingAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Call, SeqId), + cancellationToken); + + var args = new PingArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new PingResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + return; + } + + public async Task @AddAsync(int num1, int num2, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Call, SeqId), + cancellationToken); + + var args = new AddArgs(); + args.Num1 = num1; + args.Num2 = num2; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new AddResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "Add failed: unknown result"); + } + + public async Task CalculateAsync(int logid, Work w, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Call, SeqId), + cancellationToken); + + var args = new CalculateArgs(); + args.Logid = logid; + args.W = w; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new CalculateResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + if (result.__isset.ouch) + { + throw result.Ouch; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "Calculate failed: unknown result"); + } + + public async Task ZipAsync(CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("Zip", TMessageType.Oneway, SeqId), + cancellationToken); + + var args = new ZipArgs(); + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + } + } + + public class AsyncProcessor : SharedService.AsyncProcessor, ITAsyncProcessor + { + private IAsync _iAsync; + + public AsyncProcessor(IAsync iAsync) : base(iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["Ping"] = Ping_ProcessAsync; + processMap_["Add"] = Add_ProcessAsync; + processMap_["Calculate"] = Calculate_ProcessAsync; + processMap_["Zip"] = Zip_ProcessAsync; + } + + + public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task Ping_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new PingArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new PingResult(); + try + { + await _iAsync.PingAsync(cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task Add_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new AddArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new AddResult(); + try + { + result.Success = await _iAsync.@AddAsync(args.Num1, args.Num2, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Reply, seqid), cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task Calculate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new CalculateArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new CalculateResult(); + try + { + try + { + result.Success = await _iAsync.CalculateAsync(args.Logid, args.W, cancellationToken); + } + catch (InvalidOperation ouch) + { + result.Ouch = ouch; + } + await + oprot.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + public async Task Zip_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new ZipArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + try + { + await _iAsync.ZipAsync(cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + } + } + } + + + [DataContract(Namespace = "")] + public partial class PingArgs : TBase + { + public PingArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Ping_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Ping_args("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class PingResult : TBase + { + public PingResult() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Ping_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Ping_result("); + sb.Append(")"); + return sb.ToString(); + } + } + + + [DataContract(Namespace = "")] + public partial class AddArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _num1; + private int _num2; + + public AddArgs() + { + } + + [DataMember(Order = 0)] + public int Num1 + { + get { return _num1; } + set + { + __isset.num1 = true; + this._num1 = value; + } + } + + [DataMember(Order = 0)] + public int Num2 + { + get { return _num2; } + set + { + __isset.num2 = true; + this._num2 = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Num1 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Num2 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Add_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.num1) + { + field.Name = "num1"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Num1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.num2) + { + field.Name = "num2"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Num2, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Add_args("); + bool __first = true; + if (__isset.num1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Num1: "); + sb.Append(Num1); + } + if (__isset.num2) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Num2: "); + sb.Append(Num2); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool num1; + [DataMember] public bool num2; + } + + #region XmlSerializer support + + public bool ShouldSerializeNum1() + { + return __isset.num1; + } + + public bool ShouldSerializeNum2() + { + return __isset.num2; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class AddResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _success; + + public AddResult() + { + } + + [DataMember(Order = 0)] + public int Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Add_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("Add_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + + + [DataContract(Namespace = "")] + public partial class CalculateArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _logid; + private Work _w; + + public CalculateArgs() + { + } + + [DataMember(Order = 0)] + public int Logid + { + get { return _logid; } + set + { + __isset.logid = true; + this._logid = value; + } + } + + [DataMember(Order = 0)] + public Work W + { + get { return _w; } + set + { + __isset.w = true; + this._w = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Logid = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.Struct) + { + W = new Work(); + await W.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Calculate_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.logid) + { + field.Name = "logid"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Logid, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (W != null && __isset.w) + { + field.Name = "w"; + field.Type = TType.Struct; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await W.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Calculate_args("); + bool __first = true; + if (__isset.logid) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Logid: "); + sb.Append(Logid); + } + if (W != null && __isset.w) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("W: "); + sb.Append(W == null ? "" : W.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool logid; + [DataMember] public bool w; + } + + #region XmlSerializer support + + public bool ShouldSerializeLogid() + { + return __isset.logid; + } + + public bool ShouldSerializeW() + { + return __isset.w; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class CalculateResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private InvalidOperation _ouch; + private int _success; + + public CalculateResult() + { + } + + [DataMember(Order = 0)] + public int Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + [DataMember(Order = 0)] + public InvalidOperation Ouch + { + get { return _ouch; } + set + { + __isset.ouch = true; + this._ouch = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.I32) + { + Success = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 1: + if (field.Type == TType.Struct) + { + Ouch = new InvalidOperation(); + await Ouch.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Calculate_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + field.Name = "Success"; + field.Type = TType.I32; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Success, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + else if (this.__isset.ouch) + { + if (Ouch != null) + { + field.Name = "Ouch"; + field.Type = TType.Struct; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Ouch.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Calculate_result("); + bool __first = true; + if (__isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success); + } + if (Ouch != null && __isset.ouch) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Ouch: "); + sb.Append(Ouch == null ? "" : Ouch.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + [DataMember] public bool ouch; + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + public bool ShouldSerializeOuch() + { + return __isset.ouch; + } + + #endregion XmlSerializer support + } + + + [DataContract(Namespace = "")] + public partial class ZipArgs : TBase + { + public ZipArgs() + { + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Zip_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Zip_args("); + sb.Append(")"); + return sb.ToString(); + } + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs b/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs new file mode 100644 index 00000000000..d1936b47229 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs @@ -0,0 +1,234 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Thrift.Samples +{ + /// + /// Structs can also be exceptions, if they are nasty. + /// + public partial class InvalidOperation : TException, TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _WhatOp; + private string _Why; + + public InvalidOperation() + { + } + + [DataMember(Order = 0)] + public int WhatOp + { + get { return _WhatOp; } + set + { + __isset.WhatOp = true; + this._WhatOp = value; + } + } + + [DataMember(Order = 0)] + public string Why + { + get { return _Why; } + set + { + __isset.Why = true; + this._Why = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + WhatOp = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Why = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("InvalidOperation"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.WhatOp) + { + field.Name = "WhatOp"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(WhatOp, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Why != null && __isset.Why) + { + field.Name = "Why"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Why, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("InvalidOperation("); + bool __first = true; + if (__isset.WhatOp) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("WhatOp: "); + sb.Append(WhatOp); + } + if (Why != null && __isset.Why) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Why: "); + sb.Append(Why); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool WhatOp; + [DataMember] public bool Why; + } + + #region XmlSerializer support + + public bool ShouldSerializeWhatOp() + { + return __isset.WhatOp; + } + + public bool ShouldSerializeWhy() + { + return __isset.Why; + } + + #endregion XmlSerializer support + } + + + [DataContract] + public partial class InvalidOperationFault + { + private int _WhatOp; + private string _Why; + + [DataMember(Order = 0)] + public int WhatOp + { + get { return _WhatOp; } + set { this._WhatOp = value; } + } + + [DataMember(Order = 0)] + public string Why + { + get { return _Why; } + set { this._Why = value; } + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs new file mode 100644 index 00000000000..b4f3098bce0 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +namespace Thrift.Samples +{ + /// + /// You can define enums, which are just 32 bit integers. Values are optional + /// and start at 1 if not supplied, C style again. + /// + public enum Operation + { + Add = 1, + Substract = 2, + Multiply = 3, + Divide = 4, + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs b/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs new file mode 100644 index 00000000000..e35564a5839 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs @@ -0,0 +1,439 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Thrift.Samples +{ + public partial class SharedService + { + [ServiceContract(Namespace = "")] + public interface IAsync + { + [OperationContract] + Task GetStructAsync(int key, CancellationToken cancellationToken); + } + + + public class Client : TBaseClient, IDisposable, IAsync + { + public Client(TProtocol protocol) : this(protocol, protocol) + { + } + + public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) + { + } + + public async Task GetStructAsync(int key, CancellationToken cancellationToken) + { + await + OutputProtocol.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Call, SeqId), + cancellationToken); + + var args = new GetStructArgs(); + args.Key = key; + + await args.WriteAsync(OutputProtocol, cancellationToken); + await OutputProtocol.WriteMessageEndAsync(cancellationToken); + await OutputProtocol.Transport.FlushAsync(cancellationToken); + + var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); + if (msg.Type == TMessageType.Exception) + { + var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + throw x; + } + + var result = new GetStructResult(); + await result.ReadAsync(InputProtocol, cancellationToken); + await InputProtocol.ReadMessageEndAsync(cancellationToken); + if (result.__isset.success) + { + return result.Success; + } + throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, + "GetStruct failed: unknown result"); + } + } + + public class AsyncProcessor : ITAsyncProcessor + { + private IAsync _iAsync; + protected Dictionary processMap_ = new Dictionary(); + + public AsyncProcessor(IAsync iAsync) + { + if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); + + _iAsync = iAsync; + processMap_["GetStruct"] = GetStruct_ProcessAsync; + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) + { + return await ProcessAsync(iprot, oprot, CancellationToken.None); + } + + public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) + { + try + { + var msg = await iprot.ReadMessageBeginAsync(cancellationToken); + + ProcessFunction fn; + processMap_.TryGetValue(msg.Name, out fn); + + if (fn == null) + { + await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, + "Invalid method name: '" + msg.Name + "'"); + await + oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + return true; + } + + await fn(msg.SeqID, iprot, oprot, cancellationToken); + } + catch (IOException) + { + return false; + } + + return true; + } + + public async Task GetStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, + CancellationToken cancellationToken) + { + var args = new GetStructArgs(); + await args.ReadAsync(iprot, cancellationToken); + await iprot.ReadMessageEndAsync(cancellationToken); + var result = new GetStructResult(); + try + { + result.Success = await _iAsync.GetStructAsync(args.Key, cancellationToken); + await + oprot.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Reply, seqid), + cancellationToken); + await result.WriteAsync(oprot, cancellationToken); + } + catch (TTransportException) + { + throw; + } + catch (Exception ex) + { + Console.Error.WriteLine("Error occurred in processor:"); + Console.Error.WriteLine(ex.ToString()); + var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, + " Internal error."); + await + oprot.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Exception, seqid), + cancellationToken); + await x.WriteAsync(oprot, cancellationToken); + } + await oprot.WriteMessageEndAsync(cancellationToken); + await oprot.Transport.FlushAsync(cancellationToken); + } + + protected delegate Task ProcessFunction( + int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); + } + + + [DataContract(Namespace = "")] + public partial class GetStructArgs : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _key; + + public GetStructArgs() + { + } + + [DataMember(Order = 0)] + public int Key + { + get { return _key; } + set + { + __isset.key = true; + this._key = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Key = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("GetStruct_args"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.key) + { + field.Name = "key"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeKey() + { + return __isset.key; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("GetStruct_args("); + bool __first = true; + if (__isset.key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Key: "); + sb.Append(Key); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool key; + } + } + + + [DataContract(Namespace = "")] + public partial class GetStructResult : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private SharedStruct _success; + + public GetStructResult() + { + } + + [DataMember(Order = 0)] + public SharedStruct Success + { + get { return _success; } + set + { + __isset.success = true; + this._success = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 0: + if (field.Type == TType.Struct) + { + Success = new SharedStruct(); + await Success.ReadAsync(iprot, cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("GetStruct_result"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + + if (this.__isset.success) + { + if (Success != null) + { + field.Name = "Success"; + field.Type = TType.Struct; + field.ID = 0; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await Success.WriteAsync(oprot, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + #region XmlSerializer support + + public bool ShouldSerializeSuccess() + { + return __isset.success; + } + + #endregion XmlSerializer support + + public override string ToString() + { + var sb = new StringBuilder("GetStruct_result("); + bool __first = true; + if (Success != null && __isset.success) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Success: "); + sb.Append(Success == null ? "" : Success.ToString()); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool success; + } + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs b/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs new file mode 100644 index 00000000000..84901be6663 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs @@ -0,0 +1,210 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Thrift.Samples +{ + [DataContract(Namespace = "")] + public partial class SharedStruct : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private int _Key; + private string _Value; + + public SharedStruct() + { + } + + [DataMember(Order = 0)] + public int Key + { + get { return _Key; } + set + { + __isset.Key = true; + this._Key = value; + } + } + + [DataMember(Order = 0)] + public string Value + { + get { return _Value; } + set + { + __isset.@Value = true; + this._Value = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Key = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.String) + { + Value = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("SharedStruct"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.Key) + { + field.Name = "Key"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Key, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Value != null && __isset.@Value) + { + field.Name = "Value"; + field.Type = TType.String; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Value, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("SharedStruct("); + bool __first = true; + if (__isset.Key) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Key: "); + sb.Append(Key); + } + if (Value != null && __isset.@Value) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Value: "); + sb.Append(Value); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool Key; + [DataMember] public bool @Value; + } + + #region XmlSerializer support + + public bool ShouldSerializeKey() + { + return __isset.Key; + } + + public bool ShouldSerializeValue() + { + return __isset.@Value; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs new file mode 100644 index 00000000000..48ff84297e8 --- /dev/null +++ b/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs @@ -0,0 +1,317 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Thrift; +using Thrift.Collections; +using System.ServiceModel; +using System.Runtime.Serialization; +using Thrift.Protocols; +using Thrift.Protocols.Entities; +using Thrift.Protocols.Utilities; +using Thrift.Transports; +using Thrift.Transports.Client; +using Thrift.Transports.Server; + + +namespace Thrift.Samples +{ + /// + /// Structs are the basic complex data structures. They are comprised of fields + /// which each have an integer identifier, a type, a symbolic name, and an + /// optional default value. + /// Fields can be declared "optional", which ensures they will not be included + /// in the serialized output if they aren't set. Note that this requires some + /// manual management in some languages. + /// + [DataContract(Namespace = "")] + public partial class Work : TBase + { + [DataMember(Order = 1)] public Isset __isset; + + private string _Comment; + private int _Num1; + private int _Num2; + private Operation _Op; + + public Work() + { + this._Num1 = 0; + this.__isset.Num1 = true; + } + + [DataMember(Order = 0)] + public int Num1 + { + get { return _Num1; } + set + { + __isset.Num1 = true; + this._Num1 = value; + } + } + + [DataMember(Order = 0)] + public int Num2 + { + get { return _Num2; } + set + { + __isset.Num2 = true; + this._Num2 = value; + } + } + + /// + /// + /// + [DataMember(Order = 0)] + public Operation Op + { + get { return _Op; } + set + { + __isset.Op = true; + this._Op = value; + } + } + + [DataMember(Order = 0)] + public string Comment + { + get { return _Comment; } + set + { + __isset.Comment = true; + this._Comment = value; + } + } + + public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) + { + iprot.IncrementRecursionDepth(); + try + { + TField field; + await iprot.ReadStructBeginAsync(cancellationToken); + while (true) + { + field = await iprot.ReadFieldBeginAsync(cancellationToken); + if (field.Type == TType.Stop) + { + break; + } + + switch (field.ID) + { + case 1: + if (field.Type == TType.I32) + { + Num1 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 2: + if (field.Type == TType.I32) + { + Num2 = await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 3: + if (field.Type == TType.I32) + { + Op = (Operation) await iprot.ReadI32Async(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + case 4: + if (field.Type == TType.String) + { + Comment = await iprot.ReadStringAsync(cancellationToken); + } + else + { + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + } + break; + default: + await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); + break; + } + + await iprot.ReadFieldEndAsync(cancellationToken); + } + + await iprot.ReadStructEndAsync(cancellationToken); + } + finally + { + iprot.DecrementRecursionDepth(); + } + } + + public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) + { + oprot.IncrementRecursionDepth(); + try + { + var struc = new TStruct("Work"); + await oprot.WriteStructBeginAsync(struc, cancellationToken); + var field = new TField(); + if (__isset.Num1) + { + field.Name = "Num1"; + field.Type = TType.I32; + field.ID = 1; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Num1, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.Num2) + { + field.Name = "Num2"; + field.Type = TType.I32; + field.ID = 2; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async(Num2, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (__isset.Op) + { + field.Name = "Op"; + field.Type = TType.I32; + field.ID = 3; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteI32Async((int) Op, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + if (Comment != null && __isset.Comment) + { + field.Name = "Comment"; + field.Type = TType.String; + field.ID = 4; + await oprot.WriteFieldBeginAsync(field, cancellationToken); + await oprot.WriteStringAsync(Comment, cancellationToken); + await oprot.WriteFieldEndAsync(cancellationToken); + } + await oprot.WriteFieldStopAsync(cancellationToken); + await oprot.WriteStructEndAsync(cancellationToken); + } + finally + { + oprot.DecrementRecursionDepth(); + } + } + + public override string ToString() + { + var sb = new StringBuilder("Work("); + bool __first = true; + if (__isset.Num1) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Num1: "); + sb.Append(Num1); + } + if (__isset.Num2) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Num2: "); + sb.Append(Num2); + } + if (__isset.Op) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Op: "); + sb.Append(Op); + } + if (Comment != null && __isset.Comment) + { + if (!__first) + { + sb.Append(", "); + } + __first = false; + sb.Append("Comment: "); + sb.Append(Comment); + } + sb.Append(")"); + return sb.ToString(); + } + + [DataContract] + public struct Isset + { + [DataMember] public bool Num1; + [DataMember] public bool Num2; + [DataMember] public bool Op; + [DataMember] public bool Comment; + } + + #region XmlSerializer support + + public bool ShouldSerializeNum1() + { + return __isset.Num1; + } + + public bool ShouldSerializeNum2() + { + return __isset.Num2; + } + + public bool ShouldSerializeOp() + { + return __isset.Op; + } + + public bool ShouldSerializeComment() + { + return __isset.Comment; + } + + #endregion XmlSerializer support + } +} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/project.json b/tutorial/netcore/Interfaces/project.json new file mode 100644 index 00000000000..28cf4c19a74 --- /dev/null +++ b/tutorial/netcore/Interfaces/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "System.ServiceModel.Primitives": "4.0.0", + "Thrift": "1.0.0-*" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + }, + + "scripts": { + "precompile": [ + //"%project:Directory%/../../thrift.exe -r -out %project:Directory% --gen netcore:wcf %project:Directory%/tutorial.thrift" + ] + } +} diff --git a/tutorial/netcore/Interfaces/shared.thrift b/tutorial/netcore/Interfaces/shared.thrift new file mode 100644 index 00000000000..35f34b3fede --- /dev/null +++ b/tutorial/netcore/Interfaces/shared.thrift @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * This Thrift file can be included by other Thrift files that want to share + * these definitions. + */ + +namespace csharp Thrift.Samples + +struct SharedStruct { + 1: i32 Key + 2: string Value +} + +service SharedService { + SharedStruct GetStruct(1: i32 key) +} diff --git a/tutorial/netcore/Interfaces/tutorial.thrift b/tutorial/netcore/Interfaces/tutorial.thrift new file mode 100644 index 00000000000..a9816f0f968 --- /dev/null +++ b/tutorial/netcore/Interfaces/tutorial.thrift @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +# Thrift Tutorial +# Mark Slee (mcslee@facebook.com) +# +# This file aims to teach you how to use Thrift, in a .thrift file. Neato. The +# first thing to notice is that .thrift files support standard shell comments. +# This lets you make your thrift file executable and include your Thrift build +# step on the top line. And you can place comments like this anywhere you like. +# +# Before running this file, you will need to have installed the thrift compiler +# into /usr/local/bin. + +/** + * The first thing to know about are types. The available types in Thrift are: + * + * bool Boolean, one byte + * i8 (byte) Signed 8-bit integer + * i16 Signed 16-bit integer + * i32 Signed 32-bit integer + * i64 Signed 64-bit integer + * double 64-bit floating point value + * string String + * binary Blob (byte array) + * map Map from one type to another + * list Ordered list of one type + * set Set of unique elements of one type + * + * Did you also notice that Thrift supports C style comments? + */ + +// Just in case you were wondering... yes. We support simple C comments too. + +/** + * Thrift files can reference other Thrift files to include common struct + * and service definitions. These are found using the current path, or by + * searching relative to any paths specified with the -I compiler flag. + * + * Included objects are accessed using the name of the .thrift file as a + * prefix. i.e. shared.SharedObject + */ +include "shared.thrift" + +namespace csharp Thrift.Samples + +/** + * You can define enums, which are just 32 bit integers. Values are optional + * and start at 1 if not supplied, C style again. + */ +enum Operation { + Add = 1, + Substract = 2, + Multiply = 3, + Divide = 4 +} + +/** + * Structs are the basic complex data structures. They are comprised of fields + * which each have an integer identifier, a type, a symbolic name, and an + * optional default value. + * + * Fields can be declared "optional", which ensures they will not be included + * in the serialized output if they aren't set. Note that this requires some + * manual management in some languages. + */ +struct Work { + 1: i32 Num1 = 0, + 2: i32 Num2, + 3: Operation Op, + 4: optional string Comment, +} + +/** + * Structs can also be exceptions, if they are nasty. + */ +exception InvalidOperation { + 1: i32 WhatOp, + 2: string Why +} + +/** + * Ahh, now onto the cool part, defining a service. Services just need a name + * and can optionally inherit from another service using the extends keyword. + */ +service Calculator extends shared.SharedService { + + /** + * A method definition looks like C code. It has a return type, arguments, + * and optionally a list of exceptions that it may throw. Note that argument + * lists and exception lists are specified using the exact same syntax as + * field lists in struct or exception definitions. + */ + + void Ping(), + + i32 Add(1:i32 num1, 2:i32 num2), + + i32 Calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch), + + /** + * This method has a oneway modifier. That means the client only makes + * a request and does not listen for any response at all. Oneway methods + * must be void. + */ + oneway void Zip() + +} + +/** + * That just about covers the basics. Take a look in the test/ folder for more + * detailed examples. After you run this file, your generated code shows up + * in folders with names gen-. The generated code isn't too scary + * to look at. It even has pretty indentation. + */ diff --git a/tutorial/netcore/README.md b/tutorial/netcore/README.md new file mode 100644 index 00000000000..ca4240dad4c --- /dev/null +++ b/tutorial/netcore/README.md @@ -0,0 +1,253 @@ +# Building of samples for different platforms + +Details: + +- [https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index ](https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index "https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index ") +- [https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog](https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog "https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog") + +# Running of samples + +Please install Thrift C# .NET Core library or copy sources and build them to correcly build and run samples + +# NetCore Server + +Usage: + + Server.exe -h + will diplay help information + + Server.exe -t: -p: + will run server with specified arguments (tcp transport and binary protocol by default) + +Options: + + -t (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + tcpbuffered - tcp buffered transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (http address - ""localhost:9090"") + tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090) + + -p (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + +Sample: + + Server.exe -t:tcp + +**Remarks**: + + For TcpTls mode certificate's file ThriftTest.pfx should be in directory with binaries in case of command line usage (or at project level in case of debugging from IDE). + Password for certificate - "ThriftTest". + + + +# NetCore Client + +Usage: + + Client.exe -h + will diplay help information + + Client.exe -t: -p: + will run client with specified arguments (tcp transport and binary protocol by default) + +Options: + + -t (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + tcpbuffered - buffered transport over tcp will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (address - ""http://localhost:9090"") + tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090) + + -p (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + +Sample: + + Client.exe -t:tcp -p:binary + +Remarks: + + For TcpTls mode certificate's file ThriftTest.pfx should be in directory + with binaries in case of command line usage (or at project level in case of debugging from IDE). + Password for certificate - "ThriftTest". + +# How to test communication between NetCore and Python + +* Generate code with the latest **thrift.exe** util (reuse *.thrift files from Samples folder) +* Ensure that **thrift.exe** util generated folder **gen-py** with generated code for Python +* Create **client.py** and **server.py** from the code examples below and save them to the folder with previosly generated folder **gen-py** +* Run netcore samples (client and server) and python samples (client ans server) + +Remarks: + +Samples of client and server code below use correct methods (operations) +and fields (properties) according to generated contracts from *.thrift files + +At Windows 10 add record **127.0.0.1 testserver** to **C:\Windows\System32\drivers\etc\hosts** file +for correct work of python server + + +**Python Client:** + +```python +import sys +import glob +sys.path.append('gen-py') + +from tutorial import Calculator +from tutorial.ttypes import InvalidOperation, Operation, Work + +from thrift import Thrift +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol + + +def main(): + # Make socket + transport = TSocket.TSocket('127.0.0.1', 9090) + + # Buffering is critical. Raw sockets are very slow + transport = TTransport.TBufferedTransport(transport) + + # Wrap in a protocol + protocol = TBinaryProtocol.TBinaryProtocol(transport) + + # Create a client to use the protocol encoder + client = Calculator.Client(protocol) + + # Connect! + transport.open() + + client.Ping() + print('ping()') + + sum = client.Add(1, 1) + print(('1+1=%d' % (sum))) + + work = Work() + + work.Op = Operation.Divide + work.Num1 = 1 + work.Num2 = 0 + + try: + quotient = client.Calculate(1, work) + print('Whoa? You know how to divide by zero?') + print('FYI the answer is %d' % quotient) + except InvalidOperation as e: + print(('InvalidOperation: %r' % e)) + + work.Op = Operation.Substract + work.Num1 = 15 + work.Num2 = 10 + + diff = client.Calculate(1, work) + print(('15-10=%d' % (diff))) + + log = client.GetStruct(1) + print(('Check log: %s' % (log.Value))) + + client.Zip() + print('zip()') + + # Close! + transport.close() + +if __name__ == '__main__': + try: + main() + except Thrift.TException as tx: + print('%s' % tx.message) +``` + + +**Python Server:** + + +```python +import glob +import sys +sys.path.append('gen-py') + +from tutorial import Calculator +from tutorial.ttypes import InvalidOperation, Operation + +from shared.ttypes import SharedStruct + +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol +from thrift.server import TServer + + +class CalculatorHandler: + def __init__(self): + self.log = {} + + def Ping(self): + print('ping()') + + def Add(self, n1, n2): + print('add(%d,%d)' % (n1, n2)) + return n1 + n2 + + def Calculate(self, logid, work): + print('calculate(%d, %r)' % (logid, work)) + + if work.Op == Operation.Add: + val = work.Num1 + work.Num2 + elif work.Op == Operation.Substract: + val = work.Num1 - work.Num2 + elif work.Op == Operation.Multiply: + val = work.Num1 * work.Num2 + elif work.Op == Operation.Divide: + if work.Num2 == 0: + x = InvalidOperation() + x.WhatOp = work.Op + x.Why = 'Cannot divide by 0' + raise x + val = work.Num1 / work.Num2 + else: + x = InvalidOperation() + x.WhatOp = work.Op + x.Why = 'Invalid operation' + raise x + + log = SharedStruct() + log.Key = logid + log.Value = '%d' % (val) + self.log[logid] = log + + return val + + def GetStruct(self, key): + print('getStruct(%d)' % (key)) + return self.log[key] + + def Zip(self): + print('zip()') + +if __name__ == '__main__': + handler = CalculatorHandler() + processor = Calculator.Processor(handler) + transport = TSocket.TServerSocket(host="testserver", port=9090) + tfactory = TTransport.TBufferedTransportFactory() + pfactory = TBinaryProtocol.TBinaryProtocolFactory() + + server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) + print('Starting the server...') + server.serve() + print('done.') + + # You could do one of these for a multithreaded server + # server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) + # server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory) +``` \ No newline at end of file diff --git a/tutorial/netcore/Server/Program.cs b/tutorial/netcore/Server/Program.cs new file mode 100644 index 00000000000..b71e268e5ea --- /dev/null +++ b/tutorial/netcore/Server/Program.cs @@ -0,0 +1,397 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Thrift; +using Thrift.Protocols; +using Thrift.Samples; +using Thrift.Server; +using Thrift.Transports; +using Thrift.Transports.Server; + +namespace Server +{ + public class Program + { + private static readonly ILogger Logger = new LoggerFactory().CreateLogger(nameof(Server)); + + public static void Main(string[] args) + { + args = args ?? new string[0]; + + if (args.Any(x => x.StartsWith("-h", StringComparison.OrdinalIgnoreCase))) + { + DisplayHelp(); + return; + } + + using (var source = new CancellationTokenSource()) + { + RunAsync(args, source.Token).GetAwaiter().GetResult(); + + Logger.LogInformation("Press any key to stop..."); + + Console.ReadLine(); + source.Cancel(); + } + } + + private static void DisplayHelp() + { + Console.WriteLine(@" +Usage: + Server.exe -h + will diplay help information + + Server.exe -t: -p: + will run server with specified arguments (tcp transport and binary protocol by default) + +Options: + -t (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + tcpbuffered - tcp buffered transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (http address - ""localhost:9090"") + tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090) + + -p (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + +Sample: + Server.exe -t:tcp +"); + } + + private static async Task RunAsync(string[] args, CancellationToken cancellationToken) + { + var selectedTransport = GetTransport(args); + var selectedProtocol = GetProtocol(args); + + if (selectedTransport == Transport.Http) + { + new HttpServerSample().Run(cancellationToken); + } + else + { + await + RunSelectedConfigurationAsync(selectedTransport, selectedProtocol, + cancellationToken); + } + } + + private static Protocol GetProtocol(string[] args) + { + var transport = args.FirstOrDefault(x => x.StartsWith("-p"))?.Split(':')?[1]; + Protocol selectedProtocol; + + Enum.TryParse(transport, true, out selectedProtocol); + + return selectedProtocol; + } + + private static Transport GetTransport(string[] args) + { + var transport = args.FirstOrDefault(x => x.StartsWith("-t"))?.Split(':')?[1]; + Transport selectedTransport; + + Enum.TryParse(transport, true, out selectedTransport); + + return selectedTransport; + } + + private static async Task RunSelectedConfigurationAsync(Transport transport, + Protocol protocol, CancellationToken cancellationToken) + { + var fabric = new LoggerFactory(); + var handler = new CalculatorAsyncHandler(); + var processor = new Calculator.AsyncProcessor(handler); + + TServerTransport serverTransport = null; + + switch (transport) + { + case Transport.Tcp: + serverTransport = new TServerSocketTransport(9090); + break; + case Transport.TcpBuffered: + serverTransport = new TServerSocketTransport(port: 9090, clientTimeout: 10000, + useBufferedSockets: true); + break; + case Transport.NamedPipe: + serverTransport = new TNamedPipeServerTransport(".test"); + break; + case Transport.TcpTls: + serverTransport = new TTlsServerSocketTransport(9090, false, GetCertificate(), + ClientCertValidator, LocalCertificateSelectionCallback); + break; + } + + ITProtocolFactory inputProtocolFactory; + ITProtocolFactory outputProtocolFactory; + + switch (protocol) + { + case Protocol.Binary: + { + inputProtocolFactory = new TBinaryProtocol.Factory(); + outputProtocolFactory = new TBinaryProtocol.Factory(); + } + break; + case Protocol.Compact: + { + inputProtocolFactory = new TCompactProtocol.Factory(); + outputProtocolFactory = new TCompactProtocol.Factory(); + } + break; + case Protocol.Json: + { + inputProtocolFactory = new TJsonProtocol.Factory(); + outputProtocolFactory = new TJsonProtocol.Factory(); + } + break; + default: + throw new ArgumentOutOfRangeException(nameof(protocol), protocol, null); + } + + try + { + Logger.LogInformation( + $"Selected TAsyncServer with {serverTransport} transport and {inputProtocolFactory} protocol factories"); + + var server = new AsyncBaseServer(processor, serverTransport, inputProtocolFactory, + outputProtocolFactory, fabric); + + Logger.LogInformation("Starting the server..."); + await server.ServeAsync(cancellationToken); + } + catch (Exception x) + { + Logger.LogInformation(x.ToString()); + } + + Logger.LogInformation("Server stopped."); + } + + private static X509Certificate2 GetCertificate() + { + // due to files location in net core better to take certs from top folder + var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory())); + return new X509Certificate2(certFile, "ThriftTest"); + } + + private static string GetCertPath(DirectoryInfo di, int maxCount = 6) + { + var topDir = di; + var certFile = + topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories) + .FirstOrDefault(); + if (certFile == null) + { + if (maxCount == 0) + throw new FileNotFoundException("Cannot find file in directories"); + return GetCertPath(di.Parent, maxCount - 1); + } + + return certFile.FullName; + } + + private static X509Certificate LocalCertificateSelectionCallback(object sender, + string targetHost, X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, string[] acceptableIssuers) + { + return GetCertificate(); + } + + private static bool ClientCertValidator(object sender, X509Certificate certificate, + X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return true; + } + + private enum Transport + { + Tcp, + TcpBuffered, + NamedPipe, + Http, + TcpTls + } + + private enum Protocol + { + Binary, + Compact, + Json, + } + + public class HttpServerSample + { + public void Run(CancellationToken cancellationToken) + { + var config = new ConfigurationBuilder() + .AddEnvironmentVariables(prefix: "ASPNETCORE_") + .Build(); + + var host = new WebHostBuilder() + .UseConfiguration(config) + .UseKestrel() + .UseUrls("http://localhost:9090") + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(cancellationToken); + } + + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddEnvironmentVariables(); + + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, + ILoggerFactory loggerFactory) + { + app.UseMiddleware(); + } + } + } + + public class CalculatorAsyncHandler : Calculator.IAsync + { + Dictionary _log; + + public CalculatorAsyncHandler() + { + _log = new Dictionary(); + } + + public async Task GetStructAsync(int key, + CancellationToken cancellationToken) + { + Logger.LogInformation("GetStructAsync({0})", key); + return await Task.FromResult(_log[key]); + } + + public async Task PingAsync(CancellationToken cancellationToken) + { + Logger.LogInformation("PingAsync()"); + await Task.CompletedTask; + } + + public async Task AddAsync(int num1, int num2, CancellationToken cancellationToken) + { + Logger.LogInformation($"AddAsync({num1},{num2})"); + return await Task.FromResult(num1 + num2); + } + + public async Task CalculateAsync(int logid, Work w, + CancellationToken cancellationToken) + { + Logger.LogInformation($"CalculateAsync({logid}, [{w.Op},{w.Num1},{w.Num2}])"); + + var val = 0; + switch (w.Op) + { + case Operation.Add: + val = w.Num1 + w.Num2; + break; + + case Operation.Substract: + val = w.Num1 - w.Num2; + break; + + case Operation.Multiply: + val = w.Num1*w.Num2; + break; + + case Operation.Divide: + if (w.Num2 == 0) + { + var io = new InvalidOperation + { + WhatOp = (int) w.Op, + Why = "Cannot divide by 0" + }; + + throw io; + } + val = w.Num1/w.Num2; + break; + + default: + { + var io = new InvalidOperation + { + WhatOp = (int) w.Op, + Why = "Unknown operation" + }; + + throw io; + } + } + + var entry = new SharedStruct + { + Key = logid, + Value = val.ToString() + }; + + _log[logid] = entry; + + return await Task.FromResult(val); + } + + public async Task ZipAsync(CancellationToken cancellationToken) + { + Logger.LogInformation("ZipAsync() with delay 100mc"); + await Task.Delay(100, CancellationToken.None); + } + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Server/Properties/AssemblyInfo.cs b/tutorial/netcore/Server/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..9062a4c2a6c --- /dev/null +++ b/tutorial/netcore/Server/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Server")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("e210fc10-5aff-4b04-ac21-58afc7b74b0c")] \ No newline at end of file diff --git a/tutorial/netcore/Server/Properties/launchSettings.json b/tutorial/netcore/Server/Properties/launchSettings.json new file mode 100644 index 00000000000..e23253ddfd9 --- /dev/null +++ b/tutorial/netcore/Server/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Server": { + "commandName": "Project", + "commandLineArgs": "-t:tcptls" + } + } +} \ No newline at end of file diff --git a/tutorial/netcore/Server/Server.xproj b/tutorial/netcore/Server/Server.xproj new file mode 100644 index 00000000000..5cebad12004 --- /dev/null +++ b/tutorial/netcore/Server/Server.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + e210fc10-5aff-4b04-ac21-58afc7b74b0c + Server + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/tutorial/netcore/Server/ThriftTest.pfx b/tutorial/netcore/Server/ThriftTest.pfx new file mode 100644 index 0000000000000000000000000000000000000000..f0ded28173dc2c33cebbb2b74e1e9e9e870b5876 GIT binary patch literal 2661 zcmY+Fc{r5q7ssC&Gb1!J$(kiQNi-_kNTzK}lBB4-#%>tDNgCV8K7;IKOK6d75tC&a zp={ZTH)}K@WXZmpv83PB^)A`wF(pXt7XpsY=bHUSlV3;5-A{d&ZS=A9rAjL!JLlxE zU_0M6u}dL5dyZUM*eZRTK7%!HnQk@RhDO-B4XYapVO%Fw7K^smqmrq9#TGaL=NEIm z?!`FK&>hR?Z@)%UKPau-%?m`A(>#}=i#q*6>Xe+P#mwBs6Q0@@Ixp|5@9I+wut zA#tRevtir~_G0T(aAFKzvy!O$=C`*W)A|(nrt(YY1n}Kp^LEZq_lyzXl)hwOG@G=i zxbiB-SnTQD^sz>x%QCdt1fw!Er?MpQ>#O~U^B1Ih|GdFM1{`4ISt#RHN4|ZYyq|=< z{j;$~n=*954;otf@)^47LvcfPIKt$_Y2BL+D}7sV7s{aov!F89pkkhg#@d`RVvtv8 zqhf(QFGtL@?Vi^c`LJWbZE9|TN_1?X9?l3DaIjMO5`V9F;~;j1FwiWFV#DZK zPZjSTs!0RAwSeaugCPfE_z~82e~?}o;1!SDpMJeV`Q?+Y@TQRE z%jhKjwXIG1?LW{8%1ry~$CvoFtuttc!kQ${aiZfTlsc}(9#g1pD3VzLU3ij7h2^CD z;6Lz8^m(Xe5?)8Y0Gr#QxBP*P)`mX~ycEnzpRed9N46To2eUk?5^Lp}$Xu=>65C8xu{J&6G(`>&f z-~~7X>HrGR1atr=u0{d&fFqaa0!O&99#K(?2gPlgcy9MFU_Ez}9Obs^@?Q}%0v{+j;MU>669QYwovF;u<-Oys<_RI{b3>F|lw0+!xJ>$_T%M|8 z*-&MWR7IRjyg|Rdz}Y^1c3>+=Wp`aAotnEcJk{mR2!9S=p@lzc?XYcYm9LJXMtHbTOVA7ageNhdBfi0|v1eLr9PtqI`)XEsA zC0p*r#f2MT4Hybzy5V<-3)*Qcno)THYn1lrjq6Dik zc86XkszLcvn;9QTVpJ9nk<@$OqssciMrRF6FvCqZbspu(u*qkj2*`%Mz8yK zJdDp2+luWj&vuSBXbE_thM;=6A| zTxptZh*kG4;p+`oVSXP~RY=Ckmncb%Q_UISo?$+pr{w0qs^nnM(Hjvem6Iv&+#MtM zv{NJq4}S()s9l6QL`u&D)**e1PVG7Kle}4G&E6j*6WUk@Gf{A7t$m7Kzgxiio)Vux zaUZfKT(@FZ>2x``Vy-=XKo?(27vH5gZ(9I{TgrlFvqh3z9qJGySLfwbj9a-H4Nq*qFpUg@ld}K z)hFz#CqBwVT7Rl=a|*hQAa-`0o9X{L*g@fX}@vnbf G^#21?=Cu0& literal 0 HcmV?d00001 diff --git a/tutorial/netcore/Server/project.json b/tutorial/netcore/Server/project.json new file mode 100644 index 00000000000..8fc6607ee26 --- /dev/null +++ b/tutorial/netcore/Server/project.json @@ -0,0 +1,29 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true + }, + + "dependencies": { + "Interfaces": "1.0.0-*", + "Microsoft.NETCore.App": { + "version": "1.0.0" + }, + "Thrift": "1.0.0-*", + "Microsoft.AspNetCore.Http": "1.0.0", + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", + "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0" }, + "runtimes": { + "win10-x64": {}, + "osx.10.11-x64": {}, + "ubuntu.16.04-x64": {} + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/tutorial/netcore/Tutorial.sln b/tutorial/netcore/Tutorial.sln new file mode 100644 index 00000000000..d300841a1a4 --- /dev/null +++ b/tutorial/netcore/Tutorial.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Server", "Server\Server.xproj", "{E210FC10-5AFF-4B04-AC21-58AFC7B74B0C}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Interfaces", "Interfaces\Interfaces.xproj", "{4D13163D-9067-4C9C-8AF0-64E08451397D}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Client", "Client\Client.xproj", "{DE78A01B-F7C6-49D1-97DA-669D2ED37641}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E210FC10-5AFF-4B04-AC21-58AFC7B74B0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E210FC10-5AFF-4B04-AC21-58AFC7B74B0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E210FC10-5AFF-4B04-AC21-58AFC7B74B0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E210FC10-5AFF-4B04-AC21-58AFC7B74B0C}.Release|Any CPU.Build.0 = Release|Any CPU + {4D13163D-9067-4C9C-8AF0-64E08451397D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D13163D-9067-4C9C-8AF0-64E08451397D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D13163D-9067-4C9C-8AF0-64E08451397D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D13163D-9067-4C9C-8AF0-64E08451397D}.Release|Any CPU.Build.0 = Release|Any CPU + {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From 561aca9f1b2572c0bcc5b7cd8ef11180506a9255 Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Sat, 17 Dec 2016 19:04:08 +0100 Subject: [PATCH 2/2] .NETCore fixes and improvements for merge into Thrift codebase - removed unecessary "netcore_namespace", this form is deprecated - moved t_netcore_generator.cc into the right path + added compiler vcproj - added "netcore" namespace to generator - fixed misc C++ related warnings/errors in generator - removed generated files from the code tree - fix for warning: suggest parentheses around '&&' within '||' - fixed a bunch of wrongly spelled "Thirft"s - added netcore makefiles + m4 for .NET core detection - test suite: dictionary console output fixed - test suite: general improvements + fixes - test suite: refactored server params into class - test suite: aligned cmdline args, added --help - added missing ASF file headers --- .gitignore | 15 + aclocal/ax_prog_dotnetcore_version.m4 | 61 + compiler/cpp/CMakeLists.txt | 1 + compiler/cpp/Makefile.am | 1 + compiler/cpp/compiler.vcxproj | 1 + .../cpp/src/thrift/generate/t_generator.h | 12 + .../generate/t_netcore_generator.cc | 79 +- compiler/cpp/src/thrift/thriftl.ll | 1 - configure.ac | 21 + contrib/fb303/if/fb303.thrift | 1 + lib/Makefile.am | 4 + lib/netcore/.gitignore | 249 - lib/netcore/Makefile.am | 108 + lib/netcore/README.md | 15 +- .../CassandraTest.thrift | 2 +- .../Properties/AssemblyInfo.cs | 5 +- ...hrift.PublicInterfaces.Compile.Tests.xproj | 0 .../project.json | 0 lib/netcore/{src => }/Thrift.sln | 0 .../Thrift/Collections/TCollections.cs | 0 .../{src => }/Thrift/Collections/THashSet.cs | 0 .../{src => }/Thrift/ITAsyncProcessor.cs | 0 .../{src => }/Thrift/ITProcessorFactory.cs | 0 .../Thrift/Properties/AssemblyInfo.cs | 0 .../Thrift/Protocols/Entities/TField.cs | 0 .../Thrift/Protocols/Entities/TList.cs | 0 .../Thrift/Protocols/Entities/TMap.cs | 0 .../Thrift/Protocols/Entities/TMessage.cs | 0 .../Thrift/Protocols/Entities/TMessageType.cs | 0 .../Thrift/Protocols/Entities/TSet.cs | 0 .../Thrift/Protocols/Entities/TStruct.cs | 0 .../Thrift/Protocols/Entities/TType.cs | 0 .../Thrift/Protocols/ITProtocolFactory.cs | 0 .../Thrift/Protocols/TAbstractBase.cs | 0 .../{src => }/Thrift/Protocols/TBase.cs | 0 .../Thrift/Protocols/TBinaryProtocol.cs | 0 .../Thrift/Protocols/TCompactProtocol.cs | 0 .../Thrift/Protocols/TJSONProtocol.cs | 0 .../Thrift/Protocols/TMultiplexedProtocol.cs | 0 .../{src => }/Thrift/Protocols/TProtocol.cs | 0 .../Thrift/Protocols/TProtocolDecorator.cs | 0 .../Thrift/Protocols/TProtocolException.cs | 0 .../Protocols/Utilities/TBase64Utils.cs | 0 .../Protocols/Utilities/TProtocolUtil.cs | 0 .../Thrift/Server/AsyncBaseServer.cs | 0 .../{src => }/Thrift/Server/TBaseServer.cs | 0 .../Thrift/Server/TServerEventHandler.cs | 0 .../Thrift/SingletonTProcessorFactory.cs | 0 .../{src => }/Thrift/TApplicationException.cs | 0 lib/netcore/{src => }/Thrift/TBaseClient.cs | 0 lib/netcore/{src => }/Thrift/TException.cs | 0 .../{src => }/Thrift/TMultiplexedProcessor.cs | 0 lib/netcore/{src => }/Thrift/Thrift.xproj | 0 .../Client/TBufferedClientTransport.cs | 0 .../Client/TFramedClientTransport.cs | 0 .../Transports/Client/THttpClientTransport.cs | 0 .../Client/TMemoryBufferClientTransport.cs | 0 .../Client/TNamedPipeClientTransport.cs | 0 .../Client/TSocketClientTransport.cs | 0 .../Client/TStreamClientTransport.cs | 0 .../Client/TTlsSocketClientTransport.cs | 0 .../Transports/Server/THttpServerTransport.cs | 0 .../Server/TNamedPipeServerTransport.cs | 0 .../Server/TServerSocketTransport.cs | 0 .../Server/TTlsServerSocketTransport.cs | 0 .../Thrift/Transports/TClientTransport.cs | 0 .../Thrift/Transports/TServerTransport.cs | 0 .../Thrift/Transports/TTransportException.cs | 0 .../Thrift/Transports/TTransportFactory.cs | 0 lib/netcore/{src => }/Thrift/project.json | 0 lib/netcore/build.cmd | 31 +- lib/netcore/build.sh | 30 +- lib/netcore/{src => }/global.json | 0 .../Facebook303Test.thrift | 110 - .../Cassandra/Test/AuthenticationException.cs | 147 - .../Cassandra/Test/AuthenticationRequest.cs | 160 - .../Cassandra/Test/AuthorizationException.cs | 147 - .../Apache/Cassandra/Test/Cassandra.cs | 15404 ---------------- .../Cassandra/Test/CassandraTest.Constants.cs | 37 - .../Generated/Apache/Cassandra/Test/CfDef.cs | 1043 -- .../Generated/Apache/Cassandra/Test/Column.cs | 282 - .../Apache/Cassandra/Test/ColumnDef.cs | 326 - .../Cassandra/Test/ColumnOrSuperColumn.cs | 325 - .../Apache/Cassandra/Test/ColumnParent.cs | 195 - .../Apache/Cassandra/Test/ColumnPath.cs | 239 - .../Apache/Cassandra/Test/Compression.cs | 28 - .../Apache/Cassandra/Test/ConsistencyLevel.cs | 84 - .../Apache/Cassandra/Test/CounterColumn.cs | 163 - .../Cassandra/Test/CounterSuperColumn.cs | 181 - .../Apache/Cassandra/Test/CqlMetadata.cs | 264 - .../Cassandra/Test/CqlPreparedResult.cs | 163 - .../Apache/Cassandra/Test/CqlResult.cs | 295 - .../Apache/Cassandra/Test/CqlResultType.cs | 26 - .../Generated/Apache/Cassandra/Test/CqlRow.cs | 184 - .../Apache/Cassandra/Test/Deletion.cs | 261 - .../Apache/Cassandra/Test/EndpointDetails.cs | 257 - .../Apache/Cassandra/Test/IndexClause.cs | 210 - .../Apache/Cassandra/Test/IndexExpression.cs | 194 - .../Apache/Cassandra/Test/IndexOperator.cs | 28 - .../Apache/Cassandra/Test/IndexType.cs | 25 - .../Cassandra/Test/InvalidRequestException.cs | 149 - .../Apache/Cassandra/Test/KeyCount.cs | 163 - .../Apache/Cassandra/Test/KeyRange.cs | 349 - .../Apache/Cassandra/Test/KeySlice.cs | 189 - .../Generated/Apache/Cassandra/Test/KsDef.cs | 374 - .../Apache/Cassandra/Test/Mutation.cs | 218 - .../Cassandra/Test/NotFoundException.cs | 110 - .../Test/SchemaDisagreementException.cs | 110 - .../Apache/Cassandra/Test/SlicePredicate.cs | 239 - .../Apache/Cassandra/Test/SliceRange.cs | 238 - .../Apache/Cassandra/Test/SuperColumn.cs | 188 - .../Cassandra/Test/TimedOutException.cs | 111 - .../Apache/Cassandra/Test/TokenRange.cs | 348 - .../Cassandra/Test/UnavailableException.cs | 110 - .../Facebook/FB303/Test/FacebookService.cs | 3538 ---- .../Facebook/FB303/Test/fb_status.cs | 32 - .../Generated/ThriftAsync/Test/Bonk.cs | 210 - .../Generated/ThriftAsync/Test/BoolTest.cs | 214 - .../Generated/ThriftAsync/Test/Bools.cs | 210 - .../ThriftAsync/Test/CrazyNesting.cs | 482 - .../Generated/ThriftAsync/Test/EmptyStruct.cs | 102 - .../ThriftAsync/Test/GuessProtocolStruct.cs | 185 - .../Generated/ThriftAsync/Test/Insanity.cs | 248 - .../Generated/ThriftAsync/Test/LargeDeltas.cs | 626 - .../Generated/ThriftAsync/Test/ListBonks.cs | 181 - .../ThriftAsync/Test/ListTypeVersioningV1.cs | 227 - .../ThriftAsync/Test/ListTypeVersioningV2.cs | 227 - .../ThriftAsync/Test/NestedListsBonk.cs | 218 - .../ThriftAsync/Test/NestedListsI32x2.cs | 197 - .../ThriftAsync/Test/NestedListsI32x3.cs | 216 - .../ThriftAsync/Test/NestedMixedx2.cs | 391 - .../Generated/ThriftAsync/Test/Numberz.cs | 32 - .../Generated/ThriftAsync/Test/OneField.cs | 164 - .../ThriftAsync/Test/SecondService.cs | 638 - .../Generated/ThriftAsync/Test/StructA.cs | 135 - .../Generated/ThriftAsync/Test/StructB.cs | 201 - .../Generated/ThriftAsync/Test/ThriftTest.cs | 7866 -------- .../Test/ThriftTestAsync.Constants.cs | 37 - .../ThriftAsync/Test/VersioningTestV1.cs | 257 - .../ThriftAsync/Test/VersioningTestV2.cs | 735 - .../Generated/ThriftAsync/Test/Xception.cs | 231 - .../Generated/ThriftAsync/Test/Xception2.cs | 232 - .../Generated/ThriftAsync/Test/Xtruct.cs | 351 - .../Generated/ThriftAsync/Test/Xtruct2.cs | 258 - .../Generated/ThriftAsync/Test/Xtruct3.cs | 304 - .../ThriftTestAsync.thrift | 382 - test/Makefile.am | 4 + test/ThriftTest.thrift | 1 + test/netcore/.gitignore | 5 - test/netcore/Makefile.am | 68 + test/netcore/ThriftTest/Program.cs | 50 +- .../ThriftTest/Properties/AssemblyInfo.cs | 26 +- test/netcore/ThriftTest/TestClient.cs | 155 +- test/netcore/ThriftTest/TestServer.cs | 341 +- .../{ThirftTest.sln => ThriftTest.sln} | 4 +- .../{ThirftTest.xproj => ThriftTest.xproj} | 2 +- .../gen-netcore/thrift/test/Bonk.cs | 182 - .../gen-netcore/thrift/test/BoolTest.cs | 186 - .../gen-netcore/thrift/test/Bools.cs | 182 - .../gen-netcore/thrift/test/CrazyNesting.cs | 400 - .../gen-netcore/thrift/test/EmptyStruct.cs | 92 - .../thrift/test/GuessProtocolStruct.cs | 161 - .../gen-netcore/thrift/test/Insanity.cs | 220 - .../gen-netcore/thrift/test/LargeDeltas.cs | 550 - .../gen-netcore/thrift/test/ListBonks.cs | 159 - .../thrift/test/ListTypeVersioningV1.cs | 199 - .../thrift/test/ListTypeVersioningV2.cs | 199 - .../thrift/test/NestedListsBonk.cs | 193 - .../thrift/test/NestedListsI32x2.cs | 175 - .../thrift/test/NestedListsI32x3.cs | 192 - .../gen-netcore/thrift/test/NestedMixedx2.cs | 348 - .../gen-netcore/thrift/test/Numberz.cs | 22 - .../gen-netcore/thrift/test/OneField.cs | 142 - .../gen-netcore/thrift/test/SecondService.cs | 581 - .../gen-netcore/thrift/test/StructA.cs | 124 - .../gen-netcore/thrift/test/StructB.cs | 175 - .../thrift/test/ThriftTest.Constants.cs | 24 - .../gen-netcore/thrift/test/ThriftTest.cs | 7046 ------- .../thrift/test/VersioningTestV1.cs | 223 - .../thrift/test/VersioningTestV2.cs | 647 - .../gen-netcore/thrift/test/Xception.cs | 182 - .../gen-netcore/thrift/test/Xception2.cs | 183 - .../gen-netcore/thrift/test/Xtruct.cs | 264 - .../gen-netcore/thrift/test/Xtruct2.cs | 224 - .../gen-netcore/thrift/test/Xtruct3.cs | 264 - test/netcore/ThriftTest/project.json | 4 +- test/netcore/build.cmd | 45 + test/netcore/build.sh | 54 + test/netcore/global.json | 2 +- tutorial/Makefile.am | 4 + tutorial/netcore/Client/Program.cs | 19 +- .../netcore/Client/Properties/AssemblyInfo.cs | 5 +- tutorial/netcore/Client/project.json | 4 +- .../Interfaces/Properties/AssemblyInfo.cs | 5 +- .../Interfaces/Thrift/Samples/Calculator.cs | 1230 -- .../Thrift/Samples/InvalidOperation.cs | 234 - .../Interfaces/Thrift/Samples/Operation.cs | 31 - .../Thrift/Samples/SharedService.cs | 439 - .../Interfaces/Thrift/Samples/SharedStruct.cs | 210 - .../netcore/Interfaces/Thrift/Samples/Work.cs | 317 - tutorial/netcore/Interfaces/project.json | 3 +- tutorial/netcore/Interfaces/shared.thrift | 34 - tutorial/netcore/Interfaces/tutorial.thrift | 131 - tutorial/netcore/Makefile.am | 82 + tutorial/netcore/README.md | 4 +- tutorial/netcore/Server/Program.cs | 22 +- .../netcore/Server/Properties/AssemblyInfo.cs | 5 +- tutorial/netcore/Server/project.json | 4 +- tutorial/netcore/Tutorial.sln | 11 + tutorial/netcore/build.cmd | 45 + tutorial/netcore/build.sh | 44 + tutorial/netcore/global.json | 3 + tutorial/shared.thrift | 1 + tutorial/tutorial.thrift | 1 + 214 files changed, 1061 insertions(+), 59765 deletions(-) create mode 100644 aclocal/ax_prog_dotnetcore_version.m4 rename compiler/cpp/src/{ => thrift}/generate/t_netcore_generator.cc (98%) delete mode 100644 lib/netcore/.gitignore create mode 100644 lib/netcore/Makefile.am rename lib/netcore/{src => }/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift (99%) rename lib/netcore/{src => }/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs (90%) rename lib/netcore/{src => }/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj (100%) rename lib/netcore/{src => }/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json (100%) rename lib/netcore/{src => }/Thrift.sln (100%) rename lib/netcore/{src => }/Thrift/Collections/TCollections.cs (100%) rename lib/netcore/{src => }/Thrift/Collections/THashSet.cs (100%) rename lib/netcore/{src => }/Thrift/ITAsyncProcessor.cs (100%) rename lib/netcore/{src => }/Thrift/ITProcessorFactory.cs (100%) rename lib/netcore/{src => }/Thrift/Properties/AssemblyInfo.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TField.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TList.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TMap.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TMessage.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TMessageType.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TSet.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TStruct.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Entities/TType.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/ITProtocolFactory.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TAbstractBase.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TBase.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TBinaryProtocol.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TCompactProtocol.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TJSONProtocol.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TMultiplexedProtocol.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TProtocol.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TProtocolDecorator.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/TProtocolException.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Utilities/TBase64Utils.cs (100%) rename lib/netcore/{src => }/Thrift/Protocols/Utilities/TProtocolUtil.cs (100%) rename lib/netcore/{src => }/Thrift/Server/AsyncBaseServer.cs (100%) rename lib/netcore/{src => }/Thrift/Server/TBaseServer.cs (100%) rename lib/netcore/{src => }/Thrift/Server/TServerEventHandler.cs (100%) rename lib/netcore/{src => }/Thrift/SingletonTProcessorFactory.cs (100%) rename lib/netcore/{src => }/Thrift/TApplicationException.cs (100%) rename lib/netcore/{src => }/Thrift/TBaseClient.cs (100%) rename lib/netcore/{src => }/Thrift/TException.cs (100%) rename lib/netcore/{src => }/Thrift/TMultiplexedProcessor.cs (100%) rename lib/netcore/{src => }/Thrift/Thrift.xproj (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TBufferedClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TFramedClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/THttpClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TMemoryBufferClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TNamedPipeClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TSocketClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TStreamClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Client/TTlsSocketClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Server/THttpServerTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Server/TNamedPipeServerTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Server/TServerSocketTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/Server/TTlsServerSocketTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/TClientTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/TServerTransport.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/TTransportException.cs (100%) rename lib/netcore/{src => }/Thrift/Transports/TTransportFactory.cs (100%) rename lib/netcore/{src => }/Thrift/project.json (100%) rename lib/netcore/{src => }/global.json (100%) delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs delete mode 100644 lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift delete mode 100644 test/netcore/.gitignore create mode 100644 test/netcore/Makefile.am rename test/netcore/ThriftTest/{ThirftTest.sln => ThriftTest.sln} (87%) rename test/netcore/ThriftTest/{ThirftTest.xproj => ThriftTest.xproj} (96%) delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs delete mode 100644 test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs create mode 100644 test/netcore/build.cmd create mode 100644 test/netcore/build.sh delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs delete mode 100644 tutorial/netcore/Interfaces/Thrift/Samples/Work.cs delete mode 100644 tutorial/netcore/Interfaces/shared.thrift delete mode 100644 tutorial/netcore/Interfaces/tutorial.thrift create mode 100644 tutorial/netcore/Makefile.am create mode 100644 tutorial/netcore/build.cmd create mode 100644 tutorial/netcore/build.sh create mode 100644 tutorial/netcore/global.json diff --git a/.gitignore b/.gitignore index 140c93b003f..9d2463efed9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ node_modules compile test-driver erl_crash.dump +project.lock.json .sonar .DS_Store @@ -215,6 +216,10 @@ erl_crash.dump /lib/hs/dist /lib/java/build /lib/js/test/build +/lib/netcore/**/.vs +/lib/netcore/**/bin +/lib/netcore/**/obj +/lib/netcore/**/gen-* /lib/nodejs/coverage /lib/nodejs/node_modules/ /lib/perl/MANIFEST @@ -290,6 +295,11 @@ erl_crash.dump /test/hs/TestServer /test/py.twisted/_trial_temp/ /test/rb/Gemfile.lock +/test/netcore/**/.vs +/test/netcore/**/bin +/test/netcore/**/obj +/test/netcore/**/gen-* +/test/netcore/Thrift /tutorial/cpp/TutorialClient /tutorial/cpp/TutorialServer /tutorial/c_glib/tutorial_client @@ -323,4 +333,9 @@ erl_crash.dump /tutorial/hs/dist/ /tutorial/java/build/ /tutorial/js/build/ +/tutorial/netcore/**/.vs +/tutorial/netcore/**/bin +/tutorial/netcore/**/obj +/tutorial/netcore/**/gen-* +/tutorial/netcore/Thrift /ylwrap diff --git a/aclocal/ax_prog_dotnetcore_version.m4 b/aclocal/ax_prog_dotnetcore_version.m4 new file mode 100644 index 00000000000..45c7a4e1ab5 --- /dev/null +++ b/aclocal/ax_prog_dotnetcore_version.m4 @@ -0,0 +1,61 @@ +# ============================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_dotnetcore_version.html +# ============================================================================== +# +# SYNOPSIS +# +# AX_PROG_DOTNETCORE_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# Makes sure that .NET Core supports the version indicated. If true the +# shell commands in ACTION-IF-TRUE are executed. If not the shell commands +# in ACTION-IF-FALSE are run. The $dotnetcore_version variable will be +# filled with the detected version. +# +# This macro uses the $DOTNETCORE variable to perform the check. If +# $DOTNETCORE is not set prior to calling this macro, the macro will fail. +# +# Example: +# +# AC_PATH_PROG([DOTNETCORE],[dotnet]) +# AC_PROG_DOTNETCORE_VERSION([1.0.2],[ ... ],[ ... ]) +# +# Searches for .NET Core, then checks if at least version 1.0.2 is +# present. +# +# LICENSE +# +# Copyright (c) 2016 Jens Geyer +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_PROG_DOTNETCORE_VERSION],[ + AC_REQUIRE([AC_PROG_SED]) + + AS_IF([test -n "$DOTNETCORE"],[ + ax_dotnetcore_version="$1" + + AC_MSG_CHECKING([for .NET Core version]) + dotnetcore_version=`$DOTNETCORE --version 2>&1 | $SED -e 's/\(@<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\)\(.*\)/\1/'` + AC_MSG_RESULT($dotnetcore_version) + + AC_SUBST([DOTNETCORE_VERSION],[$dotnetcore_version]) + + AX_COMPARE_VERSION([$ax_dotnetcore_version],[le],[$dotnetcore_version],[ + : + $2 + ],[ + : + $3 + ]) + ],[ + AC_MSG_WARN([could not find .NET Core]) + $3 + ]) +]) diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt index 02ed78c6488..85e351dcc4f 100644 --- a/compiler/cpp/CMakeLists.txt +++ b/compiler/cpp/CMakeLists.txt @@ -74,6 +74,7 @@ THRIFT_ADD_COMPILER(as3 "Enable compiler for ActionScript 3" ON) THRIFT_ADD_COMPILER(dart "Enable compiler for Dart" ON) THRIFT_ADD_COMPILER(haxe "Enable compiler for Haxe" ON) THRIFT_ADD_COMPILER(csharp "Enable compiler for C#" ON) +THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON) THRIFT_ADD_COMPILER(py "Enable compiler for Python 2.0" ON) THRIFT_ADD_COMPILER(rb "Enable compiler for Ruby" ON) THRIFT_ADD_COMPILER(perl "Enable compiler for Perl" ON) diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am index a2393916dd2..5d424b4e012 100644 --- a/compiler/cpp/Makefile.am +++ b/compiler/cpp/Makefile.am @@ -87,6 +87,7 @@ thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \ src/thrift/generate/t_dart_generator.cc \ src/thrift/generate/t_haxe_generator.cc \ src/thrift/generate/t_csharp_generator.cc \ + src/thrift/generate/t_netcore_generator.cc \ src/thrift/generate/t_py_generator.cc \ src/thrift/generate/t_rb_generator.cc \ src/thrift/generate/t_perl_generator.cc \ diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj index 878e2199a1f..1e8636061eb 100644 --- a/compiler/cpp/compiler.vcxproj +++ b/compiler/cpp/compiler.vcxproj @@ -57,6 +57,7 @@ + diff --git a/compiler/cpp/src/thrift/generate/t_generator.h b/compiler/cpp/src/thrift/generate/t_generator.h index 051bbc423ca..fc3f3232190 100644 --- a/compiler/cpp/src/thrift/generate/t_generator.h +++ b/compiler/cpp/src/thrift/generate/t_generator.h @@ -172,6 +172,18 @@ class t_generator { void indent_down() { --indent_; } + /** + * Indentation validation helper + */ + int indent_count() { return indent_; } + + void indent_validate( int expected, const char * func_name) { + if (indent_ != expected) { + pverbose("Wrong indent count in %s: difference = %i \n", func_name, (expected - indent_)); + } + } + + /** * Indentation print function */ diff --git a/compiler/cpp/src/generate/t_netcore_generator.cc b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc similarity index 98% rename from compiler/cpp/src/generate/t_netcore_generator.cc rename to compiler/cpp/src/thrift/generate/t_netcore_generator.cc index ff436658c72..f4298c2f650 100644 --- a/compiler/cpp/src/generate/t_netcore_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc @@ -33,8 +33,8 @@ #include #include -#include "platform.h" -#include "t_oop_generator.h" +#include "thrift/platform.h" +#include "thrift/generate/t_oop_generator.h" using std::map; using std::ofstream; @@ -105,14 +105,14 @@ class t_netcore_generator : public t_oop_generator } // overrides - void init_generator() override; - void close_generator() override; - void generate_consts(vector consts) override; - void generate_typedef(t_typedef* ttypedef) override; - void generate_enum(t_enum* tenum) override; - void generate_struct(t_struct* tstruct) override; - void generate_xception(t_struct* txception) override; - void generate_service(t_service* tservice) override; + void init_generator(); + void close_generator(); + void generate_consts(vector consts); + void generate_typedef(t_typedef* ttypedef); + void generate_enum(t_enum* tenum); + void generate_struct(t_struct* tstruct); + void generate_xception(t_struct* txception); + void generate_service(t_service* tservice); void generate_property(ofstream& out, t_field* tfield, bool isPublic, bool generateIsset); void generate_netcore_property(ofstream& out, t_field* tfield, bool isPublic, bool includeIsset = true, string fieldPrefix = ""); @@ -169,7 +169,7 @@ class t_netcore_generator : public t_oop_generator string argument_list(t_struct* tstruct); string type_to_enum(t_type* ttype); string prop_name(t_field* tfield, bool suppress_mapping = false); - string get_enum_class_name(t_type* type) override; + string get_enum_class_name(t_type* type); static string correct_function_name_for_async(string const& function_name) { @@ -194,7 +194,7 @@ class t_netcore_generator : public t_oop_generator size_t i = struct_name.find(args_end); if (i != string::npos) { - string new_struct_name = { struct_name }; + string new_struct_name = struct_name; new_struct_name.replace(i, args_end.length(), "Args"); return new_struct_name; } @@ -203,7 +203,7 @@ class t_netcore_generator : public t_oop_generator size_t j = struct_name.find(result_end); if (j != string::npos) { - string new_struct_name = { struct_name }; + string new_struct_name = struct_name; new_struct_name.replace(j, result_end.length(), "Result"); return new_struct_name; } @@ -225,44 +225,11 @@ class t_netcore_generator : public t_oop_generator return ttype->is_container() || ttype->is_struct() || ttype->is_xception() || ttype->is_string(); } - // TODO: discuss improvements to base class (indent_reset, etc.) - string indent() - { - string spaces_per_indent = " "; - string ind = ""; - int i; - for (i = 0; i < _indent; ++i) { - ind += spaces_per_indent; - } - return ind; - } - - void indent_up() { ++_indent; } - void indent_down() { --_indent; } - void reset_indent() { _indent = 0; } - - void scope_up(std::ostream& out) - { - out << indent() << "{" << endl; - indent_up(); - } - - void scope_down(std::ostream& out) - { - indent_down(); - out << indent() << "}" << endl; - } - - int indent_count() - { - return _indent; - } private: string namespace_name_; string namespace_dir_; - int _indent = 0; bool nullable_; bool union_; bool hashcode_; @@ -290,7 +257,7 @@ void t_netcore_generator::init_generator() namespace_name_ = program_->get_namespace("netcore"); if (namespace_name_.empty()) { - namespace_name_ = program_->get_namespace("csharp"); + namespace_name_ = program_->get_namespace("netcore"); } string dir = namespace_name_; @@ -317,7 +284,7 @@ void t_netcore_generator::init_generator() cleanup_member_name_mapping(member_mapping_scopes.back().scope_member); } - pverbose("C# options:\n"); + pverbose(".NET Core options:\n"); pverbose("- nullable ... %s\n", (nullable_ ? "ON" : "off")); pverbose("- union ...... %s\n", (union_ ? "ON" : "off")); pverbose("- hashcode ... %s\n", (hashcode_ ? "ON" : "off")); @@ -540,7 +507,7 @@ void t_netcore_generator::generate_enum(t_enum* tenum) end_netcore_namespace(f_enum); f_enum.close(); - if (indent_count() != ic) { pverbose("Wrong indent count in generate_enum. Difference: %i \n", (ic - indent_count())); } + indent_validate(ic, "generate_enum"); } void t_netcore_generator::generate_consts(vector consts) @@ -798,7 +765,7 @@ void t_netcore_generator::generate_netcore_struct(t_struct* tstruct, bool is_exc f_struct.close(); - if (indent_count() != ic) { pverbose("Wrong indent count in generate_netcore_struct. Difference: %i \n", (ic - indent_count())); } + indent_validate(ic, "generate_netcore_struct"); } void t_netcore_generator::generate_netcore_struct_definition(ofstream& out, t_struct* tstruct, bool is_exception, bool in_class, bool is_result) @@ -1435,7 +1402,7 @@ void t_netcore_generator::generate_netcore_union(t_struct* tunion) f_union.close(); - if (indent_count() != ic) { pverbose("Wrong indent count in generate_netcore_union. Difference: %i \n", (ic - indent_count())); } + indent_validate(ic, "generate_netcore_union."); } void t_netcore_generator::generate_netcore_union_definition(ofstream& out, t_struct* tunion) @@ -1658,8 +1625,6 @@ void t_netcore_generator::generate_service(t_service* tservice) f_service << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl; - reset_indent(); - start_netcore_namespace(f_service); f_service << indent() << "public partial class " << normalize_name(service_name_) << endl @@ -1677,7 +1642,7 @@ void t_netcore_generator::generate_service(t_service* tservice) end_netcore_namespace(f_service); f_service.close(); - if (indent_count() != ic) { pverbose("Wrong indent count in generate_service. Difference: %i \n", (ic - indent_count())); } + indent_validate(ic, "generate_service."); } void t_netcore_generator::generate_service_interface(ofstream& out, t_service* tservice) @@ -1909,7 +1874,7 @@ void t_netcore_generator::generate_service_client(ofstream& out, t_service* tser } indent_down(); - out << indent() << "}" << endl << endl; + out << indent() << "}" << endl << endl; } void t_netcore_generator::generate_service_server(ofstream& out, t_service* tservice) @@ -2004,7 +1969,7 @@ void t_netcore_generator::generate_service_server(ofstream& out, t_service* tser << endl << indent() << "if (fn == null)" << endl << indent() << "{" << endl; - indent_up(); + indent_up(); out << indent() << "await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken);" << endl << indent() << "await iprot.ReadMessageEndAsync(cancellationToken);" << endl << indent() << "var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, \"Invalid method name: '\" + msg.Name + \"'\");" << endl @@ -2692,7 +2657,7 @@ void t_netcore_generator::generate_netcore_property(ofstream& out, t_field* tfie } bool has_default = field_has_default(tfield); bool is_required = field_is_required(tfield); - if (nullable_ && !has_default || is_required) + if ((nullable_ && !has_default) || is_required) { out << indent() << (isPublic ? "public " : "private ") << type_name(tfield->get_type(), false, false, true, is_required) << " " << prop_name(tfield) << " { get; set; }" << endl; } diff --git a/compiler/cpp/src/thrift/thriftl.ll b/compiler/cpp/src/thrift/thriftl.ll index 10710361943..bf7e8a56ca7 100644 --- a/compiler/cpp/src/thrift/thriftl.ll +++ b/compiler/cpp/src/thrift/thriftl.ll @@ -208,7 +208,6 @@ literal_begin (['\"]) "java_package" { error_unsupported_namespace_decl("java_package", "java"); /* do nothing */ } "cocoa_prefix" { error_unsupported_namespace_decl("cocoa_prefix", "cocoa"); /* do nothing */ } "csharp_namespace" { error_unsupported_namespace_decl("csharp"); /* do nothing */ } -"netcore_namespace" { error_unsupported_namespace_decl("netcore"); /* do nothing */ } "delphi_namespace" { error_unsupported_namespace_decl("delphi"); /* do nothing */ } "php_namespace" { error_unsupported_namespace_decl("php"); /* do nothing */ } "py_module" { error_unsupported_namespace_decl("py_module", "py"); /* do nothing */ } diff --git a/configure.ac b/configure.ac index d3ea7917209..dad10a72f86 100755 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,7 @@ if test "$enable_libs" = "no"; then with_ruby="no" with_haskell="no" with_haxe="no" + with_dotnetcore="no" with_perl="no" with_php="no" with_php_extension="no" @@ -420,6 +421,16 @@ fi AM_CONDITIONAL(WITH_HAXE, [test "$have_haxe" = "yes"]) +AX_THRIFT_LIB(dotnetcore, [.NET Core], yes) +if test "$with_dotnetcore" = "yes"; then + AC_PATH_PROG([DOTNETCORE], [dotnet]) + if [[ -x "$DOTNETCORE" ]] ; then + AX_PROG_DOTNETCORE_VERSION( [1.0.0], have_dotnetcore="yes", have_dotnetcore="no") + fi +fi +AM_CONDITIONAL(WITH_DOTNETCORE, [test "$have_dotnetcore" = "yes"]) + + AX_THRIFT_LIB(d, [D], yes) if test "$with_d" = "yes"; then AX_DMD @@ -757,6 +768,7 @@ AC_CONFIG_FILES([ lib/js/test/Makefile lib/json/Makefile lib/json/test/Makefile + lib/netcore/Makefile lib/nodejs/Makefile lib/perl/Makefile lib/perl/test/Makefile @@ -778,6 +790,7 @@ AC_CONFIG_FILES([ test/haxe/Makefile test/hs/Makefile test/lua/Makefile + test/netcore/Makefile test/php/Makefile test/dart/Makefile test/perl/Makefile @@ -794,6 +807,7 @@ AC_CONFIG_FILES([ tutorial/hs/Makefile tutorial/java/Makefile tutorial/js/Makefile + tutorial/netcore/Makefile tutorial/nodejs/Makefile tutorial/dart/Makefile tutorial/py/Makefile @@ -846,6 +860,7 @@ echo "Building C++ Library ......... : $have_cpp" echo "Building C (GLib) Library .... : $have_c_glib" echo "Building Java Library ........ : $have_java" echo "Building C# Library .......... : $have_csharp" +echo "Building .NET Core Library ... : $have_dotnetcore" echo "Building Python Library ...... : $have_python" echo "Building Ruby Library ........ : $have_ruby" echo "Building Haxe Library ........ : $have_haxe" @@ -879,6 +894,12 @@ if test "$have_csharp" = "yes" ; then echo "C# Library:" echo " Using .NET 3.5 ............ : $net_3_5" fi +if test "$have_dotnetcore" = "yes" ; then + echo + echo ".NET Core Library:" + echo " Using .NET Core ........... : $DOTNETCORE" + echo " Using .NET Core version ... : $DOTNETCORE_VERSION" +fi if test "$have_python" = "yes" ; then echo echo "Python Library:" diff --git a/contrib/fb303/if/fb303.thrift b/contrib/fb303/if/fb303.thrift index 66c83152748..89bd6eb7b41 100644 --- a/contrib/fb303/if/fb303.thrift +++ b/contrib/fb303/if/fb303.thrift @@ -24,6 +24,7 @@ namespace java com.facebook.fb303 namespace cpp facebook.fb303 namespace perl Facebook.FB303 +namespace netcore Facebook.FB303.Test /** * Common status reporting mechanism across all services diff --git a/lib/Makefile.am b/lib/Makefile.am index 5f17fca882d..21d807a3a38 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -71,6 +71,10 @@ if WITH_DART SUBDIRS += dart endif +if WITH_DOTNETCORE +SUBDIRS += netcore +endif + if WITH_GO SUBDIRS += go endif diff --git a/lib/netcore/.gitignore b/lib/netcore/.gitignore deleted file mode 100644 index f2b52a3deed..00000000000 --- a/lib/netcore/.gitignore +++ /dev/null @@ -1,249 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -.idea.*/ - -.DS_Store - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -[Xx]64/ -[Xx]86/ -[Bb]uild/ -bld/ -[Bb]in/ -[Oo]bj/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml - -# TODO: Un-comment the next line if you do not want to checkin -# your web sitey settings because they may include unencrypted -# passwords -#*.pubxml -*.publishproj - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Microsoft Azure ApplicationInsights config file -ApplicationInsights.config - -# Windows Store app package directory -AppPackages/ -BundleArtifacts/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# LightSwitch generated files -GeneratedArtifacts/ -ModelManifest.xml - -# Paket dependency manager -.paket/paket.exe - -# FAKE - F# Make -.fake/ diff --git a/lib/netcore/Makefile.am b/lib/netcore/Makefile.am new file mode 100644 index 00000000000..99f86b8c702 --- /dev/null +++ b/lib/netcore/Makefile.am @@ -0,0 +1,108 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = . + +THRIFT = $(top_builddir)/compiler/cpp/thrift + +TESTDIR = Tests/Thrift.PublicInterfaces.Compile.Tests +GENDIR = $(TESTDIR)/gen-netcore + +THRIFTCODE = \ + Thrift/ITAsyncProcessor.cs \ + Thrift/ITProcessorFactory.cs \ + Thrift/SingletonTProcessorFactory.cs \ + Thrift/TApplicationException.cs \ + Thrift/TBaseClient.cs \ + Thrift/TException.cs \ + Thrift/TMultiplexedProcessor.cs \ + Thrift/Collections/TCollections.cs \ + Thrift/Collections/THashSet.cs \ + Thrift/Properties/AssemblyInfo.cs \ + Thrift/Protocols/ITProtocolFactory.cs \ + Thrift/Protocols/TAbstractBase.cs \ + Thrift/Protocols/TBase.cs \ + Thrift/Protocols/TBinaryProtocol.cs \ + Thrift/Protocols/TCompactProtocol.cs \ + Thrift/Protocols/TJSONProtocol.cs \ + Thrift/Protocols/TMultiplexedProtocol.cs \ + Thrift/Protocols/TProtocol.cs \ + Thrift/Protocols/TProtocolDecorator.cs \ + Thrift/Protocols/TProtocolException.cs \ + Thrift/Protocols/Entities/TField.cs \ + Thrift/Protocols/Entities/TList.cs \ + Thrift/Protocols/Entities/TMap.cs \ + Thrift/Protocols/Entities/TMessage.cs \ + Thrift/Protocols/Entities/TMessageType.cs \ + Thrift/Protocols/Entities/TSet.cs \ + Thrift/Protocols/Entities/TStruct.cs \ + Thrift/Protocols/Entities/TType.cs \ + Thrift/Protocols/Utilities/TBase64Utils.cs \ + Thrift/Protocols/Utilities/TProtocolUtil.cs \ + Thrift/Server/AsyncBaseServer.cs \ + Thrift/Server/TBaseServer.cs \ + Thrift/Server/TServerEventHandler.cs \ + Thrift/Transports/TClientTransport.cs \ + Thrift/Transports/TServerTransport.cs \ + Thrift/Transports/TTransportException.cs \ + Thrift/Transports/TTransportFactory.cs \ + Thrift/Transports/Client/TBufferedClientTransport.cs \ + Thrift/Transports/Client/TFramedClientTransport.cs \ + Thrift/Transports/Client/THttpClientTransport.cs \ + Thrift/Transports/Client/TMemoryBufferClientTransport.cs \ + Thrift/Transports/Client/TNamedPipeClientTransport.cs \ + Thrift/Transports/Client/TSocketClientTransport.cs \ + Thrift/Transports/Client/TStreamClientTransport.cs \ + Thrift/Transports/Client/TTlsSocketClientTransport.cs \ + Thrift/Transports/Server/THttpServerTransport.cs \ + Thrift/Transports/Server/TNamedPipeServerTransport.cs \ + Thrift/Transports/Server/TServerSocketTransport.cs \ + Thrift/Transports/Server/TTlsServerSocketTransport.cs + +all-local: \ + Thrift.dll + +Thrift.dll: $(THRIFTCODE) + $(MKDIR_P) $(GENDIR) + $(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(TESTDIR)/CassandraTest.thrift + $(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(top_srcdir)/test/ThriftTest.thrift + $(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(top_srcdir)/contrib/fb303/if/fb303.thrift + $(DOTNETCORE) --info + $(DOTNETCORE) restore + $(DOTNETCORE) build **/*/project.json -r win10-x64 + $(DOTNETCORE) build **/*/project.json -r osx.10.11-x64 + $(DOTNETCORE) build **/*/project.json -r ubuntu.16.04-x64 + +clean-local: + $(RM) Thrift.dll + $(RM) -r $(GENDIR) + $(RM) -r Thrift/bin + $(RM) -r Thrift/obj + $(RM) -r Tests/Thrift.PublicInterfaces.Compile.Tests/bin + $(RM) -r Tests/Thrift.PublicInterfaces.Compile.Tests/obj + +EXTRA_DIST = \ + $(THRIFTCODE) \ + global.json \ + Thrift.sln \ + Thrift/project.json \ + Thrift/Thrift.xproj \ + Tests \ + README.md + diff --git a/lib/netcore/README.md b/lib/netcore/README.md index 0fe5f9d14e9..ae926e9786e 100644 --- a/lib/netcore/README.md +++ b/lib/netcore/README.md @@ -2,11 +2,20 @@ Thrift client library ported to Microsoft .Net Core -Notes: Removed support of Silverlight (as it no longer supported by Microsoft) - # How to build + * Download the latest version of dotnet from https://www.microsoft.com/net/core (it can be https://go.microsoft.com/fwlink/?LinkID=809122 in case of VS Code) * Install downloaded version of dotnet * Clone repo * Run **build.sh** or **build.cmd** from the root of cloned repository -* Check samples in **src/Samples** folder +* Check tests in **src/Tests** folder +* Continue with /tutorials/netcore + +#Notes + +* No Silverlight suport, no longer supported by Microsoft + +#Known issues + +* Framed transport not fully implemenented yet + diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift similarity index 99% rename from lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift rename to lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift index 5da035efaa0..4b92720c2d4 100644 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift +++ b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift @@ -23,7 +23,7 @@ # Interface definition for Cassandra Service # -namespace csharp Apache.Cassandra.Test +namespace netcore Apache.Cassandra.Test # Thrift.rb has a bug where top-level modules that include modules # with the same name are not properly referenced, so we can't do diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs similarity index 90% rename from lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs rename to lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs index 78ca6d70da7..0bb460ff441 100644 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs +++ b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs @@ -24,8 +24,9 @@ // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Thrift.PublicInterfaces.Tests")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] [assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj similarity index 100% rename from lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj rename to lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.xproj diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json similarity index 100% rename from lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json rename to lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/project.json diff --git a/lib/netcore/src/Thrift.sln b/lib/netcore/Thrift.sln similarity index 100% rename from lib/netcore/src/Thrift.sln rename to lib/netcore/Thrift.sln diff --git a/lib/netcore/src/Thrift/Collections/TCollections.cs b/lib/netcore/Thrift/Collections/TCollections.cs similarity index 100% rename from lib/netcore/src/Thrift/Collections/TCollections.cs rename to lib/netcore/Thrift/Collections/TCollections.cs diff --git a/lib/netcore/src/Thrift/Collections/THashSet.cs b/lib/netcore/Thrift/Collections/THashSet.cs similarity index 100% rename from lib/netcore/src/Thrift/Collections/THashSet.cs rename to lib/netcore/Thrift/Collections/THashSet.cs diff --git a/lib/netcore/src/Thrift/ITAsyncProcessor.cs b/lib/netcore/Thrift/ITAsyncProcessor.cs similarity index 100% rename from lib/netcore/src/Thrift/ITAsyncProcessor.cs rename to lib/netcore/Thrift/ITAsyncProcessor.cs diff --git a/lib/netcore/src/Thrift/ITProcessorFactory.cs b/lib/netcore/Thrift/ITProcessorFactory.cs similarity index 100% rename from lib/netcore/src/Thrift/ITProcessorFactory.cs rename to lib/netcore/Thrift/ITProcessorFactory.cs diff --git a/lib/netcore/src/Thrift/Properties/AssemblyInfo.cs b/lib/netcore/Thrift/Properties/AssemblyInfo.cs similarity index 100% rename from lib/netcore/src/Thrift/Properties/AssemblyInfo.cs rename to lib/netcore/Thrift/Properties/AssemblyInfo.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TField.cs b/lib/netcore/Thrift/Protocols/Entities/TField.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TField.cs rename to lib/netcore/Thrift/Protocols/Entities/TField.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TList.cs b/lib/netcore/Thrift/Protocols/Entities/TList.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TList.cs rename to lib/netcore/Thrift/Protocols/Entities/TList.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMap.cs b/lib/netcore/Thrift/Protocols/Entities/TMap.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TMap.cs rename to lib/netcore/Thrift/Protocols/Entities/TMap.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs b/lib/netcore/Thrift/Protocols/Entities/TMessage.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TMessage.cs rename to lib/netcore/Thrift/Protocols/Entities/TMessage.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs b/lib/netcore/Thrift/Protocols/Entities/TMessageType.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TMessageType.cs rename to lib/netcore/Thrift/Protocols/Entities/TMessageType.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TSet.cs b/lib/netcore/Thrift/Protocols/Entities/TSet.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TSet.cs rename to lib/netcore/Thrift/Protocols/Entities/TSet.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs b/lib/netcore/Thrift/Protocols/Entities/TStruct.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TStruct.cs rename to lib/netcore/Thrift/Protocols/Entities/TStruct.cs diff --git a/lib/netcore/src/Thrift/Protocols/Entities/TType.cs b/lib/netcore/Thrift/Protocols/Entities/TType.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Entities/TType.cs rename to lib/netcore/Thrift/Protocols/Entities/TType.cs diff --git a/lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs b/lib/netcore/Thrift/Protocols/ITProtocolFactory.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/ITProtocolFactory.cs rename to lib/netcore/Thrift/Protocols/ITProtocolFactory.cs diff --git a/lib/netcore/src/Thrift/Protocols/TAbstractBase.cs b/lib/netcore/Thrift/Protocols/TAbstractBase.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TAbstractBase.cs rename to lib/netcore/Thrift/Protocols/TAbstractBase.cs diff --git a/lib/netcore/src/Thrift/Protocols/TBase.cs b/lib/netcore/Thrift/Protocols/TBase.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TBase.cs rename to lib/netcore/Thrift/Protocols/TBase.cs diff --git a/lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs b/lib/netcore/Thrift/Protocols/TBinaryProtocol.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TBinaryProtocol.cs rename to lib/netcore/Thrift/Protocols/TBinaryProtocol.cs diff --git a/lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs b/lib/netcore/Thrift/Protocols/TCompactProtocol.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TCompactProtocol.cs rename to lib/netcore/Thrift/Protocols/TCompactProtocol.cs diff --git a/lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs b/lib/netcore/Thrift/Protocols/TJSONProtocol.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TJSONProtocol.cs rename to lib/netcore/Thrift/Protocols/TJSONProtocol.cs diff --git a/lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs b/lib/netcore/Thrift/Protocols/TMultiplexedProtocol.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TMultiplexedProtocol.cs rename to lib/netcore/Thrift/Protocols/TMultiplexedProtocol.cs diff --git a/lib/netcore/src/Thrift/Protocols/TProtocol.cs b/lib/netcore/Thrift/Protocols/TProtocol.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TProtocol.cs rename to lib/netcore/Thrift/Protocols/TProtocol.cs diff --git a/lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs b/lib/netcore/Thrift/Protocols/TProtocolDecorator.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TProtocolDecorator.cs rename to lib/netcore/Thrift/Protocols/TProtocolDecorator.cs diff --git a/lib/netcore/src/Thrift/Protocols/TProtocolException.cs b/lib/netcore/Thrift/Protocols/TProtocolException.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/TProtocolException.cs rename to lib/netcore/Thrift/Protocols/TProtocolException.cs diff --git a/lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs b/lib/netcore/Thrift/Protocols/Utilities/TBase64Utils.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Utilities/TBase64Utils.cs rename to lib/netcore/Thrift/Protocols/Utilities/TBase64Utils.cs diff --git a/lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs b/lib/netcore/Thrift/Protocols/Utilities/TProtocolUtil.cs similarity index 100% rename from lib/netcore/src/Thrift/Protocols/Utilities/TProtocolUtil.cs rename to lib/netcore/Thrift/Protocols/Utilities/TProtocolUtil.cs diff --git a/lib/netcore/src/Thrift/Server/AsyncBaseServer.cs b/lib/netcore/Thrift/Server/AsyncBaseServer.cs similarity index 100% rename from lib/netcore/src/Thrift/Server/AsyncBaseServer.cs rename to lib/netcore/Thrift/Server/AsyncBaseServer.cs diff --git a/lib/netcore/src/Thrift/Server/TBaseServer.cs b/lib/netcore/Thrift/Server/TBaseServer.cs similarity index 100% rename from lib/netcore/src/Thrift/Server/TBaseServer.cs rename to lib/netcore/Thrift/Server/TBaseServer.cs diff --git a/lib/netcore/src/Thrift/Server/TServerEventHandler.cs b/lib/netcore/Thrift/Server/TServerEventHandler.cs similarity index 100% rename from lib/netcore/src/Thrift/Server/TServerEventHandler.cs rename to lib/netcore/Thrift/Server/TServerEventHandler.cs diff --git a/lib/netcore/src/Thrift/SingletonTProcessorFactory.cs b/lib/netcore/Thrift/SingletonTProcessorFactory.cs similarity index 100% rename from lib/netcore/src/Thrift/SingletonTProcessorFactory.cs rename to lib/netcore/Thrift/SingletonTProcessorFactory.cs diff --git a/lib/netcore/src/Thrift/TApplicationException.cs b/lib/netcore/Thrift/TApplicationException.cs similarity index 100% rename from lib/netcore/src/Thrift/TApplicationException.cs rename to lib/netcore/Thrift/TApplicationException.cs diff --git a/lib/netcore/src/Thrift/TBaseClient.cs b/lib/netcore/Thrift/TBaseClient.cs similarity index 100% rename from lib/netcore/src/Thrift/TBaseClient.cs rename to lib/netcore/Thrift/TBaseClient.cs diff --git a/lib/netcore/src/Thrift/TException.cs b/lib/netcore/Thrift/TException.cs similarity index 100% rename from lib/netcore/src/Thrift/TException.cs rename to lib/netcore/Thrift/TException.cs diff --git a/lib/netcore/src/Thrift/TMultiplexedProcessor.cs b/lib/netcore/Thrift/TMultiplexedProcessor.cs similarity index 100% rename from lib/netcore/src/Thrift/TMultiplexedProcessor.cs rename to lib/netcore/Thrift/TMultiplexedProcessor.cs diff --git a/lib/netcore/src/Thrift/Thrift.xproj b/lib/netcore/Thrift/Thrift.xproj similarity index 100% rename from lib/netcore/src/Thrift/Thrift.xproj rename to lib/netcore/Thrift/Thrift.xproj diff --git a/lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TBufferedClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TBufferedClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TBufferedClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TFramedClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TFramedClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TFramedClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs b/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/THttpClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TMemoryBufferClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TMemoryBufferClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TMemoryBufferClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TNamedPipeClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TNamedPipeClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TNamedPipeClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TSocketClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TSocketClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TSocketClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TStreamClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TStreamClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TStreamClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TTlsSocketClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Client/TTlsSocketClientTransport.cs rename to lib/netcore/Thrift/Transports/Client/TTlsSocketClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs b/lib/netcore/Thrift/Transports/Server/THttpServerTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Server/THttpServerTransport.cs rename to lib/netcore/Thrift/Transports/Server/THttpServerTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs b/lib/netcore/Thrift/Transports/Server/TNamedPipeServerTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Server/TNamedPipeServerTransport.cs rename to lib/netcore/Thrift/Transports/Server/TNamedPipeServerTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs b/lib/netcore/Thrift/Transports/Server/TServerSocketTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Server/TServerSocketTransport.cs rename to lib/netcore/Thrift/Transports/Server/TServerSocketTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs b/lib/netcore/Thrift/Transports/Server/TTlsServerSocketTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/Server/TTlsServerSocketTransport.cs rename to lib/netcore/Thrift/Transports/Server/TTlsServerSocketTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/TClientTransport.cs b/lib/netcore/Thrift/Transports/TClientTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/TClientTransport.cs rename to lib/netcore/Thrift/Transports/TClientTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/TServerTransport.cs b/lib/netcore/Thrift/Transports/TServerTransport.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/TServerTransport.cs rename to lib/netcore/Thrift/Transports/TServerTransport.cs diff --git a/lib/netcore/src/Thrift/Transports/TTransportException.cs b/lib/netcore/Thrift/Transports/TTransportException.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/TTransportException.cs rename to lib/netcore/Thrift/Transports/TTransportException.cs diff --git a/lib/netcore/src/Thrift/Transports/TTransportFactory.cs b/lib/netcore/Thrift/Transports/TTransportFactory.cs similarity index 100% rename from lib/netcore/src/Thrift/Transports/TTransportFactory.cs rename to lib/netcore/Thrift/Transports/TTransportFactory.cs diff --git a/lib/netcore/src/Thrift/project.json b/lib/netcore/Thrift/project.json similarity index 100% rename from lib/netcore/src/Thrift/project.json rename to lib/netcore/Thrift/project.json diff --git a/lib/netcore/build.cmd b/lib/netcore/build.cmd index 3a4b7505b92..012b99db64c 100644 --- a/lib/netcore/build.cmd +++ b/lib/netcore/build.cmd @@ -1,7 +1,36 @@ +@echo off +rem /* +rem * Licensed to the Apache Software Foundation (ASF) under one +rem * or more contributor license agreements. See the NOTICE file +rem * distributed with this work for additional information +rem * regarding copyright ownership. The ASF licenses this file +rem * to you under the Apache License, Version 2.0 (the +rem * "License"); you may not use this file except in compliance +rem * with the License. You may obtain a copy of the License at +rem * +rem * http://www.apache.org/licenses/LICENSE-2.0 +rem * +rem * Unless required by applicable law or agreed to in writing, +rem * software distributed under the License is distributed on an +rem * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +rem * KIND, either express or implied. See the License for the +rem * specific language governing permissions and limitations +rem * under the License. +rem */ +setlocal + +pushd Tests\Thrift.PublicInterfaces.Compile.Tests +for %%a in (*.thrift) do thrift -gen netcore:wcf -r %%a +thrift -gen netcore:wcf -r ..\..\..\..\contrib/fb303/if/fb303.thrift +thrift -gen netcore:wcf -r ..\..\..\..\test/ThriftTest.thrift +popd + dotnet --info dotnet restore dotnet build **/*/project.json -r win10-x64 dotnet build **/*/project.json -r osx.10.11-x64 -dotnet build **/*/project.json -r ubuntu.16.04-x64 \ No newline at end of file +dotnet build **/*/project.json -r ubuntu.16.04-x64 + +:eof diff --git a/lib/netcore/build.sh b/lib/netcore/build.sh index 45982fc06af..1a58b749fa7 100755 --- a/lib/netcore/build.sh +++ b/lib/netcore/build.sh @@ -1,8 +1,36 @@ #!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + #exit if any command fails #set -e +pushd Tests/Thrift.PublicInterfaces.Compile.Tests +for file in *.thrift +do + ../../../../compiler/cpp/thrift -gen netcore:wcf -r "$file" +done +../../../../compiler/cpp/thrift -gen netcore:wcf -r ../../../../contrib/fb303/if/fb303.thrift +../../../../compiler/cpp/thrift -gen netcore:wcf -r ../../../../test/ThriftTest.thrift +popd + dotnet --info dotnet restore @@ -17,4 +45,4 @@ dotnet build **/*/project.json -r ubuntu.16.04-x64 #revision=${TRAVIS_JOB_ID:=1} #revision=$(printf "%04d" $revision) -#dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision \ No newline at end of file +#dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision diff --git a/lib/netcore/src/global.json b/lib/netcore/global.json similarity index 100% rename from lib/netcore/src/global.json rename to lib/netcore/global.json diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift deleted file mode 100644 index 7ac937be98b..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Facebook303Test.thrift +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * fb303.thrift - */ - -namespace csharp Facebook.FB303.Test - -/** - * Common status reporting mechanism across all services - */ -enum fb_status { - DEAD = 0, - STARTING = 1, - ALIVE = 2, - STOPPING = 3, - STOPPED = 4, - WARNING = 5, -} - -/** - * Standard base service - */ -service FacebookService { - - /** - * Returns a descriptive name of the service - */ - string getName(), - - /** - * Returns the version of the service - */ - string getVersion(), - - /** - * Gets the status of this service - */ - fb_status getStatus(), - - /** - * User friendly description of status, such as why the service is in - * the dead or warning state, or what is being started or stopped. - */ - string getStatusDetails(), - - /** - * Gets the counters for this service - */ - map getCounters(), - - /** - * Gets the value of a single counter - */ - i64 getCounter(1: string key), - - /** - * Sets an option - */ - void setOption(1: string key, 2: string value), - - /** - * Gets an option - */ - string getOption(1: string key), - - /** - * Gets all options - */ - map getOptions(), - - /** - * Returns a CPU profile over the given time interval (client and server - * must agree on the profile format). - */ - string getCpuProfile(1: i32 profileDurationInSec), - - /** - * Returns the unix time that the server has been running since - */ - i64 aliveSince(), - - /** - * Tell the server to reload its configuration, reopen log files, etc - */ - oneway void reinitialize(), - - /** - * Suggest a shutdown to the server - */ - oneway void shutdown(), - -} diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs deleted file mode 100644 index 9ec8ede23f5..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationException.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// invalid authentication request (invalid keyspace, user does not exist, or credentials invalid) - /// - public partial class AuthenticationException : TException, TBase - { - public AuthenticationException() - { - } - - public AuthenticationException(string why) : this() - { - this.Why = why; - } - - [DataMember(Order = 0)] - public string Why { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_why = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Why = await iprot.ReadStringAsync(cancellationToken); - isset_why = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_why) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("AuthenticationException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "why"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Why, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("AuthenticationException("); - sb.Append(", Why: "); - sb.Append(Why); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class AuthenticationExceptionFault - { - private string _why; - - [DataMember(Order = 0)] - public string Why { get; set; } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs deleted file mode 100644 index a96841cad0b..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthenticationRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Authentication requests can contain any data, dependent on the IAuthenticator used - /// - [DataContract(Namespace = "")] - public partial class AuthenticationRequest : TBase - { - public AuthenticationRequest() - { - } - - public AuthenticationRequest(Dictionary credentials) : this() - { - this.Credentials = credentials; - } - - [DataMember(Order = 0)] - public Dictionary Credentials { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_credentials = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Credentials = new Dictionary(); - TMap _map32 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i33 = 0; _i33 < _map32.Count; ++_i33) - { - string _key34; - string _val35; - _key34 = await iprot.ReadStringAsync(cancellationToken); - _val35 = await iprot.ReadStringAsync(cancellationToken); - Credentials[_key34] = _val35; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - isset_credentials = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_credentials) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("AuthenticationRequest"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "credentials"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Credentials.Count), - cancellationToken); - foreach (string _iter36 in Credentials.Keys) - { - await oprot.WriteStringAsync(_iter36, cancellationToken); - await oprot.WriteStringAsync(Credentials[_iter36], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("AuthenticationRequest("); - sb.Append(", Credentials: "); - sb.Append(Credentials); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs deleted file mode 100644 index f81e0ace864..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/AuthorizationException.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// invalid authorization request (user does not have access to keyspace) - /// - public partial class AuthorizationException : TException, TBase - { - public AuthorizationException() - { - } - - public AuthorizationException(string why) : this() - { - this.Why = why; - } - - [DataMember(Order = 0)] - public string Why { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_why = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Why = await iprot.ReadStringAsync(cancellationToken); - isset_why = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_why) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("AuthorizationException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "why"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Why, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("AuthorizationException("); - sb.Append(", Why: "); - sb.Append(Why); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class AuthorizationExceptionFault - { - private string _why; - - [DataMember(Order = 0)] - public string Why { get; set; } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs deleted file mode 100644 index ce992209c36..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Cassandra.cs +++ /dev/null @@ -1,15404 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - public partial class Cassandra - { - [ServiceContract(Namespace = "")] - public interface IAsync - { - [OperationContract] - [FaultContract(typeof(AuthenticationExceptionFault))] - [FaultContract(typeof(AuthorizationExceptionFault))] - Task loginAsync(AuthenticationRequest auth_request, CancellationToken cancellationToken); - - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task set_keyspaceAsync(string keyspace, CancellationToken cancellationToken); - - /// - /// Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This - /// is - /// the only method that can throw an exception under non-failure conditions.) - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(NotFoundExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task @getAsync(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level, - CancellationToken cancellationToken); - - /// - /// Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name - /// pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task> get_sliceAsync(byte[] key, ColumnParent column_parent, - SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// returns the number of columns matching predicate for a particular key, - /// ColumnFamily and optionally SuperColumn. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task get_countAsync(byte[] key, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// Performs a get_slice for column_parent and predicate for the given keys in parallel. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task>> multiget_sliceAsync(List keys, - ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level, - CancellationToken cancellationToken); - - /// - /// Perform a get_count in parallel on the given list keys. The return value maps keys to the count found. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task> multiget_countAsync(List keys, ColumnParent column_parent, - SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// returns a subset of columns for a contiguous range of keys. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task> get_range_slicesAsync(ColumnParent column_parent, SlicePredicate predicate, - KeyRange range, ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task> get_indexed_slicesAsync(ColumnParent column_parent, IndexClause index_clause, - SlicePredicate column_predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// Insert a Column at the given column_parent.column_family and optional column_parent.super_column. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task insertAsync(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level, - CancellationToken cancellationToken); - - /// - /// Increment or decrement a counter. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task @addAsync(byte[] key, ColumnParent column_parent, CounterColumn column, - ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. - /// Note - /// that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire - /// row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those - /// levels too. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task @removeAsync(byte[] key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level, - CancellationToken cancellationToken); - - /// - /// Remove a counter at the specified location. - /// Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following - /// update - /// until the delete has reached all the nodes and all of them have been fully compacted. - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task remove_counterAsync(byte[] key, ColumnPath path, ConsistencyLevel consistency_level, - CancellationToken cancellationToken); - - /// - /// Mutate many columns or super columns for many row keys. See also: Mutation. - /// mutation_map maps key to column family to a list of Mutation objects to take place at that scope. - /// * - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task batch_mutateAsync(Dictionary>> mutation_map, - ConsistencyLevel consistency_level, CancellationToken cancellationToken); - - /// - /// Truncate will mark and entire column family as deleted. - /// From the user's perspective a successful call to truncate will result complete data deletion from cfname. - /// Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one - /// only marks the data as deleted. - /// The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if - /// some hosts are down. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - Task truncateAsync(string cfname, CancellationToken cancellationToken); - - /// - /// for each schema version present in the cluster, returns a list of nodes at that version. - /// hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. - /// the cluster is all on the same version if the size of the map is 1. - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task>> describe_schema_versionsAsync(CancellationToken cancellationToken); - - /// - /// list the defined keyspaces in this cluster - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task> describe_keyspacesAsync(CancellationToken cancellationToken); - - /// - /// get the cluster name - /// - [OperationContract] - Task describe_cluster_nameAsync(CancellationToken cancellationToken); - - /// - /// get the thrift api version - /// - [OperationContract] - Task describe_versionAsync(CancellationToken cancellationToken); - - /// - /// get the token ring: a map of ranges to host addresses, - /// represented as a set of TokenRange instead of a map from range - /// to list of endpoints, because you can't use Thrift structs as - /// map keys: - /// https://issues.apache.org/jira/browse/THRIFT-162 - /// for the same reason, we can't return a set here, even though - /// order is neither important nor predictable. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task> describe_ringAsync(string keyspace, CancellationToken cancellationToken); - - /// - /// returns the partitioner used by this cluster - /// - [OperationContract] - Task describe_partitionerAsync(CancellationToken cancellationToken); - - /// - /// returns the snitch used by this cluster - /// - [OperationContract] - Task describe_snitchAsync(CancellationToken cancellationToken); - - /// - /// describe specified keyspace - /// - /// - [OperationContract] - [FaultContract(typeof(NotFoundExceptionFault))] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task describe_keyspaceAsync(string keyspace, CancellationToken cancellationToken); - - /// - /// experimental API for hadoop/parallel query support. - /// may change violently and without warning. - /// returns list of token strings such that first subrange is (list[0], list[1]], - /// next is (list[1], list[2]], etc. - /// - /// - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task> describe_splitsAsync(string cfName, string start_token, string end_token, - int keys_per_split, CancellationToken cancellationToken); - - /// - /// adds a column family. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_add_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken); - - /// - /// drops a column family. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_drop_column_familyAsync(string column_family, CancellationToken cancellationToken); - - /// - /// adds a keyspace and any column families that are part of it. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_add_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken); - - /// - /// drops a keyspace and any column families that are part of it. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_drop_keyspaceAsync(string keyspace, CancellationToken cancellationToken); - - /// - /// updates properties of a keyspace. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_update_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken); - - /// - /// updates properties of a column family. returns the new schema id. - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task system_update_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken); - - /// - /// Executes a CQL (Cassandra Query Language) statement and returns a - /// CqlResult containing the results. - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task execute_cql_queryAsync(byte[] query, Compression compression, - CancellationToken cancellationToken); - - /// - /// Prepare a CQL (Cassandra Query Language) statement by compiling and returning - /// - the type of CQL statement - /// - an id token of the compiled CQL stored on the server side. - /// - a count of the discovered bound markers in the statement - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - Task prepare_cql_queryAsync(byte[] query, Compression compression, - CancellationToken cancellationToken); - - /// - /// Executes a prepared CQL (Cassandra Query Language) statement by passing an id token and a list of variables - /// to bind and returns a CqlResult containing the results. - /// - /// - /// - [OperationContract] - [FaultContract(typeof(InvalidRequestExceptionFault))] - [FaultContract(typeof(UnavailableExceptionFault))] - [FaultContract(typeof(TimedOutExceptionFault))] - [FaultContract(typeof(SchemaDisagreementExceptionFault))] - Task execute_prepared_cql_queryAsync(int itemId, List values, - CancellationToken cancellationToken); - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task loginAsync(AuthenticationRequest auth_request, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("login", TMessageType.Call, SeqId), - cancellationToken); - - var args = new loginArgs(); - args.Auth_request = auth_request; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new loginResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.authnx) - { - throw result.Authnx; - } - if (result.__isset.authzx) - { - throw result.Authzx; - } - return; - } - - public async Task set_keyspaceAsync(string keyspace, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Call, SeqId), - cancellationToken); - - var args = new set_keyspaceArgs(); - args.Keyspace = keyspace; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new set_keyspaceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - return; - } - - public async Task @getAsync(byte[] key, ColumnPath column_path, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("get", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getArgs(); - args.Key = key; - args.Column_path = column_path; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.nfe) - { - throw result.Nfe; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "get failed: unknown result"); - } - - public async Task> get_sliceAsync(byte[] key, ColumnParent column_parent, - SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Call, SeqId), - cancellationToken); - - var args = new get_sliceArgs(); - args.Key = key; - args.Column_parent = column_parent; - args.Predicate = predicate; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new get_sliceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "get_slice failed: unknown result"); - } - - public async Task get_countAsync(byte[] key, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Call, SeqId), - cancellationToken); - - var args = new get_countArgs(); - args.Key = key; - args.Column_parent = column_parent; - args.Predicate = predicate; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new get_countResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "get_count failed: unknown result"); - } - - public async Task>> multiget_sliceAsync(List keys, - ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Call, SeqId), - cancellationToken); - - var args = new multiget_sliceArgs(); - args.Keys = keys; - args.Column_parent = column_parent; - args.Predicate = predicate; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new multiget_sliceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "multiget_slice failed: unknown result"); - } - - public async Task> multiget_countAsync(List keys, ColumnParent column_parent, - SlicePredicate predicate, ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Call, SeqId), - cancellationToken); - - var args = new multiget_countArgs(); - args.Keys = keys; - args.Column_parent = column_parent; - args.Predicate = predicate; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new multiget_countResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "multiget_count failed: unknown result"); - } - - public async Task> get_range_slicesAsync(ColumnParent column_parent, SlicePredicate predicate, - KeyRange range, ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Call, SeqId), - cancellationToken); - - var args = new get_range_slicesArgs(); - args.Column_parent = column_parent; - args.Predicate = predicate; - args.Range = range; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new get_range_slicesResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "get_range_slices failed: unknown result"); - } - - public async Task> get_indexed_slicesAsync(ColumnParent column_parent, - IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Call, SeqId), - cancellationToken); - - var args = new get_indexed_slicesArgs(); - args.Column_parent = column_parent; - args.Index_clause = index_clause; - args.Column_predicate = column_predicate; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new get_indexed_slicesResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "get_indexed_slices failed: unknown result"); - } - - public async Task insertAsync(byte[] key, ColumnParent column_parent, Column column, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Call, SeqId), - cancellationToken); - - var args = new insertArgs(); - args.Key = key; - args.Column_parent = column_parent; - args.Column = column; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new insertResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task @addAsync(byte[] key, ColumnParent column_parent, CounterColumn column, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("add", TMessageType.Call, SeqId), - cancellationToken); - - var args = new addArgs(); - args.Key = key; - args.Column_parent = column_parent; - args.Column = column; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new addResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task @removeAsync(byte[] key, ColumnPath column_path, long timestamp, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Call, SeqId), - cancellationToken); - - var args = new removeArgs(); - args.Key = key; - args.Column_path = column_path; - args.Timestamp = timestamp; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new removeResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task remove_counterAsync(byte[] key, ColumnPath path, ConsistencyLevel consistency_level, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Call, SeqId), - cancellationToken); - - var args = new remove_counterArgs(); - args.Key = key; - args.Path = path; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new remove_counterResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task batch_mutateAsync(Dictionary>> mutation_map, - ConsistencyLevel consistency_level, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Call, SeqId), - cancellationToken); - - var args = new batch_mutateArgs(); - args.Mutation_map = mutation_map; - args.Consistency_level = consistency_level; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new batch_mutateResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task truncateAsync(string cfname, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Call, SeqId), - cancellationToken); - - var args = new truncateArgs(); - args.Cfname = cfname; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new truncateResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - return; - } - - public async Task>> describe_schema_versionsAsync( - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("describe_schema_versions", TMessageType.Call, SeqId), cancellationToken); - - var args = new describe_schema_versionsArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_schema_versionsResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_schema_versions failed: unknown result"); - } - - public async Task> describe_keyspacesAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_keyspacesArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_keyspacesResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_keyspaces failed: unknown result"); - } - - public async Task describe_cluster_nameAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("describe_cluster_name", TMessageType.Call, SeqId), cancellationToken); - - var args = new describe_cluster_nameArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_cluster_nameResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_cluster_name failed: unknown result"); - } - - public async Task describe_versionAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_versionArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_versionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_version failed: unknown result"); - } - - public async Task> describe_ringAsync(string keyspace, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_ringArgs(); - args.Keyspace = keyspace; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_ringResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_ring failed: unknown result"); - } - - public async Task describe_partitionerAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("describe_partitioner", TMessageType.Call, SeqId), cancellationToken); - - var args = new describe_partitionerArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_partitionerResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_partitioner failed: unknown result"); - } - - public async Task describe_snitchAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_snitchArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_snitchResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_snitch failed: unknown result"); - } - - public async Task describe_keyspaceAsync(string keyspace, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_keyspaceArgs(); - args.Keyspace = keyspace; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_keyspaceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.nfe) - { - throw result.Nfe; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_keyspace failed: unknown result"); - } - - public async Task> describe_splitsAsync(string cfName, string start_token, string end_token, - int keys_per_split, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Call, SeqId), - cancellationToken); - - var args = new describe_splitsArgs(); - args.CfName = cfName; - args.Start_token = start_token; - args.End_token = end_token; - args.Keys_per_split = keys_per_split; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new describe_splitsResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "describe_splits failed: unknown result"); - } - - public async Task system_add_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_add_column_family", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_add_column_familyArgs(); - args.Cf_def = cf_def; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_add_column_familyResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_add_column_family failed: unknown result"); - } - - public async Task system_drop_column_familyAsync(string column_family, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_drop_column_family", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_drop_column_familyArgs(); - args.Column_family = column_family; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_drop_column_familyResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_drop_column_family failed: unknown result"); - } - - public async Task system_add_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_add_keyspace", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_add_keyspaceArgs(); - args.Ks_def = ks_def; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_add_keyspaceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_add_keyspace failed: unknown result"); - } - - public async Task system_drop_keyspaceAsync(string keyspace, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_drop_keyspace", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_drop_keyspaceArgs(); - args.Keyspace = keyspace; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_drop_keyspaceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_drop_keyspace failed: unknown result"); - } - - public async Task system_update_keyspaceAsync(KsDef ks_def, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_update_keyspace", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_update_keyspaceArgs(); - args.Ks_def = ks_def; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_update_keyspaceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_update_keyspace failed: unknown result"); - } - - public async Task system_update_column_familyAsync(CfDef cf_def, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("system_update_column_family", TMessageType.Call, SeqId), cancellationToken); - - var args = new system_update_column_familyArgs(); - args.Cf_def = cf_def; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new system_update_column_familyResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "system_update_column_family failed: unknown result"); - } - - public async Task execute_cql_queryAsync(byte[] query, Compression compression, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Call, SeqId), - cancellationToken); - - var args = new execute_cql_queryArgs(); - args.Query = query; - args.Compression = compression; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new execute_cql_queryResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "execute_cql_query failed: unknown result"); - } - - public async Task prepare_cql_queryAsync(byte[] query, Compression compression, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Call, SeqId), - cancellationToken); - - var args = new prepare_cql_queryArgs(); - args.Query = query; - args.Compression = compression; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new prepare_cql_queryResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "prepare_cql_query failed: unknown result"); - } - - public async Task execute_prepared_cql_queryAsync(int itemId, List values, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync( - new TMessage("execute_prepared_cql_query", TMessageType.Call, SeqId), cancellationToken); - - var args = new execute_prepared_cql_queryArgs(); - args.ItemId = itemId; - args.Values = values; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new execute_prepared_cql_queryResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ire) - { - throw result.Ire; - } - if (result.__isset.ue) - { - throw result.Ue; - } - if (result.__isset.te) - { - throw result.Te; - } - if (result.__isset.sde) - { - throw result.Sde; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "execute_prepared_cql_query failed: unknown result"); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - protected Dictionary processMap_ = new Dictionary(); - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["login"] = login_ProcessAsync; - processMap_["set_keyspace"] = set_keyspace_ProcessAsync; - processMap_["get"] = get_ProcessAsync; - processMap_["get_slice"] = get_slice_ProcessAsync; - processMap_["get_count"] = get_count_ProcessAsync; - processMap_["multiget_slice"] = multiget_slice_ProcessAsync; - processMap_["multiget_count"] = multiget_count_ProcessAsync; - processMap_["get_range_slices"] = get_range_slices_ProcessAsync; - processMap_["get_indexed_slices"] = get_indexed_slices_ProcessAsync; - processMap_["insert"] = insert_ProcessAsync; - processMap_["add"] = add_ProcessAsync; - processMap_["remove"] = remove_ProcessAsync; - processMap_["remove_counter"] = remove_counter_ProcessAsync; - processMap_["batch_mutate"] = batch_mutate_ProcessAsync; - processMap_["truncate"] = truncate_ProcessAsync; - processMap_["describe_schema_versions"] = describe_schema_versions_ProcessAsync; - processMap_["describe_keyspaces"] = describe_keyspaces_ProcessAsync; - processMap_["describe_cluster_name"] = describe_cluster_name_ProcessAsync; - processMap_["describe_version"] = describe_version_ProcessAsync; - processMap_["describe_ring"] = describe_ring_ProcessAsync; - processMap_["describe_partitioner"] = describe_partitioner_ProcessAsync; - processMap_["describe_snitch"] = describe_snitch_ProcessAsync; - processMap_["describe_keyspace"] = describe_keyspace_ProcessAsync; - processMap_["describe_splits"] = describe_splits_ProcessAsync; - processMap_["system_add_column_family"] = system_add_column_family_ProcessAsync; - processMap_["system_drop_column_family"] = system_drop_column_family_ProcessAsync; - processMap_["system_add_keyspace"] = system_add_keyspace_ProcessAsync; - processMap_["system_drop_keyspace"] = system_drop_keyspace_ProcessAsync; - processMap_["system_update_keyspace"] = system_update_keyspace_ProcessAsync; - processMap_["system_update_column_family"] = system_update_column_family_ProcessAsync; - processMap_["execute_cql_query"] = execute_cql_query_ProcessAsync; - processMap_["prepare_cql_query"] = prepare_cql_query_ProcessAsync; - processMap_["execute_prepared_cql_query"] = execute_prepared_cql_query_ProcessAsync; - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task login_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new loginArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new loginResult(); - try - { - try - { - await _iAsync.loginAsync(args.Auth_request, cancellationToken); - } - catch (AuthenticationException authnx) - { - result.Authnx = authnx; - } - catch (AuthorizationException authzx) - { - result.Authzx = authzx; - } - await - oprot.WriteMessageBeginAsync(new TMessage("login", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("login", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task set_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new set_keyspaceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new set_keyspaceResult(); - try - { - try - { - await _iAsync.set_keyspaceAsync(args.Keyspace, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("set_keyspace", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task get_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getResult(); - try - { - try - { - result.Success = - await - _iAsync.@getAsync(args.Key, args.Column_path, args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (NotFoundException nfe) - { - result.Nfe = nfe; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("get", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("get", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task get_slice_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new get_sliceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new get_sliceResult(); - try - { - try - { - result.Success = - await - _iAsync.get_sliceAsync(args.Key, args.Column_parent, args.Predicate, - args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("get_slice", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task get_count_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new get_countArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new get_countResult(); - try - { - try - { - result.Success = - await - _iAsync.get_countAsync(args.Key, args.Column_parent, args.Predicate, - args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("get_count", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task multiget_slice_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new multiget_sliceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new multiget_sliceResult(); - try - { - try - { - result.Success = - await - _iAsync.multiget_sliceAsync(args.Keys, args.Column_parent, args.Predicate, - args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("multiget_slice", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task multiget_count_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new multiget_countArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new multiget_countResult(); - try - { - try - { - result.Success = - await - _iAsync.multiget_countAsync(args.Keys, args.Column_parent, args.Predicate, - args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("multiget_count", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task get_range_slices_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new get_range_slicesArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new get_range_slicesResult(); - try - { - try - { - result.Success = - await - _iAsync.get_range_slicesAsync(args.Column_parent, args.Predicate, args.Range, - args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("get_range_slices", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task get_indexed_slices_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new get_indexed_slicesArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new get_indexed_slicesResult(); - try - { - try - { - result.Success = - await - _iAsync.get_indexed_slicesAsync(args.Column_parent, args.Index_clause, - args.Column_predicate, args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("get_indexed_slices", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task insert_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new insertArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new insertResult(); - try - { - try - { - await - _iAsync.insertAsync(args.Key, args.Column_parent, args.Column, args.Consistency_level, - cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("insert", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task add_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new addArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new addResult(); - try - { - try - { - await - _iAsync.@addAsync(args.Key, args.Column_parent, args.Column, args.Consistency_level, - cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("add", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("add", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task remove_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new removeArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new removeResult(); - try - { - try - { - await - _iAsync.@removeAsync(args.Key, args.Column_path, args.Timestamp, args.Consistency_level, - cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("remove", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task remove_counter_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new remove_counterArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new remove_counterResult(); - try - { - try - { - await - _iAsync.remove_counterAsync(args.Key, args.Path, args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("remove_counter", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task batch_mutate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new batch_mutateArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new batch_mutateResult(); - try - { - try - { - await _iAsync.batch_mutateAsync(args.Mutation_map, args.Consistency_level, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("batch_mutate", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task truncate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new truncateArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new truncateResult(); - try - { - try - { - await _iAsync.truncateAsync(args.Cfname, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - await - oprot.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("truncate", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_schema_versions_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_schema_versionsArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_schema_versionsResult(); - try - { - try - { - result.Success = await _iAsync.describe_schema_versionsAsync(cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync( - new TMessage("describe_schema_versions", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("describe_schema_versions", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_keyspaces_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_keyspacesArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_keyspacesResult(); - try - { - try - { - result.Success = await _iAsync.describe_keyspacesAsync(cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_keyspaces", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_cluster_name_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_cluster_nameArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_cluster_nameResult(); - try - { - result.Success = await _iAsync.describe_cluster_nameAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_cluster_name", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("describe_cluster_name", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_version_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_versionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_versionResult(); - try - { - result.Success = await _iAsync.describe_versionAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_version", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_ring_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_ringArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_ringResult(); - try - { - try - { - result.Success = await _iAsync.describe_ringAsync(args.Keyspace, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_ring", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_partitioner_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_partitionerArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_partitionerResult(); - try - { - result.Success = await _iAsync.describe_partitionerAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_partitioner", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("describe_partitioner", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_snitch_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_snitchArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_snitchResult(); - try - { - result.Success = await _iAsync.describe_snitchAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_snitch", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_keyspaceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_keyspaceResult(); - try - { - try - { - result.Success = await _iAsync.describe_keyspaceAsync(args.Keyspace, cancellationToken); - } - catch (NotFoundException nfe) - { - result.Nfe = nfe; - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_keyspace", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task describe_splits_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new describe_splitsArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new describe_splitsResult(); - try - { - try - { - result.Success = - await - _iAsync.describe_splitsAsync(args.CfName, args.Start_token, args.End_token, - args.Keys_per_split, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("describe_splits", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_add_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_add_column_familyArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_add_column_familyResult(); - try - { - try - { - result.Success = await _iAsync.system_add_column_familyAsync(args.Cf_def, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync( - new TMessage("system_add_column_family", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_add_column_family", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_drop_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_drop_column_familyArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_drop_column_familyResult(); - try - { - try - { - result.Success = - await _iAsync.system_drop_column_familyAsync(args.Column_family, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync( - new TMessage("system_drop_column_family", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_drop_column_family", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_add_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_add_keyspaceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_add_keyspaceResult(); - try - { - try - { - result.Success = await _iAsync.system_add_keyspaceAsync(args.Ks_def, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync(new TMessage("system_add_keyspace", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_add_keyspace", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_drop_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_drop_keyspaceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_drop_keyspaceResult(); - try - { - try - { - result.Success = await _iAsync.system_drop_keyspaceAsync(args.Keyspace, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync(new TMessage("system_drop_keyspace", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_drop_keyspace", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_update_keyspace_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_update_keyspaceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_update_keyspaceResult(); - try - { - try - { - result.Success = await _iAsync.system_update_keyspaceAsync(args.Ks_def, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync(new TMessage("system_update_keyspace", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_update_keyspace", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task system_update_column_family_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new system_update_column_familyArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new system_update_column_familyResult(); - try - { - try - { - result.Success = await _iAsync.system_update_column_familyAsync(args.Cf_def, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync( - new TMessage("system_update_column_family", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("system_update_column_family", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task execute_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new execute_cql_queryArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new execute_cql_queryResult(); - try - { - try - { - result.Success = - await _iAsync.execute_cql_queryAsync(args.Query, args.Compression, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("execute_cql_query", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task prepare_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new prepare_cql_queryArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new prepare_cql_queryResult(); - try - { - try - { - result.Success = - await _iAsync.prepare_cql_queryAsync(args.Query, args.Compression, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - await - oprot.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("prepare_cql_query", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task execute_prepared_cql_query_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new execute_prepared_cql_queryArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new execute_prepared_cql_queryResult(); - try - { - try - { - result.Success = - await _iAsync.execute_prepared_cql_queryAsync(args.ItemId, args.Values, cancellationToken); - } - catch (InvalidRequestException ire) - { - result.Ire = ire; - } - catch (UnavailableException ue) - { - result.Ue = ue; - } - catch (TimedOutException te) - { - result.Te = te; - } - catch (SchemaDisagreementException sde) - { - result.Sde = sde; - } - await - oprot.WriteMessageBeginAsync( - new TMessage("execute_prepared_cql_query", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync( - new TMessage("execute_prepared_cql_query", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - protected delegate Task ProcessFunction( - int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - } - - - [DataContract(Namespace = "")] - public partial class loginArgs : TBase - { - public loginArgs() - { - } - - public loginArgs(AuthenticationRequest auth_request) : this() - { - this.Auth_request = auth_request; - } - - [DataMember(Order = 0)] - public AuthenticationRequest Auth_request { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_auth_request = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Auth_request = new AuthenticationRequest(); - await Auth_request.ReadAsync(iprot, cancellationToken); - isset_auth_request = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_auth_request) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("login_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "auth_request"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Auth_request.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("login_args("); - sb.Append(", Auth_request: "); - sb.Append(Auth_request == null ? "" : Auth_request.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class loginResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private AuthenticationException _authnx; - private AuthorizationException _authzx; - - public loginResult() - { - } - - [DataMember(Order = 0)] - public AuthenticationException Authnx - { - get { return _authnx; } - set - { - __isset.authnx = true; - this._authnx = value; - } - } - - [DataMember(Order = 0)] - public AuthorizationException Authzx - { - get { return _authzx; } - set - { - __isset.authzx = true; - this._authzx = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Authnx = new AuthenticationException(); - await Authnx.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Authzx = new AuthorizationException(); - await Authzx.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("login_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.authnx) - { - if (Authnx != null) - { - field.Name = "Authnx"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Authnx.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.authzx) - { - if (Authzx != null) - { - field.Name = "Authzx"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Authzx.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("login_result("); - bool __first = true; - if (Authnx != null && __isset.authnx) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Authnx: "); - sb.Append(Authnx == null ? "" : Authnx.ToString()); - } - if (Authzx != null && __isset.authzx) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Authzx: "); - sb.Append(Authzx == null ? "" : Authzx.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool authnx; - [DataMember] public bool authzx; - } - - #region XmlSerializer support - - public bool ShouldSerializeAuthnx() - { - return __isset.authnx; - } - - public bool ShouldSerializeAuthzx() - { - return __isset.authzx; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class set_keyspaceArgs : TBase - { - public set_keyspaceArgs() - { - } - - public set_keyspaceArgs(string keyspace) : this() - { - this.Keyspace = keyspace; - } - - [DataMember(Order = 0)] - public string Keyspace { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keyspace = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Keyspace = await iprot.ReadStringAsync(cancellationToken); - isset_keyspace = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keyspace) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("set_keyspace_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keyspace"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Keyspace, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("set_keyspace_args("); - sb.Append(", Keyspace: "); - sb.Append(Keyspace); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class set_keyspaceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - - public set_keyspaceResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("set_keyspace_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("set_keyspace_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - } - } - - - [DataContract(Namespace = "")] - public partial class getArgs : TBase - { - public getArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public getArgs(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level) : this() - { - this.Key = key; - this.Column_path = column_path; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnPath Column_path { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_path = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_path = new ColumnPath(); - await Column_path.ReadAsync(iprot, cancellationToken); - isset_column_path = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_path) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_path"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_path.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_path: "); - sb.Append(Column_path == null ? "" : Column_path.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private NotFoundException _nfe; - private ColumnOrSuperColumn _success; - private TimedOutException _te; - private UnavailableException _ue; - - public getResult() - { - } - - [DataMember(Order = 0)] - public ColumnOrSuperColumn Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public NotFoundException Nfe - { - get { return _nfe; } - set - { - __isset.nfe = true; - this._nfe = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new ColumnOrSuperColumn(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Nfe = new NotFoundException(); - await Nfe.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.nfe) - { - if (Nfe != null) - { - field.Name = "Nfe"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Nfe.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Nfe != null && __isset.nfe) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Nfe: "); - sb.Append(Nfe == null ? "" : Nfe.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool nfe; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeNfe() - { - return __isset.nfe; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class get_sliceArgs : TBase - { - public get_sliceArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public get_sliceArgs(byte[] key, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level) : this() - { - this.Key = key; - this.Column_parent = column_parent; - this.Predicate = predicate; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Predicate { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_parent = false; - bool isset_predicate = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - isset_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_slice_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_slice_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class get_sliceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - private TimedOutException _te; - private UnavailableException _ue; - - public get_sliceResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list83 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i84 = 0; _i84 < _list83.Count; ++_i84) - { - ColumnOrSuperColumn _elem85; - _elem85 = new ColumnOrSuperColumn(); - await _elem85.ReadAsync(iprot, cancellationToken); - Success.Add(_elem85); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_slice_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); - foreach (ColumnOrSuperColumn _iter86 in Success) - { - await _iter86.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_slice_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class get_countArgs : TBase - { - public get_countArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public get_countArgs(byte[] key, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level) : this() - { - this.Key = key; - this.Column_parent = column_parent; - this.Predicate = predicate; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Predicate { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_parent = false; - bool isset_predicate = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - isset_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_count_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_count_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class get_countResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private int _success; - private TimedOutException _te; - private UnavailableException _ue; - - public get_countResult() - { - } - - [DataMember(Order = 0)] - public int Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_count_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_count_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class multiget_sliceArgs : TBase - { - public multiget_sliceArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public multiget_sliceArgs(List keys, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level) : this() - { - this.Keys = keys; - this.Column_parent = column_parent; - this.Predicate = predicate; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public List Keys { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Predicate { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keys = false; - bool isset_column_parent = false; - bool isset_predicate = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Keys = new List(); - TList _list87 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i88 = 0; _i88 < _list87.Count; ++_i88) - { - byte[] _elem89; - _elem89 = await iprot.ReadBinaryAsync(cancellationToken); - Keys.Add(_elem89); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_keys = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - isset_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keys) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("multiget_slice_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keys"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Keys.Count), cancellationToken); - foreach (byte[] _iter90 in Keys) - { - await oprot.WriteBinaryAsync(_iter90, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("multiget_slice_args("); - sb.Append(", Keys: "); - sb.Append(Keys); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class multiget_sliceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private Dictionary> _success; - private TimedOutException _te; - private UnavailableException _ue; - - public multiget_sliceResult() - { - } - - [DataMember(Order = 0)] - public Dictionary> Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map91 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i92 = 0; _i92 < _map91.Count; ++_i92) - { - byte[] _key93; - List _val94; - _key93 = await iprot.ReadBinaryAsync(cancellationToken); - { - _val94 = new List(); - TList _list95 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i96 = 0; _i96 < _list95.Count; ++_i96) - { - ColumnOrSuperColumn _elem97; - _elem97 = new ColumnOrSuperColumn(); - await _elem97.ReadAsync(iprot, cancellationToken); - _val94.Add(_elem97); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Success[_key93] = _val94; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("multiget_slice_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.List, Success.Count), - cancellationToken); - foreach (byte[] _iter98 in Success.Keys) - { - await oprot.WriteBinaryAsync(_iter98, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success[_iter98].Count), - cancellationToken); - foreach (ColumnOrSuperColumn _iter99 in Success[_iter98]) - { - await _iter99.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("multiget_slice_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class multiget_countArgs : TBase - { - public multiget_countArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public multiget_countArgs(List keys, ColumnParent column_parent, SlicePredicate predicate, - ConsistencyLevel consistency_level) : this() - { - this.Keys = keys; - this.Column_parent = column_parent; - this.Predicate = predicate; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public List Keys { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Predicate { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keys = false; - bool isset_column_parent = false; - bool isset_predicate = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Keys = new List(); - TList _list100 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i101 = 0; _i101 < _list100.Count; ++_i101) - { - byte[] _elem102; - _elem102 = await iprot.ReadBinaryAsync(cancellationToken); - Keys.Add(_elem102); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_keys = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - isset_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keys) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("multiget_count_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keys"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Keys.Count), cancellationToken); - foreach (byte[] _iter103 in Keys) - { - await oprot.WriteBinaryAsync(_iter103, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("multiget_count_args("); - sb.Append(", Keys: "); - sb.Append(Keys); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class multiget_countResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private Dictionary _success; - private TimedOutException _te; - private UnavailableException _ue; - - public multiget_countResult() - { - } - - [DataMember(Order = 0)] - public Dictionary Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i105 = 0; _i105 < _map104.Count; ++_i105) - { - byte[] _key106; - int _val107; - _key106 = await iprot.ReadBinaryAsync(cancellationToken); - _val107 = await iprot.ReadI32Async(cancellationToken); - Success[_key106] = _val107; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("multiget_count_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.I32, Success.Count), - cancellationToken); - foreach (byte[] _iter108 in Success.Keys) - { - await oprot.WriteBinaryAsync(_iter108, cancellationToken); - await oprot.WriteI32Async(Success[_iter108], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("multiget_count_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class get_range_slicesArgs : TBase - { - public get_range_slicesArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public get_range_slicesArgs(ColumnParent column_parent, SlicePredicate predicate, KeyRange range, - ConsistencyLevel consistency_level) : this() - { - this.Column_parent = column_parent; - this.Predicate = predicate; - this.Range = range; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Predicate { get; set; } - - [DataMember(Order = 0)] - public KeyRange Range { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_parent = false; - bool isset_predicate = false; - bool isset_range = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - isset_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Range = new KeyRange(); - await Range.ReadAsync(iprot, cancellationToken); - isset_range = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_range) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_range_slices_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "range"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Range.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_range_slices_args("); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - sb.Append(", Range: "); - sb.Append(Range == null ? "" : Range.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class get_range_slicesResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - private TimedOutException _te; - private UnavailableException _ue; - - public get_range_slicesResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list109 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i110 = 0; _i110 < _list109.Count; ++_i110) - { - KeySlice _elem111; - _elem111 = new KeySlice(); - await _elem111.ReadAsync(iprot, cancellationToken); - Success.Add(_elem111); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_range_slices_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); - foreach (KeySlice _iter112 in Success) - { - await _iter112.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_range_slices_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class get_indexed_slicesArgs : TBase - { - public get_indexed_slicesArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public get_indexed_slicesArgs(ColumnParent column_parent, IndexClause index_clause, - SlicePredicate column_predicate, ConsistencyLevel consistency_level) : this() - { - this.Column_parent = column_parent; - this.Index_clause = index_clause; - this.Column_predicate = column_predicate; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public IndexClause Index_clause { get; set; } - - [DataMember(Order = 0)] - public SlicePredicate Column_predicate { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_parent = false; - bool isset_index_clause = false; - bool isset_column_predicate = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Index_clause = new IndexClause(); - await Index_clause.ReadAsync(iprot, cancellationToken); - isset_index_clause = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Column_predicate = new SlicePredicate(); - await Column_predicate.ReadAsync(iprot, cancellationToken); - isset_column_predicate = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_index_clause) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_predicate) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_indexed_slices_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "index_clause"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Index_clause.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_indexed_slices_args("); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Index_clause: "); - sb.Append(Index_clause == null ? "" : Index_clause.ToString()); - sb.Append(", Column_predicate: "); - sb.Append(Column_predicate == null ? "" : Column_predicate.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class get_indexed_slicesResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - private TimedOutException _te; - private UnavailableException _ue; - - public get_indexed_slicesResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list113 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i114 = 0; _i114 < _list113.Count; ++_i114) - { - KeySlice _elem115; - _elem115 = new KeySlice(); - await _elem115.ReadAsync(iprot, cancellationToken); - Success.Add(_elem115); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("get_indexed_slices_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); - foreach (KeySlice _iter116 in Success) - { - await _iter116.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("get_indexed_slices_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class insertArgs : TBase - { - public insertArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public insertArgs(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level) - : this() - { - this.Key = key; - this.Column_parent = column_parent; - this.Column = column; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public Column Column { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_parent = false; - bool isset_column = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Column = new Column(); - await Column.ReadAsync(iprot, cancellationToken); - isset_column = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("insert_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("insert_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Column: "); - sb.Append(Column == null ? "" : Column.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class insertResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public insertResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("insert_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("insert_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class addArgs : TBase - { - public addArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public addArgs(byte[] key, ColumnParent column_parent, CounterColumn column, - ConsistencyLevel consistency_level) : this() - { - this.Key = key; - this.Column_parent = column_parent; - this.Column = column; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnParent Column_parent { get; set; } - - [DataMember(Order = 0)] - public CounterColumn Column { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_parent = false; - bool isset_column = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_parent = new ColumnParent(); - await Column_parent.ReadAsync(iprot, cancellationToken); - isset_column_parent = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Column = new CounterColumn(); - await Column.ReadAsync(iprot, cancellationToken); - isset_column = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_parent) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("add_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_parent"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_parent.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("add_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_parent: "); - sb.Append(Column_parent == null ? "" : Column_parent.ToString()); - sb.Append(", Column: "); - sb.Append(Column == null ? "" : Column.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class addResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public addResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("add_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("add_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class removeArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private ConsistencyLevel _consistency_level; - - public removeArgs() - { - this._consistency_level = ConsistencyLevel.ONE; - this.__isset.consistency_level = true; - } - - public removeArgs(byte[] key, ColumnPath column_path, long timestamp) : this() - { - this.Key = key; - this.Column_path = column_path; - this.Timestamp = timestamp; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnPath Column_path { get; set; } - - [DataMember(Order = 0)] - public long Timestamp { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level - { - get { return _consistency_level; } - set - { - __isset.consistency_level = true; - this._consistency_level = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_column_path = false; - bool isset_timestamp = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Column_path = new ColumnPath(); - await Column_path.ReadAsync(iprot, cancellationToken); - isset_column_path = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I64) - { - Timestamp = await iprot.ReadI64Async(cancellationToken); - isset_timestamp = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_column_path) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_timestamp) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("remove_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "column_path"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_path.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "timestamp"; - field.Type = TType.I64; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Timestamp, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (__isset.consistency_level) - { - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeConsistency_level() - { - return __isset.consistency_level; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("remove_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Column_path: "); - sb.Append(Column_path == null ? "" : Column_path.ToString()); - sb.Append(", Timestamp: "); - sb.Append(Timestamp); - if (__isset.consistency_level) - { - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool consistency_level; - } - } - - - [DataContract(Namespace = "")] - public partial class removeResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public removeResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("remove_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("remove_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class remove_counterArgs : TBase - { - public remove_counterArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public remove_counterArgs(byte[] key, ColumnPath path, ConsistencyLevel consistency_level) : this() - { - this.Key = key; - this.Path = path; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public ColumnPath Path { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_path = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Path = new ColumnPath(); - await Path.ReadAsync(iprot, cancellationToken); - isset_path = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_path) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("remove_counter_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "path"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Path.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("remove_counter_args("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Path: "); - sb.Append(Path == null ? "" : Path.ToString()); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class remove_counterResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public remove_counterResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("remove_counter_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("remove_counter_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class batch_mutateArgs : TBase - { - public batch_mutateArgs() - { - this.Consistency_level = ConsistencyLevel.ONE; - } - - public batch_mutateArgs(Dictionary>> mutation_map, - ConsistencyLevel consistency_level) : this() - { - this.Mutation_map = mutation_map; - this.Consistency_level = consistency_level; - } - - [DataMember(Order = 0)] - public Dictionary>> Mutation_map { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public ConsistencyLevel Consistency_level { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_mutation_map = false; - bool isset_consistency_level = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Mutation_map = new Dictionary>>(); - TMap _map117 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i118 = 0; _i118 < _map117.Count; ++_i118) - { - byte[] _key119; - Dictionary> _val120; - _key119 = await iprot.ReadBinaryAsync(cancellationToken); - { - _val120 = new Dictionary>(); - TMap _map121 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i122 = 0; _i122 < _map121.Count; ++_i122) - { - string _key123; - List _val124; - _key123 = await iprot.ReadStringAsync(cancellationToken); - { - _val124 = new List(); - TList _list125 = - await iprot.ReadListBeginAsync(cancellationToken); - for (int _i126 = 0; _i126 < _list125.Count; ++_i126) - { - Mutation _elem127; - _elem127 = new Mutation(); - await _elem127.ReadAsync(iprot, cancellationToken); - _val124.Add(_elem127); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _val120[_key123] = _val124; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Mutation_map[_key119] = _val120; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - isset_mutation_map = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Consistency_level = (ConsistencyLevel) await iprot.ReadI32Async(cancellationToken); - isset_consistency_level = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_mutation_map) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_consistency_level) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("batch_mutate_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "mutation_map"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.Map, Mutation_map.Count), - cancellationToken); - foreach (byte[] _iter128 in Mutation_map.Keys) - { - await oprot.WriteBinaryAsync(_iter128, cancellationToken); - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.String, TType.List, Mutation_map[_iter128].Count), - cancellationToken); - foreach (string _iter129 in Mutation_map[_iter128].Keys) - { - await oprot.WriteStringAsync(_iter129, cancellationToken); - { - await - oprot.WriteListBeginAsync( - new TList(TType.Struct, Mutation_map[_iter128][_iter129].Count), - cancellationToken); - foreach (Mutation _iter130 in Mutation_map[_iter128][_iter129]) - { - await _iter130.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "consistency_level"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Consistency_level, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("batch_mutate_args("); - sb.Append(", Mutation_map: "); - sb.Append(Mutation_map); - sb.Append(", Consistency_level: "); - sb.Append(Consistency_level); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class batch_mutateResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public batch_mutateResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("batch_mutate_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("batch_mutate_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class truncateArgs : TBase - { - public truncateArgs() - { - } - - public truncateArgs(string cfname) : this() - { - this.Cfname = cfname; - } - - [DataMember(Order = 0)] - public string Cfname { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_cfname = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Cfname = await iprot.ReadStringAsync(cancellationToken); - isset_cfname = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_cfname) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("truncate_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "cfname"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Cfname, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("truncate_args("); - sb.Append(", Cfname: "); - sb.Append(Cfname); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class truncateResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private TimedOutException _te; - private UnavailableException _ue; - - public truncateResult() - { - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("truncate_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("truncate_result("); - bool __first = true; - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - } - - #region XmlSerializer support - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class describe_schema_versionsArgs : TBase - { - public describe_schema_versionsArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_schema_versions_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_schema_versions_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_schema_versionsResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private Dictionary> _success; - - public describe_schema_versionsResult() - { - } - - [DataMember(Order = 0)] - public Dictionary> Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map131 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i132 = 0; _i132 < _map131.Count; ++_i132) - { - string _key133; - List _val134; - _key133 = await iprot.ReadStringAsync(cancellationToken); - { - _val134 = new List(); - TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i136 = 0; _i136 < _list135.Count; ++_i136) - { - string _elem137; - _elem137 = await iprot.ReadStringAsync(cancellationToken); - _val134.Add(_elem137); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Success[_key133] = _val134; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_schema_versions_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.List, Success.Count), - cancellationToken); - foreach (string _iter138 in Success.Keys) - { - await oprot.WriteStringAsync(_iter138, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.String, Success[_iter138].Count), - cancellationToken); - foreach (string _iter139 in Success[_iter138]) - { - await oprot.WriteStringAsync(_iter139, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_schema_versions_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class describe_keyspacesArgs : TBase - { - public describe_keyspacesArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_keyspaces_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_keyspaces_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_keyspacesResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - - public describe_keyspacesResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list140 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i141 = 0; _i141 < _list140.Count; ++_i141) - { - KsDef _elem142; - _elem142 = new KsDef(); - await _elem142.ReadAsync(iprot, cancellationToken); - Success.Add(_elem142); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_keyspaces_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); - foreach (KsDef _iter143 in Success) - { - await _iter143.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_keyspaces_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class describe_cluster_nameArgs : TBase - { - public describe_cluster_nameArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_cluster_name_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_cluster_name_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_cluster_nameResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public describe_cluster_nameResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_cluster_name_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("describe_cluster_name_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class describe_versionArgs : TBase - { - public describe_versionArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_version_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_version_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_versionResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public describe_versionResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_version_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("describe_version_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class describe_ringArgs : TBase - { - public describe_ringArgs() - { - } - - public describe_ringArgs(string keyspace) : this() - { - this.Keyspace = keyspace; - } - - [DataMember(Order = 0)] - public string Keyspace { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keyspace = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Keyspace = await iprot.ReadStringAsync(cancellationToken); - isset_keyspace = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keyspace) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_ring_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keyspace"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Keyspace, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_ring_args("); - sb.Append(", Keyspace: "); - sb.Append(Keyspace); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_ringResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - - public describe_ringResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list144 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i145 = 0; _i145 < _list144.Count; ++_i145) - { - TokenRange _elem146; - _elem146 = new TokenRange(); - await _elem146.ReadAsync(iprot, cancellationToken); - Success.Add(_elem146); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_ring_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Success.Count), cancellationToken); - foreach (TokenRange _iter147 in Success) - { - await _iter147.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_ring_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class describe_partitionerArgs : TBase - { - public describe_partitionerArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_partitioner_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_partitioner_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_partitionerResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public describe_partitionerResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_partitioner_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("describe_partitioner_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class describe_snitchArgs : TBase - { - public describe_snitchArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_snitch_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_snitch_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_snitchResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public describe_snitchResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_snitch_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("describe_snitch_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class describe_keyspaceArgs : TBase - { - public describe_keyspaceArgs() - { - } - - public describe_keyspaceArgs(string keyspace) : this() - { - this.Keyspace = keyspace; - } - - [DataMember(Order = 0)] - public string Keyspace { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keyspace = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Keyspace = await iprot.ReadStringAsync(cancellationToken); - isset_keyspace = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keyspace) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_keyspace_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keyspace"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Keyspace, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_keyspace_args("); - sb.Append(", Keyspace: "); - sb.Append(Keyspace); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_keyspaceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private NotFoundException _nfe; - private KsDef _success; - - public describe_keyspaceResult() - { - } - - [DataMember(Order = 0)] - public KsDef Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public NotFoundException Nfe - { - get { return _nfe; } - set - { - __isset.nfe = true; - this._nfe = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new KsDef(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Nfe = new NotFoundException(); - await Nfe.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_keyspace_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.nfe) - { - if (Nfe != null) - { - field.Name = "Nfe"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Nfe.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_keyspace_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Nfe != null && __isset.nfe) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Nfe: "); - sb.Append(Nfe == null ? "" : Nfe.ToString()); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool nfe; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeNfe() - { - return __isset.nfe; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class describe_splitsArgs : TBase - { - public describe_splitsArgs() - { - } - - public describe_splitsArgs(string cfName, string start_token, string end_token, int keys_per_split) : this() - { - this.CfName = cfName; - this.Start_token = start_token; - this.End_token = end_token; - this.Keys_per_split = keys_per_split; - } - - [DataMember(Order = 0)] - public string CfName { get; set; } - - [DataMember(Order = 0)] - public string Start_token { get; set; } - - [DataMember(Order = 0)] - public string End_token { get; set; } - - [DataMember(Order = 0)] - public int Keys_per_split { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_cfName = false; - bool isset_start_token = false; - bool isset_end_token = false; - bool isset_keys_per_split = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - CfName = await iprot.ReadStringAsync(cancellationToken); - isset_cfName = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Start_token = await iprot.ReadStringAsync(cancellationToken); - isset_start_token = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - End_token = await iprot.ReadStringAsync(cancellationToken); - isset_end_token = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Keys_per_split = await iprot.ReadI32Async(cancellationToken); - isset_keys_per_split = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_cfName) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_start_token) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_end_token) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_keys_per_split) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_splits_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "cfName"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(CfName, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "start_token"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Start_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "end_token"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(End_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "keys_per_split"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Keys_per_split, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_splits_args("); - sb.Append(", CfName: "); - sb.Append(CfName); - sb.Append(", Start_token: "); - sb.Append(Start_token); - sb.Append(", End_token: "); - sb.Append(End_token); - sb.Append(", Keys_per_split: "); - sb.Append(Keys_per_split); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class describe_splitsResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private List _success; - - public describe_splitsResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list148 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i149 = 0; _i149 < _list148.Count; ++_i149) - { - string _elem150; - _elem150 = await iprot.ReadStringAsync(cancellationToken); - Success.Add(_elem150); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("describe_splits_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.String, Success.Count), cancellationToken); - foreach (string _iter151 in Success) - { - await oprot.WriteStringAsync(_iter151, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("describe_splits_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_add_column_familyArgs : TBase - { - public system_add_column_familyArgs() - { - } - - public system_add_column_familyArgs(CfDef cf_def) : this() - { - this.Cf_def = cf_def; - } - - [DataMember(Order = 0)] - public CfDef Cf_def { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_cf_def = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Cf_def = new CfDef(); - await Cf_def.ReadAsync(iprot, cancellationToken); - isset_cf_def = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_cf_def) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_add_column_family_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "cf_def"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Cf_def.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_add_column_family_args("); - sb.Append(", Cf_def: "); - sb.Append(Cf_def == null ? "" : Cf_def.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_add_column_familyResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_add_column_familyResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_add_column_family_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_add_column_family_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_drop_column_familyArgs : TBase - { - public system_drop_column_familyArgs() - { - } - - public system_drop_column_familyArgs(string column_family) : this() - { - this.Column_family = column_family; - } - - [DataMember(Order = 0)] - public string Column_family { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_family = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Column_family = await iprot.ReadStringAsync(cancellationToken); - isset_column_family = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_family) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_drop_column_family_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_family"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Column_family, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_drop_column_family_args("); - sb.Append(", Column_family: "); - sb.Append(Column_family); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_drop_column_familyResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_drop_column_familyResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_drop_column_family_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_drop_column_family_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_add_keyspaceArgs : TBase - { - public system_add_keyspaceArgs() - { - } - - public system_add_keyspaceArgs(KsDef ks_def) : this() - { - this.Ks_def = ks_def; - } - - [DataMember(Order = 0)] - public KsDef Ks_def { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_ks_def = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ks_def = new KsDef(); - await Ks_def.ReadAsync(iprot, cancellationToken); - isset_ks_def = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_ks_def) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_add_keyspace_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "ks_def"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ks_def.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_add_keyspace_args("); - sb.Append(", Ks_def: "); - sb.Append(Ks_def == null ? "" : Ks_def.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_add_keyspaceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_add_keyspaceResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_add_keyspace_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_add_keyspace_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_drop_keyspaceArgs : TBase - { - public system_drop_keyspaceArgs() - { - } - - public system_drop_keyspaceArgs(string keyspace) : this() - { - this.Keyspace = keyspace; - } - - [DataMember(Order = 0)] - public string Keyspace { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keyspace = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Keyspace = await iprot.ReadStringAsync(cancellationToken); - isset_keyspace = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keyspace) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_drop_keyspace_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keyspace"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Keyspace, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_drop_keyspace_args("); - sb.Append(", Keyspace: "); - sb.Append(Keyspace); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_drop_keyspaceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_drop_keyspaceResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_drop_keyspace_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_drop_keyspace_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_update_keyspaceArgs : TBase - { - public system_update_keyspaceArgs() - { - } - - public system_update_keyspaceArgs(KsDef ks_def) : this() - { - this.Ks_def = ks_def; - } - - [DataMember(Order = 0)] - public KsDef Ks_def { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_ks_def = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Ks_def = new KsDef(); - await Ks_def.ReadAsync(iprot, cancellationToken); - isset_ks_def = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_ks_def) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_update_keyspace_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "ks_def"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ks_def.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_update_keyspace_args("); - sb.Append(", Ks_def: "); - sb.Append(Ks_def == null ? "" : Ks_def.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_update_keyspaceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_update_keyspaceResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_update_keyspace_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_update_keyspace_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class system_update_column_familyArgs : TBase - { - public system_update_column_familyArgs() - { - } - - public system_update_column_familyArgs(CfDef cf_def) : this() - { - this.Cf_def = cf_def; - } - - [DataMember(Order = 0)] - public CfDef Cf_def { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_cf_def = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Cf_def = new CfDef(); - await Cf_def.ReadAsync(iprot, cancellationToken); - isset_cf_def = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_cf_def) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_update_column_family_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "cf_def"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Cf_def.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_update_column_family_args("); - sb.Append(", Cf_def: "); - sb.Append(Cf_def == null ? "" : Cf_def.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class system_update_column_familyResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private string _success; - - public system_update_column_familyResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("system_update_column_family_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("system_update_column_family_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class execute_cql_queryArgs : TBase - { - public execute_cql_queryArgs() - { - } - - public execute_cql_queryArgs(byte[] query, Compression compression) : this() - { - this.Query = query; - this.Compression = compression; - } - - [DataMember(Order = 0)] - public byte[] Query { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public Compression Compression { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_query = false; - bool isset_compression = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Query = await iprot.ReadBinaryAsync(cancellationToken); - isset_query = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Compression = (Compression) await iprot.ReadI32Async(cancellationToken); - isset_compression = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_query) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_compression) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("execute_cql_query_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "query"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Query, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "compression"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Compression, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("execute_cql_query_args("); - sb.Append(", Query: "); - sb.Append(Query); - sb.Append(", Compression: "); - sb.Append(Compression); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class execute_cql_queryResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private CqlResult _success; - private TimedOutException _te; - private UnavailableException _ue; - - public execute_cql_queryResult() - { - } - - [DataMember(Order = 0)] - public CqlResult Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new CqlResult(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("execute_cql_query_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("execute_cql_query_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class prepare_cql_queryArgs : TBase - { - public prepare_cql_queryArgs() - { - } - - public prepare_cql_queryArgs(byte[] query, Compression compression) : this() - { - this.Query = query; - this.Compression = compression; - } - - [DataMember(Order = 0)] - public byte[] Query { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public Compression Compression { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_query = false; - bool isset_compression = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Query = await iprot.ReadBinaryAsync(cancellationToken); - isset_query = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Compression = (Compression) await iprot.ReadI32Async(cancellationToken); - isset_compression = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_query) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_compression) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("prepare_cql_query_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "query"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Query, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "compression"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Compression, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("prepare_cql_query_args("); - sb.Append(", Query: "); - sb.Append(Query); - sb.Append(", Compression: "); - sb.Append(Compression); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class prepare_cql_queryResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private CqlPreparedResult _success; - - public prepare_cql_queryResult() - { - } - - [DataMember(Order = 0)] - public CqlPreparedResult Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new CqlPreparedResult(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("prepare_cql_query_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("prepare_cql_query_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class execute_prepared_cql_queryArgs : TBase - { - public execute_prepared_cql_queryArgs() - { - } - - public execute_prepared_cql_queryArgs(int itemId, List values) : this() - { - this.ItemId = itemId; - this.Values = values; - } - - [DataMember(Order = 0)] - public int ItemId { get; set; } - - [DataMember(Order = 0)] - public List Values { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_itemId = false; - bool isset_values = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ItemId = await iprot.ReadI32Async(cancellationToken); - isset_itemId = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Values = new List(); - TList _list152 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i153 = 0; _i153 < _list152.Count; ++_i153) - { - string _elem154; - _elem154 = await iprot.ReadStringAsync(cancellationToken); - Values.Add(_elem154); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_values = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_itemId) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_values) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("execute_prepared_cql_query_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "itemId"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ItemId, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "values"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Values.Count), cancellationToken); - foreach (string _iter155 in Values) - { - await oprot.WriteStringAsync(_iter155, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("execute_prepared_cql_query_args("); - sb.Append(", ItemId: "); - sb.Append(ItemId); - sb.Append(", Values: "); - sb.Append(Values); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class execute_prepared_cql_queryResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidRequestException _ire; - private SchemaDisagreementException _sde; - private CqlResult _success; - private TimedOutException _te; - private UnavailableException _ue; - - public execute_prepared_cql_queryResult() - { - } - - [DataMember(Order = 0)] - public CqlResult Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidRequestException Ire - { - get { return _ire; } - set - { - __isset.ire = true; - this._ire = value; - } - } - - [DataMember(Order = 0)] - public UnavailableException Ue - { - get { return _ue; } - set - { - __isset.ue = true; - this._ue = value; - } - } - - [DataMember(Order = 0)] - public TimedOutException Te - { - get { return _te; } - set - { - __isset.te = true; - this._te = value; - } - } - - [DataMember(Order = 0)] - public SchemaDisagreementException Sde - { - get { return _sde; } - set - { - __isset.sde = true; - this._sde = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new CqlResult(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ire = new InvalidRequestException(); - await Ire.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ue = new UnavailableException(); - await Ue.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Te = new TimedOutException(); - await Te.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Struct) - { - Sde = new SchemaDisagreementException(); - await Sde.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("execute_prepared_cql_query_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ire) - { - if (Ire != null) - { - field.Name = "Ire"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ire.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.ue) - { - if (Ue != null) - { - field.Name = "Ue"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ue.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.te) - { - if (Te != null) - { - field.Name = "Te"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Te.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.sde) - { - if (Sde != null) - { - field.Name = "Sde"; - field.Type = TType.Struct; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Sde.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("execute_prepared_cql_query_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Ire != null && __isset.ire) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ire: "); - sb.Append(Ire == null ? "" : Ire.ToString()); - } - if (Ue != null && __isset.ue) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ue: "); - sb.Append(Ue == null ? "" : Ue.ToString()); - } - if (Te != null && __isset.te) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Te: "); - sb.Append(Te == null ? "" : Te.ToString()); - } - if (Sde != null && __isset.sde) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Sde: "); - sb.Append(Sde == null ? "" : Sde.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ire; - [DataMember] public bool ue; - [DataMember] public bool te; - [DataMember] public bool sde; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeIre() - { - return __isset.ire; - } - - public bool ShouldSerializeUe() - { - return __isset.ue; - } - - public bool ShouldSerializeTe() - { - return __isset.te; - } - - public bool ShouldSerializeSde() - { - return __isset.sde; - } - - #endregion XmlSerializer support - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs deleted file mode 100644 index c580141e9be..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CassandraTest.Constants.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; - - -namespace Apache.Cassandra.Test -{ - public static class CassandraTestConstants - { - public const string VERSION = "19.24.0"; - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs deleted file mode 100644 index cd75c9b5198..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CfDef.cs +++ /dev/null @@ -1,1043 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CfDef : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private double _bloom_filter_fp_chance; - private List _column_metadata; - private string _column_type; - private string _comment; - private string _compaction_strategy; - private Dictionary _compaction_strategy_options; - private string _comparator_type; - private Dictionary _compression_options; - private string _default_validation_class; - private int _gc_grace_seconds; - private int _id; - private byte[] _key_alias; - private string _key_validation_class; - private int _max_compaction_threshold; - private double _merge_shards_chance; - private int _min_compaction_threshold; - private double _read_repair_chance; - private bool _replicate_on_write; - private string _subcomparator_type; - - public CfDef() - { - this._column_type = "Standard"; - this.__isset.column_type = true; - this._comparator_type = "BytesType"; - this.__isset.comparator_type = true; - this._read_repair_chance = 1; - this.__isset.read_repair_chance = true; - } - - public CfDef(string keyspace, string name) : this() - { - this.Keyspace = keyspace; - this.Name = name; - } - - [DataMember(Order = 0)] - public string Keyspace { get; set; } - - [DataMember(Order = 0)] - public string Name { get; set; } - - [DataMember(Order = 0)] - public string Column_type - { - get { return _column_type; } - set - { - __isset.column_type = true; - this._column_type = value; - } - } - - [DataMember(Order = 0)] - public string Comparator_type - { - get { return _comparator_type; } - set - { - __isset.comparator_type = true; - this._comparator_type = value; - } - } - - [DataMember(Order = 0)] - public string Subcomparator_type - { - get { return _subcomparator_type; } - set - { - __isset.subcomparator_type = true; - this._subcomparator_type = value; - } - } - - [DataMember(Order = 0)] - public string Comment - { - get { return _comment; } - set - { - __isset.comment = true; - this._comment = value; - } - } - - [DataMember(Order = 0)] - public double Read_repair_chance - { - get { return _read_repair_chance; } - set - { - __isset.read_repair_chance = true; - this._read_repair_chance = value; - } - } - - [DataMember(Order = 0)] - public List Column_metadata - { - get { return _column_metadata; } - set - { - __isset.column_metadata = true; - this._column_metadata = value; - } - } - - [DataMember(Order = 0)] - public int Gc_grace_seconds - { - get { return _gc_grace_seconds; } - set - { - __isset.gc_grace_seconds = true; - this._gc_grace_seconds = value; - } - } - - [DataMember(Order = 0)] - public string Default_validation_class - { - get { return _default_validation_class; } - set - { - __isset.default_validation_class = true; - this._default_validation_class = value; - } - } - - [DataMember(Order = 0)] - public int Id - { - get { return _id; } - set - { - __isset.id = true; - this._id = value; - } - } - - [DataMember(Order = 0)] - public int Min_compaction_threshold - { - get { return _min_compaction_threshold; } - set - { - __isset.min_compaction_threshold = true; - this._min_compaction_threshold = value; - } - } - - [DataMember(Order = 0)] - public int Max_compaction_threshold - { - get { return _max_compaction_threshold; } - set - { - __isset.max_compaction_threshold = true; - this._max_compaction_threshold = value; - } - } - - [DataMember(Order = 0)] - public bool Replicate_on_write - { - get { return _replicate_on_write; } - set - { - __isset.replicate_on_write = true; - this._replicate_on_write = value; - } - } - - [DataMember(Order = 0)] - public double Merge_shards_chance - { - get { return _merge_shards_chance; } - set - { - __isset.merge_shards_chance = true; - this._merge_shards_chance = value; - } - } - - [DataMember(Order = 0)] - public string Key_validation_class - { - get { return _key_validation_class; } - set - { - __isset.key_validation_class = true; - this._key_validation_class = value; - } - } - - [DataMember(Order = 0)] - public byte[] Key_alias - { - get { return _key_alias; } - set - { - __isset.key_alias = true; - this._key_alias = value; - } - } - - [DataMember(Order = 0)] - public string Compaction_strategy - { - get { return _compaction_strategy; } - set - { - __isset.compaction_strategy = true; - this._compaction_strategy = value; - } - } - - [DataMember(Order = 0)] - public Dictionary Compaction_strategy_options - { - get { return _compaction_strategy_options; } - set - { - __isset.compaction_strategy_options = true; - this._compaction_strategy_options = value; - } - } - - [DataMember(Order = 0)] - public Dictionary Compression_options - { - get { return _compression_options; } - set - { - __isset.compression_options = true; - this._compression_options = value; - } - } - - [DataMember(Order = 0)] - public double Bloom_filter_fp_chance - { - get { return _bloom_filter_fp_chance; } - set - { - __isset.bloom_filter_fp_chance = true; - this._bloom_filter_fp_chance = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_keyspace = false; - bool isset_name = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Keyspace = await iprot.ReadStringAsync(cancellationToken); - isset_keyspace = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Name = await iprot.ReadStringAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Column_type = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.String) - { - Comparator_type = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.String) - { - Subcomparator_type = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 8: - if (field.Type == TType.String) - { - Comment = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 12: - if (field.Type == TType.Double) - { - Read_repair_chance = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 13: - if (field.Type == TType.List) - { - { - Column_metadata = new List(); - TList _list42 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i43 = 0; _i43 < _list42.Count; ++_i43) - { - ColumnDef _elem44; - _elem44 = new ColumnDef(); - await _elem44.ReadAsync(iprot, cancellationToken); - Column_metadata.Add(_elem44); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 14: - if (field.Type == TType.I32) - { - Gc_grace_seconds = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 15: - if (field.Type == TType.String) - { - Default_validation_class = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 16: - if (field.Type == TType.I32) - { - Id = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 17: - if (field.Type == TType.I32) - { - Min_compaction_threshold = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 18: - if (field.Type == TType.I32) - { - Max_compaction_threshold = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 24: - if (field.Type == TType.Bool) - { - Replicate_on_write = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 25: - if (field.Type == TType.Double) - { - Merge_shards_chance = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 26: - if (field.Type == TType.String) - { - Key_validation_class = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 28: - if (field.Type == TType.String) - { - Key_alias = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 29: - if (field.Type == TType.String) - { - Compaction_strategy = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 30: - if (field.Type == TType.Map) - { - { - Compaction_strategy_options = new Dictionary(); - TMap _map45 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i46 = 0; _i46 < _map45.Count; ++_i46) - { - string _key47; - string _val48; - _key47 = await iprot.ReadStringAsync(cancellationToken); - _val48 = await iprot.ReadStringAsync(cancellationToken); - Compaction_strategy_options[_key47] = _val48; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 32: - if (field.Type == TType.Map) - { - { - Compression_options = new Dictionary(); - TMap _map49 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i50 = 0; _i50 < _map49.Count; ++_i50) - { - string _key51; - string _val52; - _key51 = await iprot.ReadStringAsync(cancellationToken); - _val52 = await iprot.ReadStringAsync(cancellationToken); - Compression_options[_key51] = _val52; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 33: - if (field.Type == TType.Double) - { - Bloom_filter_fp_chance = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_keyspace) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CfDef"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "keyspace"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Keyspace, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "name"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Column_type != null && __isset.column_type) - { - field.Name = "column_type"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Column_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Comparator_type != null && __isset.comparator_type) - { - field.Name = "comparator_type"; - field.Type = TType.String; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Comparator_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Subcomparator_type != null && __isset.subcomparator_type) - { - field.Name = "subcomparator_type"; - field.Type = TType.String; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Subcomparator_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Comment != null && __isset.comment) - { - field.Name = "comment"; - field.Type = TType.String; - field.ID = 8; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Comment, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.read_repair_chance) - { - field.Name = "read_repair_chance"; - field.Type = TType.Double; - field.ID = 12; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Read_repair_chance, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Column_metadata != null && __isset.column_metadata) - { - field.Name = "column_metadata"; - field.Type = TType.List; - field.ID = 13; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Column_metadata.Count), cancellationToken); - foreach (ColumnDef _iter53 in Column_metadata) - { - await _iter53.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.gc_grace_seconds) - { - field.Name = "gc_grace_seconds"; - field.Type = TType.I32; - field.ID = 14; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Gc_grace_seconds, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Default_validation_class != null && __isset.default_validation_class) - { - field.Name = "default_validation_class"; - field.Type = TType.String; - field.ID = 15; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Default_validation_class, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.id) - { - field.Name = "id"; - field.Type = TType.I32; - field.ID = 16; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Id, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.min_compaction_threshold) - { - field.Name = "min_compaction_threshold"; - field.Type = TType.I32; - field.ID = 17; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Min_compaction_threshold, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.max_compaction_threshold) - { - field.Name = "max_compaction_threshold"; - field.Type = TType.I32; - field.ID = 18; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Max_compaction_threshold, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.replicate_on_write) - { - field.Name = "replicate_on_write"; - field.Type = TType.Bool; - field.ID = 24; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Replicate_on_write, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.merge_shards_chance) - { - field.Name = "merge_shards_chance"; - field.Type = TType.Double; - field.ID = 25; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Merge_shards_chance, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Key_validation_class != null && __isset.key_validation_class) - { - field.Name = "key_validation_class"; - field.Type = TType.String; - field.ID = 26; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Key_validation_class, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Key_alias != null && __isset.key_alias) - { - field.Name = "key_alias"; - field.Type = TType.String; - field.ID = 28; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key_alias, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Compaction_strategy != null && __isset.compaction_strategy) - { - field.Name = "compaction_strategy"; - field.Type = TType.String; - field.ID = 29; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Compaction_strategy, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Compaction_strategy_options != null && __isset.compaction_strategy_options) - { - field.Name = "compaction_strategy_options"; - field.Type = TType.Map; - field.ID = 30; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.String, TType.String, Compaction_strategy_options.Count), - cancellationToken); - foreach (string _iter54 in Compaction_strategy_options.Keys) - { - await oprot.WriteStringAsync(_iter54, cancellationToken); - await oprot.WriteStringAsync(Compaction_strategy_options[_iter54], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Compression_options != null && __isset.compression_options) - { - field.Name = "compression_options"; - field.Type = TType.Map; - field.ID = 32; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Compression_options.Count), - cancellationToken); - foreach (string _iter55 in Compression_options.Keys) - { - await oprot.WriteStringAsync(_iter55, cancellationToken); - await oprot.WriteStringAsync(Compression_options[_iter55], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.bloom_filter_fp_chance) - { - field.Name = "bloom_filter_fp_chance"; - field.Type = TType.Double; - field.ID = 33; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Bloom_filter_fp_chance, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CfDef("); - sb.Append(", Keyspace: "); - sb.Append(Keyspace); - sb.Append(", Name: "); - sb.Append(Name); - if (Column_type != null && __isset.column_type) - { - sb.Append(", Column_type: "); - sb.Append(Column_type); - } - if (Comparator_type != null && __isset.comparator_type) - { - sb.Append(", Comparator_type: "); - sb.Append(Comparator_type); - } - if (Subcomparator_type != null && __isset.subcomparator_type) - { - sb.Append(", Subcomparator_type: "); - sb.Append(Subcomparator_type); - } - if (Comment != null && __isset.comment) - { - sb.Append(", Comment: "); - sb.Append(Comment); - } - if (__isset.read_repair_chance) - { - sb.Append(", Read_repair_chance: "); - sb.Append(Read_repair_chance); - } - if (Column_metadata != null && __isset.column_metadata) - { - sb.Append(", Column_metadata: "); - sb.Append(Column_metadata); - } - if (__isset.gc_grace_seconds) - { - sb.Append(", Gc_grace_seconds: "); - sb.Append(Gc_grace_seconds); - } - if (Default_validation_class != null && __isset.default_validation_class) - { - sb.Append(", Default_validation_class: "); - sb.Append(Default_validation_class); - } - if (__isset.id) - { - sb.Append(", Id: "); - sb.Append(Id); - } - if (__isset.min_compaction_threshold) - { - sb.Append(", Min_compaction_threshold: "); - sb.Append(Min_compaction_threshold); - } - if (__isset.max_compaction_threshold) - { - sb.Append(", Max_compaction_threshold: "); - sb.Append(Max_compaction_threshold); - } - if (__isset.replicate_on_write) - { - sb.Append(", Replicate_on_write: "); - sb.Append(Replicate_on_write); - } - if (__isset.merge_shards_chance) - { - sb.Append(", Merge_shards_chance: "); - sb.Append(Merge_shards_chance); - } - if (Key_validation_class != null && __isset.key_validation_class) - { - sb.Append(", Key_validation_class: "); - sb.Append(Key_validation_class); - } - if (Key_alias != null && __isset.key_alias) - { - sb.Append(", Key_alias: "); - sb.Append(Key_alias); - } - if (Compaction_strategy != null && __isset.compaction_strategy) - { - sb.Append(", Compaction_strategy: "); - sb.Append(Compaction_strategy); - } - if (Compaction_strategy_options != null && __isset.compaction_strategy_options) - { - sb.Append(", Compaction_strategy_options: "); - sb.Append(Compaction_strategy_options); - } - if (Compression_options != null && __isset.compression_options) - { - sb.Append(", Compression_options: "); - sb.Append(Compression_options); - } - if (__isset.bloom_filter_fp_chance) - { - sb.Append(", Bloom_filter_fp_chance: "); - sb.Append(Bloom_filter_fp_chance); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool column_type; - [DataMember] public bool comparator_type; - [DataMember] public bool subcomparator_type; - [DataMember] public bool comment; - [DataMember] public bool read_repair_chance; - [DataMember] public bool column_metadata; - [DataMember] public bool gc_grace_seconds; - [DataMember] public bool default_validation_class; - [DataMember] public bool id; - [DataMember] public bool min_compaction_threshold; - [DataMember] public bool max_compaction_threshold; - [DataMember] public bool replicate_on_write; - [DataMember] public bool merge_shards_chance; - [DataMember] public bool key_validation_class; - [DataMember] public bool key_alias; - [DataMember] public bool compaction_strategy; - [DataMember] public bool compaction_strategy_options; - [DataMember] public bool compression_options; - [DataMember] public bool bloom_filter_fp_chance; - } - - #region XmlSerializer support - - public bool ShouldSerializeColumn_type() - { - return __isset.column_type; - } - - public bool ShouldSerializeComparator_type() - { - return __isset.comparator_type; - } - - public bool ShouldSerializeSubcomparator_type() - { - return __isset.subcomparator_type; - } - - public bool ShouldSerializeComment() - { - return __isset.comment; - } - - public bool ShouldSerializeRead_repair_chance() - { - return __isset.read_repair_chance; - } - - public bool ShouldSerializeColumn_metadata() - { - return __isset.column_metadata; - } - - public bool ShouldSerializeGc_grace_seconds() - { - return __isset.gc_grace_seconds; - } - - public bool ShouldSerializeDefault_validation_class() - { - return __isset.default_validation_class; - } - - public bool ShouldSerializeId() - { - return __isset.id; - } - - public bool ShouldSerializeMin_compaction_threshold() - { - return __isset.min_compaction_threshold; - } - - public bool ShouldSerializeMax_compaction_threshold() - { - return __isset.max_compaction_threshold; - } - - public bool ShouldSerializeReplicate_on_write() - { - return __isset.replicate_on_write; - } - - public bool ShouldSerializeMerge_shards_chance() - { - return __isset.merge_shards_chance; - } - - public bool ShouldSerializeKey_validation_class() - { - return __isset.key_validation_class; - } - - public bool ShouldSerializeKey_alias() - { - return __isset.key_alias; - } - - public bool ShouldSerializeCompaction_strategy() - { - return __isset.compaction_strategy; - } - - public bool ShouldSerializeCompaction_strategy_options() - { - return __isset.compaction_strategy_options; - } - - public bool ShouldSerializeCompression_options() - { - return __isset.compression_options; - } - - public bool ShouldSerializeBloom_filter_fp_chance() - { - return __isset.bloom_filter_fp_chance; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs deleted file mode 100644 index dfa7c3ed4ee..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Column.cs +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Basic unit of data within a ColumnFamily. - /// @param name, the name by which this column is set and retrieved. Maximum 64KB long. - /// @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small - /// numbers of MB (since Thrift must read the full value into memory to operate on it). - /// @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to - /// be compared. - /// @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted. - /// - [DataContract(Namespace = "")] - public partial class Column : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _timestamp; - private int _ttl; - private byte[] _value; - - public Column() - { - } - - public Column(byte[] name) : this() - { - this.Name = name; - } - - [DataMember(Order = 0)] - public byte[] Name { get; set; } - - [DataMember(Order = 0)] - public byte[] Value - { - get { return _value; } - set - { - __isset.@value = true; - this._value = value; - } - } - - [DataMember(Order = 0)] - public long Timestamp - { - get { return _timestamp; } - set - { - __isset.timestamp = true; - this._timestamp = value; - } - } - - [DataMember(Order = 0)] - public int Ttl - { - get { return _ttl; } - set - { - __isset.ttl = true; - this._ttl = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadBinaryAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Value = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I64) - { - Timestamp = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Ttl = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Column"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Value != null && __isset.@value) - { - field.Name = "value"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Value, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.timestamp) - { - field.Name = "timestamp"; - field.Type = TType.I64; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Timestamp, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.ttl) - { - field.Name = "ttl"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Ttl, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Column("); - sb.Append(", Name: "); - sb.Append(Name); - if (Value != null && __isset.@value) - { - sb.Append(", Value: "); - sb.Append(Value); - } - if (__isset.timestamp) - { - sb.Append(", Timestamp: "); - sb.Append(Timestamp); - } - if (__isset.ttl) - { - sb.Append(", Ttl: "); - sb.Append(Ttl); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool @value; - [DataMember] public bool timestamp; - [DataMember] public bool ttl; - } - - #region XmlSerializer support - - public bool ShouldSerializeValue() - { - return __isset.@value; - } - - public bool ShouldSerializeTimestamp() - { - return __isset.timestamp; - } - - public bool ShouldSerializeTtl() - { - return __isset.ttl; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs deleted file mode 100644 index ef2a0e41bbc..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnDef.cs +++ /dev/null @@ -1,326 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class ColumnDef : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _index_name; - private Dictionary _index_options; - private IndexType _index_type; - - public ColumnDef() - { - } - - public ColumnDef(byte[] name, string validation_class) : this() - { - this.Name = name; - this.Validation_class = validation_class; - } - - [DataMember(Order = 0)] - public byte[] Name { get; set; } - - [DataMember(Order = 0)] - public string Validation_class { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public IndexType Index_type - { - get { return _index_type; } - set - { - __isset.index_type = true; - this._index_type = value; - } - } - - [DataMember(Order = 0)] - public string Index_name - { - get { return _index_name; } - set - { - __isset.index_name = true; - this._index_name = value; - } - } - - [DataMember(Order = 0)] - public Dictionary Index_options - { - get { return _index_options; } - set - { - __isset.index_options = true; - this._index_options = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - bool isset_validation_class = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadBinaryAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Validation_class = await iprot.ReadStringAsync(cancellationToken); - isset_validation_class = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Index_type = (IndexType) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Index_name = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.Map) - { - { - Index_options = new Dictionary(); - TMap _map37 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i38 = 0; _i38 < _map37.Count; ++_i38) - { - string _key39; - string _val40; - _key39 = await iprot.ReadStringAsync(cancellationToken); - _val40 = await iprot.ReadStringAsync(cancellationToken); - Index_options[_key39] = _val40; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_validation_class) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ColumnDef"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "validation_class"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Validation_class, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (__isset.index_type) - { - field.Name = "index_type"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Index_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Index_name != null && __isset.index_name) - { - field.Name = "index_name"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Index_name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Index_options != null && __isset.index_options) - { - field.Name = "index_options"; - field.Type = TType.Map; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Index_options.Count), - cancellationToken); - foreach (string _iter41 in Index_options.Keys) - { - await oprot.WriteStringAsync(_iter41, cancellationToken); - await oprot.WriteStringAsync(Index_options[_iter41], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ColumnDef("); - sb.Append(", Name: "); - sb.Append(Name); - sb.Append(", Validation_class: "); - sb.Append(Validation_class); - if (__isset.index_type) - { - sb.Append(", Index_type: "); - sb.Append(Index_type); - } - if (Index_name != null && __isset.index_name) - { - sb.Append(", Index_name: "); - sb.Append(Index_name); - } - if (Index_options != null && __isset.index_options) - { - sb.Append(", Index_options: "); - sb.Append(Index_options); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool index_type; - [DataMember] public bool index_name; - [DataMember] public bool index_options; - } - - #region XmlSerializer support - - public bool ShouldSerializeIndex_type() - { - return __isset.index_type; - } - - public bool ShouldSerializeIndex_name() - { - return __isset.index_name; - } - - public bool ShouldSerializeIndex_options() - { - return __isset.index_options; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs deleted file mode 100644 index f57a816e4ba..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnOrSuperColumn.cs +++ /dev/null @@ -1,325 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Methods for fetching rows/records from Cassandra will return either a single instance of ColumnOrSuperColumn or a - /// list - /// of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn (or list of SuperColumns) then the - /// resulting - /// instances of ColumnOrSuperColumn will have the requested SuperColumn in the attribute super_column. For queries - /// resulting - /// in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize - /// on - /// single query methods that may return either a SuperColumn or Column. - /// If the query was on a counter column family, you will either get a counter_column (instead of a column) or a - /// counter_super_column (instead of a super_column) - /// @param column. The Column returned by get() or get_slice(). - /// @param super_column. The SuperColumn returned by get() or get_slice(). - /// @param counter_column. The Counterolumn returned by get() or get_slice(). - /// @param counter_super_column. The CounterSuperColumn returned by get() or get_slice(). - /// - [DataContract(Namespace = "")] - public partial class ColumnOrSuperColumn : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Column _column; - private CounterColumn _counter_column; - private CounterSuperColumn _counter_super_column; - private SuperColumn _super_column; - - public ColumnOrSuperColumn() - { - } - - [DataMember(Order = 0)] - public Column Column - { - get { return _column; } - set - { - __isset.column = true; - this._column = value; - } - } - - [DataMember(Order = 0)] - public SuperColumn Super_column - { - get { return _super_column; } - set - { - __isset.super_column = true; - this._super_column = value; - } - } - - [DataMember(Order = 0)] - public CounterColumn Counter_column - { - get { return _counter_column; } - set - { - __isset.counter_column = true; - this._counter_column = value; - } - } - - [DataMember(Order = 0)] - public CounterSuperColumn Counter_super_column - { - get { return _counter_super_column; } - set - { - __isset.counter_super_column = true; - this._counter_super_column = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Column = new Column(); - await Column.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Super_column = new SuperColumn(); - await Super_column.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Counter_column = new CounterColumn(); - await Counter_column.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Struct) - { - Counter_super_column = new CounterSuperColumn(); - await Counter_super_column.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ColumnOrSuperColumn"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Column != null && __isset.column) - { - field.Name = "column"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Super_column != null && __isset.super_column) - { - field.Name = "super_column"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Super_column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Counter_column != null && __isset.counter_column) - { - field.Name = "counter_column"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Counter_column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Counter_super_column != null && __isset.counter_super_column) - { - field.Name = "counter_super_column"; - field.Type = TType.Struct; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Counter_super_column.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ColumnOrSuperColumn("); - bool __first = true; - if (Column != null && __isset.column) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Column: "); - sb.Append(Column == null ? "" : Column.ToString()); - } - if (Super_column != null && __isset.super_column) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Super_column: "); - sb.Append(Super_column == null ? "" : Super_column.ToString()); - } - if (Counter_column != null && __isset.counter_column) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Counter_column: "); - sb.Append(Counter_column == null ? "" : Counter_column.ToString()); - } - if (Counter_super_column != null && __isset.counter_super_column) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Counter_super_column: "); - sb.Append(Counter_super_column == null ? "" : Counter_super_column.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool column; - [DataMember] public bool super_column; - [DataMember] public bool counter_column; - [DataMember] public bool counter_super_column; - } - - #region XmlSerializer support - - public bool ShouldSerializeColumn() - { - return __isset.column; - } - - public bool ShouldSerializeSuper_column() - { - return __isset.super_column; - } - - public bool ShouldSerializeCounter_column() - { - return __isset.counter_column; - } - - public bool ShouldSerializeCounter_super_column() - { - return __isset.counter_super_column; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs deleted file mode 100644 index 5386a035888..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnParent.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// ColumnParent is used when selecting groups of columns from the same ColumnFamily. In directory structure terms, - /// imagine - /// ColumnParent as ColumnPath + '/../'. - /// See also ColumnPath - /// - [DataContract(Namespace = "")] - public partial class ColumnParent : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _super_column; - - public ColumnParent() - { - } - - public ColumnParent(string column_family) : this() - { - this.Column_family = column_family; - } - - [DataMember(Order = 0)] - public string Column_family { get; set; } - - [DataMember(Order = 0)] - public byte[] Super_column - { - get { return _super_column; } - set - { - __isset.super_column = true; - this._super_column = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_family = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 3: - if (field.Type == TType.String) - { - Column_family = await iprot.ReadStringAsync(cancellationToken); - isset_column_family = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Super_column = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_family) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ColumnParent"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_family"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Column_family, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Super_column != null && __isset.super_column) - { - field.Name = "super_column"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Super_column, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuper_column() - { - return __isset.super_column; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("ColumnParent("); - sb.Append(", Column_family: "); - sb.Append(Column_family); - if (Super_column != null && __isset.super_column) - { - sb.Append(", Super_column: "); - sb.Append(Super_column); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool super_column; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs deleted file mode 100644 index 8559713af8f..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ColumnPath.cs +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// The ColumnPath is the path to a single column in Cassandra. It might make sense to think of ColumnPath and - /// ColumnParent in terms of a directory structure. - /// ColumnPath is used to looking up a single column. - /// @param column_family. The name of the CF of the column being looked up. - /// @param super_column. The super column name. - /// @param column. The column name. - /// - [DataContract(Namespace = "")] - public partial class ColumnPath : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _column; - private byte[] _super_column; - - public ColumnPath() - { - } - - public ColumnPath(string column_family) : this() - { - this.Column_family = column_family; - } - - [DataMember(Order = 0)] - public string Column_family { get; set; } - - [DataMember(Order = 0)] - public byte[] Super_column - { - get { return _super_column; } - set - { - __isset.super_column = true; - this._super_column = value; - } - } - - [DataMember(Order = 0)] - public byte[] Column - { - get { return _column; } - set - { - __isset.column = true; - this._column = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_family = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 3: - if (field.Type == TType.String) - { - Column_family = await iprot.ReadStringAsync(cancellationToken); - isset_column_family = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Super_column = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.String) - { - Column = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_family) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ColumnPath"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_family"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Column_family, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Super_column != null && __isset.super_column) - { - field.Name = "super_column"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Super_column, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Column != null && __isset.column) - { - field.Name = "column"; - field.Type = TType.String; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Column, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ColumnPath("); - sb.Append(", Column_family: "); - sb.Append(Column_family); - if (Super_column != null && __isset.super_column) - { - sb.Append(", Super_column: "); - sb.Append(Super_column); - } - if (Column != null && __isset.column) - { - sb.Append(", Column: "); - sb.Append(Column); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool super_column; - [DataMember] public bool column; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuper_column() - { - return __isset.super_column; - } - - public bool ShouldSerializeColumn() - { - return __isset.column; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs deleted file mode 100644 index b67775c7c0d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Compression.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Apache.Cassandra.Test -{ - /// - /// CQL query compression - /// - public enum Compression - { - GZIP = 1, - NONE = 2, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs deleted file mode 100644 index 1aa244bbf90..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/ConsistencyLevel.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Apache.Cassandra.Test -{ - /// - /// The ConsistencyLevel is an enum that controls both read and write - /// behavior based on the ReplicationFactor of the keyspace. The - /// different consistency levels have different meanings, depending on - /// if you're doing a write or read operation. - /// If W + R > ReplicationFactor, where W is the number of nodes to - /// block for on write, and R the number to block for on reads, you - /// will have strongly consistent behavior; that is, readers will - /// always see the most recent write. Of these, the most interesting is - /// to do QUORUM reads and writes, which gives you consistency while - /// still allowing availability in the face of node failures up to half - /// of - /// - /// . Of course if latency is more important than - /// consistency then you can use lower values for either or both. - /// Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number - /// of replicas rather than a logical concept that adjusts - /// automatically with the replication factor. Of these, only ONE is - /// commonly used; TWO and (even more rarely) THREE are only useful - /// when you care more about guaranteeing a certain level of - /// durability, than consistency. - /// Write consistency levels make the following guarantees before reporting success to the client: - /// ANY Ensure that the write has been written once somewhere, including possibly being hinted in a - /// non-target node. - /// ONE Ensure that the write has been written to at least 1 node's commit log and memory table - /// TWO Ensure that the write has been written to at least 2 node's commit log and memory table - /// THREE Ensure that the write has been written to at least 3 node's commit log and memory table - /// QUORUM Ensure that the write has been written to - /// - /// / 2 + 1 nodes - /// LOCAL_QUORUM Ensure that the write has been written to - /// - /// / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) - /// EACH_QUORUM Ensure that the write has been written to - /// - /// / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) - /// ALL Ensure that the write is written to <ReplicationFactor> nodes - /// before responding to the client. - /// Read consistency levels make the following guarantees before returning successful results to the - /// client: - /// ANY Not supported. You probably want ONE instead. - /// ONE Returns the record obtained from a single replica. - /// TWO Returns the record with the most recent timestamp once two replicas have replied. - /// THREE Returns the record with the most recent timestamp once three replicas have replied. - /// QUORUM Returns the record with the most recent timestamp once a majority of replicas have - /// replied. - /// LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within - /// the local datacenter have replied. - /// EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within - /// each datacenter have replied. - /// ALL Returns the record with the most recent timestamp once all replicas have replied - /// (implies no replica may be down).. - /// - public enum ConsistencyLevel - { - ONE = 1, - QUORUM = 2, - LOCAL_QUORUM = 3, - EACH_QUORUM = 4, - ALL = 5, - ANY = 6, - TWO = 7, - THREE = 8, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs deleted file mode 100644 index cf2a88405b0..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterColumn.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CounterColumn : TBase - { - public CounterColumn() - { - } - - public CounterColumn(byte[] name, long value) : this() - { - this.Name = name; - this.Value = value; - } - - [DataMember(Order = 0)] - public byte[] Name { get; set; } - - [DataMember(Order = 0)] - public long Value { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - bool isset_value = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadBinaryAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I64) - { - Value = await iprot.ReadI64Async(cancellationToken); - isset_value = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_value) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CounterColumn"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "value"; - field.Type = TType.I64; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Value, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CounterColumn("); - sb.Append(", Name: "); - sb.Append(Name); - sb.Append(", Value: "); - sb.Append(Value); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs deleted file mode 100644 index ceeb5db03fa..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CounterSuperColumn.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CounterSuperColumn : TBase - { - public CounterSuperColumn() - { - } - - public CounterSuperColumn(byte[] name, List columns) : this() - { - this.Name = name; - this.Columns = columns; - } - - [DataMember(Order = 0)] - public byte[] Name { get; set; } - - [DataMember(Order = 0)] - public List Columns { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - bool isset_columns = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadBinaryAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Columns = new List(); - TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i5 = 0; _i5 < _list4.Count; ++_i5) - { - CounterColumn _elem6; - _elem6 = new CounterColumn(); - await _elem6.ReadAsync(iprot, cancellationToken); - Columns.Add(_elem6); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_columns = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_columns) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CounterSuperColumn"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "columns"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); - foreach (CounterColumn _iter7 in Columns) - { - await _iter7.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CounterSuperColumn("); - sb.Append(", Name: "); - sb.Append(Name); - sb.Append(", Columns: "); - sb.Append(Columns); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs deleted file mode 100644 index 8a3157bfda1..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlMetadata.cs +++ /dev/null @@ -1,264 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CqlMetadata : TBase - { - public CqlMetadata() - { - } - - public CqlMetadata(Dictionary name_types, Dictionary value_types, - string default_name_type, string default_value_type) : this() - { - this.Name_types = name_types; - this.Value_types = value_types; - this.Default_name_type = default_name_type; - this.Default_value_type = default_value_type; - } - - [DataMember(Order = 0)] - public Dictionary Name_types { get; set; } - - [DataMember(Order = 0)] - public Dictionary Value_types { get; set; } - - [DataMember(Order = 0)] - public string Default_name_type { get; set; } - - [DataMember(Order = 0)] - public string Default_value_type { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name_types = false; - bool isset_value_types = false; - bool isset_default_name_type = false; - bool isset_default_value_type = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Name_types = new Dictionary(); - TMap _map69 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i70 = 0; _i70 < _map69.Count; ++_i70) - { - byte[] _key71; - string _val72; - _key71 = await iprot.ReadBinaryAsync(cancellationToken); - _val72 = await iprot.ReadStringAsync(cancellationToken); - Name_types[_key71] = _val72; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - isset_name_types = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Map) - { - { - Value_types = new Dictionary(); - TMap _map73 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i74 = 0; _i74 < _map73.Count; ++_i74) - { - byte[] _key75; - string _val76; - _key75 = await iprot.ReadBinaryAsync(cancellationToken); - _val76 = await iprot.ReadStringAsync(cancellationToken); - Value_types[_key75] = _val76; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - isset_value_types = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Default_name_type = await iprot.ReadStringAsync(cancellationToken); - isset_default_name_type = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Default_value_type = await iprot.ReadStringAsync(cancellationToken); - isset_default_value_type = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name_types) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_value_types) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_default_name_type) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_default_value_type) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CqlMetadata"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name_types"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Name_types.Count), - cancellationToken); - foreach (byte[] _iter77 in Name_types.Keys) - { - await oprot.WriteBinaryAsync(_iter77, cancellationToken); - await oprot.WriteStringAsync(Name_types[_iter77], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "value_types"; - field.Type = TType.Map; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Value_types.Count), - cancellationToken); - foreach (byte[] _iter78 in Value_types.Keys) - { - await oprot.WriteBinaryAsync(_iter78, cancellationToken); - await oprot.WriteStringAsync(Value_types[_iter78], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "default_name_type"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Default_name_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "default_value_type"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Default_value_type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CqlMetadata("); - sb.Append(", Name_types: "); - sb.Append(Name_types); - sb.Append(", Value_types: "); - sb.Append(Value_types); - sb.Append(", Default_name_type: "); - sb.Append(Default_name_type); - sb.Append(", Default_value_type: "); - sb.Append(Default_value_type); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs deleted file mode 100644 index d3feb18d739..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlPreparedResult.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CqlPreparedResult : TBase - { - public CqlPreparedResult() - { - } - - public CqlPreparedResult(int itemId, int count) : this() - { - this.ItemId = itemId; - this.Count = count; - } - - [DataMember(Order = 0)] - public int ItemId { get; set; } - - [DataMember(Order = 0)] - public int Count { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_itemId = false; - bool isset_count = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ItemId = await iprot.ReadI32Async(cancellationToken); - isset_itemId = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Count = await iprot.ReadI32Async(cancellationToken); - isset_count = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_itemId) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_count) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CqlPreparedResult"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "itemId"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ItemId, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "count"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Count, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CqlPreparedResult("); - sb.Append(", ItemId: "); - sb.Append(ItemId); - sb.Append(", Count: "); - sb.Append(Count); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs deleted file mode 100644 index 5c51f7ef62a..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResult.cs +++ /dev/null @@ -1,295 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class CqlResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _num; - private List _rows; - private CqlMetadata _schema; - - public CqlResult() - { - } - - public CqlResult(CqlResultType type) : this() - { - this.Type = type; - } - - /// - /// - /// - [DataMember(Order = 0)] - public CqlResultType Type { get; set; } - - [DataMember(Order = 0)] - public List Rows - { - get { return _rows; } - set - { - __isset.rows = true; - this._rows = value; - } - } - - [DataMember(Order = 0)] - public int Num - { - get { return _num; } - set - { - __isset.num = true; - this._num = value; - } - } - - [DataMember(Order = 0)] - public CqlMetadata Schema - { - get { return _schema; } - set - { - __isset.schema = true; - this._schema = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_type = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Type = (CqlResultType) await iprot.ReadI32Async(cancellationToken); - isset_type = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Rows = new List(); - TList _list79 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i80 = 0; _i80 < _list79.Count; ++_i80) - { - CqlRow _elem81; - _elem81 = new CqlRow(); - await _elem81.ReadAsync(iprot, cancellationToken); - Rows.Add(_elem81); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Num = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Struct) - { - Schema = new CqlMetadata(); - await Schema.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_type) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CqlResult"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "type"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Rows != null && __isset.rows) - { - field.Name = "rows"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Rows.Count), cancellationToken); - foreach (CqlRow _iter82 in Rows) - { - await _iter82.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.num) - { - field.Name = "num"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Num, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Schema != null && __isset.schema) - { - field.Name = "schema"; - field.Type = TType.Struct; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Schema.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CqlResult("); - sb.Append(", Type: "); - sb.Append(Type); - if (Rows != null && __isset.rows) - { - sb.Append(", Rows: "); - sb.Append(Rows); - } - if (__isset.num) - { - sb.Append(", Num: "); - sb.Append(Num); - } - if (Schema != null && __isset.schema) - { - sb.Append(", Schema: "); - sb.Append(Schema == null ? "" : Schema.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool rows; - [DataMember] public bool num; - [DataMember] public bool schema; - } - - #region XmlSerializer support - - public bool ShouldSerializeRows() - { - return __isset.rows; - } - - public bool ShouldSerializeNum() - { - return __isset.num; - } - - public bool ShouldSerializeSchema() - { - return __isset.schema; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs deleted file mode 100644 index f100d01d5df..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlResultType.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Apache.Cassandra.Test -{ - public enum CqlResultType - { - ROWS = 1, - VOID = 2, - INT = 3, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs deleted file mode 100644 index 54811e7630a..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/CqlRow.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Row returned from a CQL query - /// - [DataContract(Namespace = "")] - public partial class CqlRow : TBase - { - public CqlRow() - { - } - - public CqlRow(byte[] key, List columns) : this() - { - this.Key = key; - this.Columns = columns; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public List Columns { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_columns = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Columns = new List(); - TList _list65 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i66 = 0; _i66 < _list65.Count; ++_i66) - { - Column _elem67; - _elem67 = new Column(); - await _elem67.ReadAsync(iprot, cancellationToken); - Columns.Add(_elem67); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_columns = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_columns) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CqlRow"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "columns"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); - foreach (Column _iter68 in Columns) - { - await _iter68.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CqlRow("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Columns: "); - sb.Append(Columns); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs deleted file mode 100644 index 5f630d7e2b7..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Deletion.cs +++ /dev/null @@ -1,261 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Note that the timestamp is only optional in case of counter deletion. - /// - [DataContract(Namespace = "")] - public partial class Deletion : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private SlicePredicate _predicate; - private byte[] _super_column; - private long _timestamp; - - public Deletion() - { - } - - [DataMember(Order = 0)] - public long Timestamp - { - get { return _timestamp; } - set - { - __isset.timestamp = true; - this._timestamp = value; - } - } - - [DataMember(Order = 0)] - public byte[] Super_column - { - get { return _super_column; } - set - { - __isset.super_column = true; - this._super_column = value; - } - } - - [DataMember(Order = 0)] - public SlicePredicate Predicate - { - get { return _predicate; } - set - { - __isset.predicate = true; - this._predicate = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I64) - { - Timestamp = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Super_column = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Struct) - { - Predicate = new SlicePredicate(); - await Predicate.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Deletion"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.timestamp) - { - field.Name = "timestamp"; - field.Type = TType.I64; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Timestamp, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Super_column != null && __isset.super_column) - { - field.Name = "super_column"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Super_column, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Predicate != null && __isset.predicate) - { - field.Name = "predicate"; - field.Type = TType.Struct; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Predicate.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Deletion("); - bool __first = true; - if (__isset.timestamp) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Timestamp: "); - sb.Append(Timestamp); - } - if (Super_column != null && __isset.super_column) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Super_column: "); - sb.Append(Super_column); - } - if (Predicate != null && __isset.predicate) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Predicate: "); - sb.Append(Predicate == null ? "" : Predicate.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool timestamp; - [DataMember] public bool super_column; - [DataMember] public bool predicate; - } - - #region XmlSerializer support - - public bool ShouldSerializeTimestamp() - { - return __isset.timestamp; - } - - public bool ShouldSerializeSuper_column() - { - return __isset.super_column; - } - - public bool ShouldSerializePredicate() - { - return __isset.predicate; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs deleted file mode 100644 index dc49650cb9f..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/EndpointDetails.cs +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class EndpointDetails : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _datacenter; - private string _host; - private string _rack; - - public EndpointDetails() - { - } - - [DataMember(Order = 0)] - public string Host - { - get { return _host; } - set - { - __isset.host = true; - this._host = value; - } - } - - [DataMember(Order = 0)] - public string Datacenter - { - get { return _datacenter; } - set - { - __isset.datacenter = true; - this._datacenter = value; - } - } - - [DataMember(Order = 0)] - public string Rack - { - get { return _rack; } - set - { - __isset.rack = true; - this._rack = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Host = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Datacenter = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Rack = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("EndpointDetails"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Host != null && __isset.host) - { - field.Name = "host"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Host, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Datacenter != null && __isset.datacenter) - { - field.Name = "datacenter"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Datacenter, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Rack != null && __isset.rack) - { - field.Name = "rack"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Rack, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("EndpointDetails("); - bool __first = true; - if (Host != null && __isset.host) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Host: "); - sb.Append(Host); - } - if (Datacenter != null && __isset.datacenter) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Datacenter: "); - sb.Append(Datacenter); - } - if (Rack != null && __isset.rack) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Rack: "); - sb.Append(Rack); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool host; - [DataMember] public bool datacenter; - [DataMember] public bool rack; - } - - #region XmlSerializer support - - public bool ShouldSerializeHost() - { - return __isset.host; - } - - public bool ShouldSerializeDatacenter() - { - return __isset.datacenter; - } - - public bool ShouldSerializeRack() - { - return __isset.rack; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs deleted file mode 100644 index 312fcc76a86..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexClause.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class IndexClause : TBase - { - public IndexClause() - { - this.Count = 100; - } - - public IndexClause(List expressions, byte[] start_key, int count) : this() - { - this.Expressions = expressions; - this.Start_key = start_key; - this.Count = count; - } - - [DataMember(Order = 0)] - public List Expressions { get; set; } - - [DataMember(Order = 0)] - public byte[] Start_key { get; set; } - - [DataMember(Order = 0)] - public int Count { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_expressions = false; - bool isset_start_key = false; - bool isset_count = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Expressions = new List(); - TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i13 = 0; _i13 < _list12.Count; ++_i13) - { - IndexExpression _elem14; - _elem14 = new IndexExpression(); - await _elem14.ReadAsync(iprot, cancellationToken); - Expressions.Add(_elem14); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_expressions = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Start_key = await iprot.ReadBinaryAsync(cancellationToken); - isset_start_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Count = await iprot.ReadI32Async(cancellationToken); - isset_count = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_expressions) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_start_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_count) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("IndexClause"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "expressions"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Expressions.Count), cancellationToken); - foreach (IndexExpression _iter15 in Expressions) - { - await _iter15.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "start_key"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Start_key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "count"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Count, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("IndexClause("); - sb.Append(", Expressions: "); - sb.Append(Expressions); - sb.Append(", Start_key: "); - sb.Append(Start_key); - sb.Append(", Count: "); - sb.Append(Count); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs deleted file mode 100644 index a4c25ed83c2..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexExpression.cs +++ /dev/null @@ -1,194 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class IndexExpression : TBase - { - public IndexExpression() - { - } - - public IndexExpression(byte[] column_name, IndexOperator op, byte[] value) : this() - { - this.Column_name = column_name; - this.Op = op; - this.Value = value; - } - - [DataMember(Order = 0)] - public byte[] Column_name { get; set; } - - /// - /// - /// - [DataMember(Order = 0)] - public IndexOperator Op { get; set; } - - [DataMember(Order = 0)] - public byte[] Value { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_column_name = false; - bool isset_op = false; - bool isset_value = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Column_name = await iprot.ReadBinaryAsync(cancellationToken); - isset_column_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Op = (IndexOperator) await iprot.ReadI32Async(cancellationToken); - isset_op = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Value = await iprot.ReadBinaryAsync(cancellationToken); - isset_value = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_column_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_op) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_value) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("IndexExpression"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "column_name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Column_name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "op"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Op, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "value"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Value, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("IndexExpression("); - sb.Append(", Column_name: "); - sb.Append(Column_name); - sb.Append(", Op: "); - sb.Append(Op); - sb.Append(", Value: "); - sb.Append(Value); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs deleted file mode 100644 index a65c588ff8d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexOperator.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Apache.Cassandra.Test -{ - public enum IndexOperator - { - EQ = 0, - GTE = 1, - GT = 2, - LTE = 3, - LT = 4, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs deleted file mode 100644 index 5003559face..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/IndexType.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Apache.Cassandra.Test -{ - public enum IndexType - { - KEYS = 0, - CUSTOM = 1, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs deleted file mode 100644 index d4302b4d009..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/InvalidRequestException.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a - /// parameter is malformed. - /// why contains an associated error message. - /// - public partial class InvalidRequestException : TException, TBase - { - public InvalidRequestException() - { - } - - public InvalidRequestException(string why) : this() - { - this.Why = why; - } - - [DataMember(Order = 0)] - public string Why { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_why = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Why = await iprot.ReadStringAsync(cancellationToken); - isset_why = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_why) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("InvalidRequestException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "why"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Why, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("InvalidRequestException("); - sb.Append(", Why: "); - sb.Append(Why); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class InvalidRequestExceptionFault - { - private string _why; - - [DataMember(Order = 0)] - public string Why { get; set; } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs deleted file mode 100644 index e0ea6dcd7ad..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyCount.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class KeyCount : TBase - { - public KeyCount() - { - } - - public KeyCount(byte[] key, int count) : this() - { - this.Key = key; - this.Count = count; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public int Count { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_count = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Count = await iprot.ReadI32Async(cancellationToken); - isset_count = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_count) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("KeyCount"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "count"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Count, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("KeyCount("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Count: "); - sb.Append(Count); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs deleted file mode 100644 index 003306d7d5d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeyRange.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// The semantics of start keys and tokens are slightly different. - /// Keys are start-inclusive; tokens are start-exclusive. Token - /// ranges may also wrap -- that is, the end token may be less - /// than the start one. Thus, a range from keyX to keyX is a - /// one-element range, but a range from tokenY to tokenY is the - /// full ring. - /// - [DataContract(Namespace = "")] - public partial class KeyRange : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _end_key; - private string _end_token; - private byte[] _start_key; - private string _start_token; - - public KeyRange() - { - this.Count = 100; - } - - public KeyRange(int count) : this() - { - this.Count = count; - } - - [DataMember(Order = 0)] - public byte[] Start_key - { - get { return _start_key; } - set - { - __isset.start_key = true; - this._start_key = value; - } - } - - [DataMember(Order = 0)] - public byte[] End_key - { - get { return _end_key; } - set - { - __isset.end_key = true; - this._end_key = value; - } - } - - [DataMember(Order = 0)] - public string Start_token - { - get { return _start_token; } - set - { - __isset.start_token = true; - this._start_token = value; - } - } - - [DataMember(Order = 0)] - public string End_token - { - get { return _end_token; } - set - { - __isset.end_token = true; - this._end_token = value; - } - } - - [DataMember(Order = 0)] - public int Count { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_count = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Start_key = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - End_key = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Start_token = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - End_token = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.I32) - { - Count = await iprot.ReadI32Async(cancellationToken); - isset_count = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_count) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("KeyRange"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Start_key != null && __isset.start_key) - { - field.Name = "start_key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Start_key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (End_key != null && __isset.end_key) - { - field.Name = "end_key"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(End_key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Start_token != null && __isset.start_token) - { - field.Name = "start_token"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Start_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (End_token != null && __isset.end_token) - { - field.Name = "end_token"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(End_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "count"; - field.Type = TType.I32; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Count, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("KeyRange("); - bool __first = true; - if (Start_key != null && __isset.start_key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Start_key: "); - sb.Append(Start_key); - } - if (End_key != null && __isset.end_key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("End_key: "); - sb.Append(End_key); - } - if (Start_token != null && __isset.start_token) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Start_token: "); - sb.Append(Start_token); - } - if (End_token != null && __isset.end_token) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("End_token: "); - sb.Append(End_token); - } - if (!__first) - { - sb.Append(", "); - } - sb.Append("Count: "); - sb.Append(Count); - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool start_key; - [DataMember] public bool end_key; - [DataMember] public bool start_token; - [DataMember] public bool end_token; - } - - #region XmlSerializer support - - public bool ShouldSerializeStart_key() - { - return __isset.start_key; - } - - public bool ShouldSerializeEnd_key() - { - return __isset.end_key; - } - - public bool ShouldSerializeStart_token() - { - return __isset.start_token; - } - - public bool ShouldSerializeEnd_token() - { - return __isset.end_token; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs deleted file mode 100644 index b1477294b8b..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KeySlice.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A KeySlice is key followed by the data it maps to. A collection of KeySlice is returned by the get_range_slice - /// operation. - /// @param key. a row key - /// @param columns. List of data represented by the key. Typically, the list is pared down to only the columns - /// specified by - /// a SlicePredicate. - /// - [DataContract(Namespace = "")] - public partial class KeySlice : TBase - { - public KeySlice() - { - } - - public KeySlice(byte[] key, List columns) : this() - { - this.Key = key; - this.Columns = columns; - } - - [DataMember(Order = 0)] - public byte[] Key { get; set; } - - [DataMember(Order = 0)] - public List Columns { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_key = false; - bool isset_columns = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadBinaryAsync(cancellationToken); - isset_key = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Columns = new List(); - TList _list16 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i17 = 0; _i17 < _list16.Count; ++_i17) - { - ColumnOrSuperColumn _elem18; - _elem18 = new ColumnOrSuperColumn(); - await _elem18.ReadAsync(iprot, cancellationToken); - Columns.Add(_elem18); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_columns = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_key) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_columns) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("KeySlice"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "columns"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); - foreach (ColumnOrSuperColumn _iter19 in Columns) - { - await _iter19.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("KeySlice("); - sb.Append(", Key: "); - sb.Append(Key); - sb.Append(", Columns: "); - sb.Append(Columns); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs deleted file mode 100644 index ed8a3eed6fb..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/KsDef.cs +++ /dev/null @@ -1,374 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - [DataContract(Namespace = "")] - public partial class KsDef : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private bool _durable_writes; - private int _replication_factor; - private Dictionary _strategy_options; - - public KsDef() - { - this._durable_writes = true; - this.__isset.durable_writes = true; - } - - public KsDef(string name, string strategy_class, List cf_defs) : this() - { - this.Name = name; - this.Strategy_class = strategy_class; - this.Cf_defs = cf_defs; - } - - [DataMember(Order = 0)] - public string Name { get; set; } - - [DataMember(Order = 0)] - public string Strategy_class { get; set; } - - [DataMember(Order = 0)] - public Dictionary Strategy_options - { - get { return _strategy_options; } - set - { - __isset.strategy_options = true; - this._strategy_options = value; - } - } - - /// - /// @deprecated - /// - [DataMember(Order = 0)] - public int Replication_factor - { - get { return _replication_factor; } - set - { - __isset.replication_factor = true; - this._replication_factor = value; - } - } - - [DataMember(Order = 0)] - public List Cf_defs { get; set; } - - [DataMember(Order = 0)] - public bool Durable_writes - { - get { return _durable_writes; } - set - { - __isset.durable_writes = true; - this._durable_writes = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - bool isset_strategy_class = false; - bool isset_cf_defs = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadStringAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Strategy_class = await iprot.ReadStringAsync(cancellationToken); - isset_strategy_class = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Map) - { - { - Strategy_options = new Dictionary(); - TMap _map56 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i57 = 0; _i57 < _map56.Count; ++_i57) - { - string _key58; - string _val59; - _key58 = await iprot.ReadStringAsync(cancellationToken); - _val59 = await iprot.ReadStringAsync(cancellationToken); - Strategy_options[_key58] = _val59; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Replication_factor = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.List) - { - { - Cf_defs = new List(); - TList _list60 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i61 = 0; _i61 < _list60.Count; ++_i61) - { - CfDef _elem62; - _elem62 = new CfDef(); - await _elem62.ReadAsync(iprot, cancellationToken); - Cf_defs.Add(_elem62); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_cf_defs = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.Bool) - { - Durable_writes = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_strategy_class) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_cf_defs) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("KsDef"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "strategy_class"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Strategy_class, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - if (Strategy_options != null && __isset.strategy_options) - { - field.Name = "strategy_options"; - field.Type = TType.Map; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Strategy_options.Count), - cancellationToken); - foreach (string _iter63 in Strategy_options.Keys) - { - await oprot.WriteStringAsync(_iter63, cancellationToken); - await oprot.WriteStringAsync(Strategy_options[_iter63], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.replication_factor) - { - field.Name = "replication_factor"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Replication_factor, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "cf_defs"; - field.Type = TType.List; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Cf_defs.Count), cancellationToken); - foreach (CfDef _iter64 in Cf_defs) - { - await _iter64.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - if (__isset.durable_writes) - { - field.Name = "durable_writes"; - field.Type = TType.Bool; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Durable_writes, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("KsDef("); - sb.Append(", Name: "); - sb.Append(Name); - sb.Append(", Strategy_class: "); - sb.Append(Strategy_class); - if (Strategy_options != null && __isset.strategy_options) - { - sb.Append(", Strategy_options: "); - sb.Append(Strategy_options); - } - if (__isset.replication_factor) - { - sb.Append(", Replication_factor: "); - sb.Append(Replication_factor); - } - sb.Append(", Cf_defs: "); - sb.Append(Cf_defs); - if (__isset.durable_writes) - { - sb.Append(", Durable_writes: "); - sb.Append(Durable_writes); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool strategy_options; - [DataMember] public bool replication_factor; - [DataMember] public bool durable_writes; - } - - #region XmlSerializer support - - public bool ShouldSerializeStrategy_options() - { - return __isset.strategy_options; - } - - public bool ShouldSerializeReplication_factor() - { - return __isset.replication_factor; - } - - public bool ShouldSerializeDurable_writes() - { - return __isset.durable_writes; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs deleted file mode 100644 index 5c81ee53557..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/Mutation.cs +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling - /// the deletion attribute). - /// @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn) - /// @param deletion. A deletion of a column or supercolumn - /// - [DataContract(Namespace = "")] - public partial class Mutation : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private ColumnOrSuperColumn _column_or_supercolumn; - private Deletion _deletion; - - public Mutation() - { - } - - [DataMember(Order = 0)] - public ColumnOrSuperColumn Column_or_supercolumn - { - get { return _column_or_supercolumn; } - set - { - __isset.column_or_supercolumn = true; - this._column_or_supercolumn = value; - } - } - - [DataMember(Order = 0)] - public Deletion Deletion - { - get { return _deletion; } - set - { - __isset.deletion = true; - this._deletion = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Column_or_supercolumn = new ColumnOrSuperColumn(); - await Column_or_supercolumn.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Deletion = new Deletion(); - await Deletion.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Mutation"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Column_or_supercolumn != null && __isset.column_or_supercolumn) - { - field.Name = "column_or_supercolumn"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Column_or_supercolumn.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Deletion != null && __isset.deletion) - { - field.Name = "deletion"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Deletion.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Mutation("); - bool __first = true; - if (Column_or_supercolumn != null && __isset.column_or_supercolumn) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Column_or_supercolumn: "); - sb.Append(Column_or_supercolumn == null ? "" : Column_or_supercolumn.ToString()); - } - if (Deletion != null && __isset.deletion) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Deletion: "); - sb.Append(Deletion == null ? "" : Deletion.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool column_or_supercolumn; - [DataMember] public bool deletion; - } - - #region XmlSerializer support - - public bool ShouldSerializeColumn_or_supercolumn() - { - return __isset.column_or_supercolumn; - } - - public bool ShouldSerializeDeletion() - { - return __isset.deletion; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs deleted file mode 100644 index c6f0df567b1..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/NotFoundException.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A specific column was requested that does not exist. - /// - public partial class NotFoundException : TException, TBase - { - public NotFoundException() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NotFoundException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NotFoundException("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class NotFoundExceptionFault - { - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs deleted file mode 100644 index e05fa25ec52..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SchemaDisagreementException.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// schemas are not in agreement across all nodes - /// - public partial class SchemaDisagreementException : TException, TBase - { - public SchemaDisagreementException() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("SchemaDisagreementException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("SchemaDisagreementException("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class SchemaDisagreementExceptionFault - { - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs deleted file mode 100644 index 01a2dd06a7e..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SlicePredicate.cs +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A SlicePredicate is similar to a mathematic predicate (see - /// http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)), - /// which is described as "a property that the elements of a set have in common." - /// SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange. If column_names is - /// specified, slice_range is ignored. - /// @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature - /// to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack', - /// and 'Jim' you can pass those column names as a list to fetch all three at once. - /// @param slice_range. A SliceRange describing how to range, order, and/or limit the slice. - /// - [DataContract(Namespace = "")] - public partial class SlicePredicate : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List _column_names; - private SliceRange _slice_range; - - public SlicePredicate() - { - } - - [DataMember(Order = 0)] - public List Column_names - { - get { return _column_names; } - set - { - __isset.column_names = true; - this._column_names = value; - } - } - - [DataMember(Order = 0)] - public SliceRange Slice_range - { - get { return _slice_range; } - set - { - __isset.slice_range = true; - this._slice_range = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Column_names = new List(); - TList _list8 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i9 = 0; _i9 < _list8.Count; ++_i9) - { - byte[] _elem10; - _elem10 = await iprot.ReadBinaryAsync(cancellationToken); - Column_names.Add(_elem10); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Slice_range = new SliceRange(); - await Slice_range.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("SlicePredicate"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Column_names != null && __isset.column_names) - { - field.Name = "column_names"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Column_names.Count), cancellationToken); - foreach (byte[] _iter11 in Column_names) - { - await oprot.WriteBinaryAsync(_iter11, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Slice_range != null && __isset.slice_range) - { - field.Name = "slice_range"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Slice_range.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("SlicePredicate("); - bool __first = true; - if (Column_names != null && __isset.column_names) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Column_names: "); - sb.Append(Column_names); - } - if (Slice_range != null && __isset.slice_range) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Slice_range: "); - sb.Append(Slice_range == null ? "" : Slice_range.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool column_names; - [DataMember] public bool slice_range; - } - - #region XmlSerializer support - - public bool ShouldSerializeColumn_names() - { - return __isset.column_names; - } - - public bool ShouldSerializeSlice_range() - { - return __isset.slice_range; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs deleted file mode 100644 index 634f15d98a3..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SliceRange.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A slice range is a structure that stores basic range, ordering and limit information for a query that will return - /// multiple columns. It could be thought of as Cassandra's version of LIMIT and ORDER BY - /// @param start. The column name to start the slice with. This attribute is not required, though there is no default - /// value, - /// and can be safely set to '', i.e., an empty byte array, to start with the first column name. Otherwise, it - /// must a valid value under the rules of the Comparator defined for the given ColumnFamily. - /// @param finish. The column name to stop the slice at. This attribute is not required, though there is no default - /// value, - /// and can be safely set to an empty byte array to not stop until 'count' results are seen. Otherwise, it - /// must also be a valid value to the ColumnFamily Comparator. - /// @param reversed. Whether the results should be ordered in reversed order. Similar to ORDER BY blah DESC in SQL. - /// @param count. How many columns to return. Similar to LIMIT in SQL. May be arbitrarily large, but Thrift will - /// materialize the whole result into memory before returning it to the client, so be aware that you may - /// be better served by iterating through slices by passing the last value of one call in as the 'start' - /// of the next instead of increasing 'count' arbitrarily large. - /// - [DataContract(Namespace = "")] - public partial class SliceRange : TBase - { - public SliceRange() - { - this.Reversed = false; - this.Count = 100; - } - - public SliceRange(byte[] start, byte[] finish, bool reversed, int count) : this() - { - this.Start = start; - this.Finish = finish; - this.Reversed = reversed; - this.Count = count; - } - - [DataMember(Order = 0)] - public byte[] Start { get; set; } - - [DataMember(Order = 0)] - public byte[] Finish { get; set; } - - [DataMember(Order = 0)] - public bool Reversed { get; set; } - - [DataMember(Order = 0)] - public int Count { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_start = false; - bool isset_finish = false; - bool isset_reversed = false; - bool isset_count = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Start = await iprot.ReadBinaryAsync(cancellationToken); - isset_start = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Finish = await iprot.ReadBinaryAsync(cancellationToken); - isset_finish = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Bool) - { - Reversed = await iprot.ReadBoolAsync(cancellationToken); - isset_reversed = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Count = await iprot.ReadI32Async(cancellationToken); - isset_count = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_start) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_finish) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_reversed) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_count) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("SliceRange"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "start"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Start, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "finish"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Finish, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "reversed"; - field.Type = TType.Bool; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Reversed, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "count"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Count, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("SliceRange("); - sb.Append(", Start: "); - sb.Append(Start); - sb.Append(", Finish: "); - sb.Append(Finish); - sb.Append(", Reversed: "); - sb.Append(Reversed); - sb.Append(", Count: "); - sb.Append(Count); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs deleted file mode 100644 index be90d6f9604..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/SuperColumn.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A named list of columns. - /// @param name. see Column.name. - /// @param columns. A collection of standard Columns. The columns within a super column are defined in an adhoc - /// manner. - /// Columns within a super column do not have to have matching structures (similarly named child columns). - /// - [DataContract(Namespace = "")] - public partial class SuperColumn : TBase - { - public SuperColumn() - { - } - - public SuperColumn(byte[] name, List columns) : this() - { - this.Name = name; - this.Columns = columns; - } - - [DataMember(Order = 0)] - public byte[] Name { get; set; } - - [DataMember(Order = 0)] - public List Columns { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_name = false; - bool isset_columns = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Name = await iprot.ReadBinaryAsync(cancellationToken); - isset_name = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Columns = new List(); - TList _list0 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i1 = 0; _i1 < _list0.Count; ++_i1) - { - Column _elem2; - _elem2 = new Column(); - await _elem2.ReadAsync(iprot, cancellationToken); - Columns.Add(_elem2); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_columns = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_name) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_columns) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("SuperColumn"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "name"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Name, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "columns"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Columns.Count), cancellationToken); - foreach (Column _iter3 in Columns) - { - await _iter3.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("SuperColumn("); - sb.Append(", Name: "); - sb.Append(Name); - sb.Append(", Columns: "); - sb.Append(Columns); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs deleted file mode 100644 index e96a10ad5b5..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TimedOutException.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too - /// large. - /// - public partial class TimedOutException : TException, TBase - { - public TimedOutException() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("TimedOutException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("TimedOutException("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class TimedOutExceptionFault - { - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs deleted file mode 100644 index 275aadde7a4..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/TokenRange.cs +++ /dev/null @@ -1,348 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// A TokenRange describes part of the Cassandra ring, it is a mapping from a range to - /// endpoints responsible for that range. - /// @param start_token The first token in the range - /// @param end_token The last token in the range - /// @param endpoints The endpoints responsible for the range (listed by their configured listen_address) - /// @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address) - /// - [DataContract(Namespace = "")] - public partial class TokenRange : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List _endpoint_details; - private List _rpc_endpoints; - - public TokenRange() - { - } - - public TokenRange(string start_token, string end_token, List endpoints) : this() - { - this.Start_token = start_token; - this.End_token = end_token; - this.Endpoints = endpoints; - } - - [DataMember(Order = 0)] - public string Start_token { get; set; } - - [DataMember(Order = 0)] - public string End_token { get; set; } - - [DataMember(Order = 0)] - public List Endpoints { get; set; } - - [DataMember(Order = 0)] - public List Rpc_endpoints - { - get { return _rpc_endpoints; } - set - { - __isset.rpc_endpoints = true; - this._rpc_endpoints = value; - } - } - - [DataMember(Order = 0)] - public List Endpoint_details - { - get { return _endpoint_details; } - set - { - __isset.endpoint_details = true; - this._endpoint_details = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_start_token = false; - bool isset_end_token = false; - bool isset_endpoints = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Start_token = await iprot.ReadStringAsync(cancellationToken); - isset_start_token = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - End_token = await iprot.ReadStringAsync(cancellationToken); - isset_end_token = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.List) - { - { - Endpoints = new List(); - TList _list20 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i21 = 0; _i21 < _list20.Count; ++_i21) - { - string _elem22; - _elem22 = await iprot.ReadStringAsync(cancellationToken); - Endpoints.Add(_elem22); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_endpoints = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.List) - { - { - Rpc_endpoints = new List(); - TList _list23 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i24 = 0; _i24 < _list23.Count; ++_i24) - { - string _elem25; - _elem25 = await iprot.ReadStringAsync(cancellationToken); - Rpc_endpoints.Add(_elem25); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.List) - { - { - Endpoint_details = new List(); - TList _list26 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i27 = 0; _i27 < _list26.Count; ++_i27) - { - EndpointDetails _elem28; - _elem28 = new EndpointDetails(); - await _elem28.ReadAsync(iprot, cancellationToken); - Endpoint_details.Add(_elem28); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_start_token) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_end_token) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - if (!isset_endpoints) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("TokenRange"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "start_token"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Start_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "end_token"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(End_token, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - field.Name = "endpoints"; - field.Type = TType.List; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Endpoints.Count), cancellationToken); - foreach (string _iter29 in Endpoints) - { - await oprot.WriteStringAsync(_iter29, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - if (Rpc_endpoints != null && __isset.rpc_endpoints) - { - field.Name = "rpc_endpoints"; - field.Type = TType.List; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Rpc_endpoints.Count), cancellationToken); - foreach (string _iter30 in Rpc_endpoints) - { - await oprot.WriteStringAsync(_iter30, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Endpoint_details != null && __isset.endpoint_details) - { - field.Name = "endpoint_details"; - field.Type = TType.List; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, Endpoint_details.Count), cancellationToken); - foreach (EndpointDetails _iter31 in Endpoint_details) - { - await _iter31.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("TokenRange("); - sb.Append(", Start_token: "); - sb.Append(Start_token); - sb.Append(", End_token: "); - sb.Append(End_token); - sb.Append(", Endpoints: "); - sb.Append(Endpoints); - if (Rpc_endpoints != null && __isset.rpc_endpoints) - { - sb.Append(", Rpc_endpoints: "); - sb.Append(Rpc_endpoints); - } - if (Endpoint_details != null && __isset.endpoint_details) - { - sb.Append(", Endpoint_details: "); - sb.Append(Endpoint_details); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool rpc_endpoints; - [DataMember] public bool endpoint_details; - } - - #region XmlSerializer support - - public bool ShouldSerializeRpc_endpoints() - { - return __isset.rpc_endpoints; - } - - public bool ShouldSerializeEndpoint_details() - { - return __isset.endpoint_details; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs deleted file mode 100644 index e3f478e794c..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Apache/Cassandra/Test/UnavailableException.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Apache.Cassandra.Test -{ - /// - /// Not all the replicas required could be created and/or read. - /// - public partial class UnavailableException : TException, TBase - { - public UnavailableException() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("UnavailableException"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("UnavailableException("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract] - public partial class UnavailableExceptionFault - { - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs deleted file mode 100644 index 2cad49d3b40..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/FacebookService.cs +++ /dev/null @@ -1,3538 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Facebook.FB303.Test -{ - public partial class FacebookService - { - /// - /// Standard base service - /// - [ServiceContract(Namespace = "")] - public interface IAsync - { - /// - /// Returns a descriptive name of the service - /// - [OperationContract] - Task getNameAsync(CancellationToken cancellationToken); - - /// - /// Returns the version of the service - /// - [OperationContract] - Task getVersionAsync(CancellationToken cancellationToken); - - /// - /// Gets the status of this service - /// - [OperationContract] - Task getStatusAsync(CancellationToken cancellationToken); - - /// - /// User friendly description of status, such as why the service is in - /// the dead or warning state, or what is being started or stopped. - /// - [OperationContract] - Task getStatusDetailsAsync(CancellationToken cancellationToken); - - /// - /// Gets the counters for this service - /// - [OperationContract] - Task> getCountersAsync(CancellationToken cancellationToken); - - /// - /// Gets the value of a single counter - /// - /// - [OperationContract] - Task getCounterAsync(string key, CancellationToken cancellationToken); - - /// - /// Sets an option - /// - /// - /// - [OperationContract] - Task setOptionAsync(string key, string @value, CancellationToken cancellationToken); - - /// - /// Gets an option - /// - /// - [OperationContract] - Task getOptionAsync(string key, CancellationToken cancellationToken); - - /// - /// Gets all options - /// - [OperationContract] - Task> getOptionsAsync(CancellationToken cancellationToken); - - /// - /// Returns a CPU profile over the given time interval (client and server - /// must agree on the profile format). - /// - /// - [OperationContract] - Task getCpuProfileAsync(int profileDurationInSec, CancellationToken cancellationToken); - - /// - /// Returns the unix time that the server has been running since - /// - [OperationContract] - Task aliveSinceAsync(CancellationToken cancellationToken); - - /// - /// Tell the server to reload its configuration, reopen log files, etc - /// - [OperationContract] - Task reinitializeAsync(CancellationToken cancellationToken); - - /// - /// Suggest a shutdown to the server - /// - [OperationContract] - Task shutdownAsync(CancellationToken cancellationToken); - } - - - /// - /// Standard base service - /// - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task getNameAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getNameArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getNameResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getName failed: unknown result"); - } - - public async Task getVersionAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getVersionArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getVersionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getVersion failed: unknown result"); - } - - public async Task getStatusAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getStatusArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getStatusResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getStatus failed: unknown result"); - } - - public async Task getStatusDetailsAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getStatusDetailsArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getStatusDetailsResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getStatusDetails failed: unknown result"); - } - - public async Task> getCountersAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getCountersArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getCountersResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getCounters failed: unknown result"); - } - - public async Task getCounterAsync(string key, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getCounterArgs(); - args.Key = key; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getCounterResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getCounter failed: unknown result"); - } - - public async Task setOptionAsync(string key, string @value, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Call, SeqId), - cancellationToken); - - var args = new setOptionArgs(); - args.Key = key; - args.Value = @value; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new setOptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task getOptionAsync(string key, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getOptionArgs(); - args.Key = key; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getOptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getOption failed: unknown result"); - } - - public async Task> getOptionsAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getOptionsArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getOptionsResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getOptions failed: unknown result"); - } - - public async Task getCpuProfileAsync(int profileDurationInSec, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Call, SeqId), - cancellationToken); - - var args = new getCpuProfileArgs(); - args.ProfileDurationInSec = profileDurationInSec; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new getCpuProfileResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "getCpuProfile failed: unknown result"); - } - - public async Task aliveSinceAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Call, SeqId), - cancellationToken); - - var args = new aliveSinceArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new aliveSinceResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "aliveSince failed: unknown result"); - } - - public async Task reinitializeAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("reinitialize", TMessageType.Oneway, SeqId), - cancellationToken); - - var args = new reinitializeArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - } - - public async Task shutdownAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("shutdown", TMessageType.Oneway, SeqId), - cancellationToken); - - var args = new shutdownArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - protected Dictionary processMap_ = new Dictionary(); - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["getName"] = getName_ProcessAsync; - processMap_["getVersion"] = getVersion_ProcessAsync; - processMap_["getStatus"] = getStatus_ProcessAsync; - processMap_["getStatusDetails"] = getStatusDetails_ProcessAsync; - processMap_["getCounters"] = getCounters_ProcessAsync; - processMap_["getCounter"] = getCounter_ProcessAsync; - processMap_["setOption"] = setOption_ProcessAsync; - processMap_["getOption"] = getOption_ProcessAsync; - processMap_["getOptions"] = getOptions_ProcessAsync; - processMap_["getCpuProfile"] = getCpuProfile_ProcessAsync; - processMap_["aliveSince"] = aliveSince_ProcessAsync; - processMap_["reinitialize"] = reinitialize_ProcessAsync; - processMap_["shutdown"] = shutdown_ProcessAsync; - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task getName_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getNameArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getNameResult(); - try - { - result.Success = await _iAsync.getNameAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getName", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getVersion_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getVersionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getVersionResult(); - try - { - result.Success = await _iAsync.getVersionAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getVersion", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getStatus_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getStatusArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getStatusResult(); - try - { - result.Success = await _iAsync.getStatusAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getStatus", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getStatusDetails_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getStatusDetailsArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getStatusDetailsResult(); - try - { - result.Success = await _iAsync.getStatusDetailsAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getStatusDetails", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getCounters_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getCountersArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getCountersResult(); - try - { - result.Success = await _iAsync.getCountersAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getCounters", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getCounter_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getCounterArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getCounterResult(); - try - { - result.Success = await _iAsync.getCounterAsync(args.Key, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getCounter", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task setOption_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new setOptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new setOptionResult(); - try - { - await _iAsync.setOptionAsync(args.Key, args.Value, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("setOption", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getOption_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getOptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getOptionResult(); - try - { - result.Success = await _iAsync.getOptionAsync(args.Key, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getOption", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getOptions_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getOptionsArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getOptionsResult(); - try - { - result.Success = await _iAsync.getOptionsAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getOptions", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task getCpuProfile_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new getCpuProfileArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new getCpuProfileResult(); - try - { - result.Success = await _iAsync.getCpuProfileAsync(args.ProfileDurationInSec, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("getCpuProfile", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task aliveSince_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new aliveSinceArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new aliveSinceResult(); - try - { - result.Success = await _iAsync.aliveSinceAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("aliveSince", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task reinitialize_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new reinitializeArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - try - { - await _iAsync.reinitializeAsync(cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - } - } - - public async Task shutdown_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new shutdownArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - try - { - await _iAsync.shutdownAsync(cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - } - } - - protected delegate Task ProcessFunction( - int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - } - - - [DataContract(Namespace = "")] - public partial class getNameArgs : TBase - { - public getNameArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getName_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getName_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getNameResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public getNameResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getName_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getName_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getVersionArgs : TBase - { - public getVersionArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getVersion_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getVersion_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getVersionResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public getVersionResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getVersion_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getVersion_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getStatusArgs : TBase - { - public getStatusArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getStatus_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getStatus_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getStatusResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private fb_status _success; - - public getStatusResult() - { - } - - /// - /// - /// - [DataMember(Order = 0)] - public fb_status Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = (fb_status) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getStatus_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getStatus_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getStatusDetailsArgs : TBase - { - public getStatusDetailsArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getStatusDetails_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getStatusDetails_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getStatusDetailsResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public getStatusDetailsResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getStatusDetails_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getStatusDetails_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getCountersArgs : TBase - { - public getCountersArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCounters_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getCounters_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getCountersResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _success; - - public getCountersResult() - { - } - - [DataMember(Order = 0)] - public Dictionary Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i1 = 0; _i1 < _map0.Count; ++_i1) - { - string _key2; - long _val3; - _key2 = await iprot.ReadStringAsync(cancellationToken); - _val3 = await iprot.ReadI64Async(cancellationToken); - Success[_key2] = _val3; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCounters_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.I64, Success.Count), - cancellationToken); - foreach (string _iter4 in Success.Keys) - { - await oprot.WriteStringAsync(_iter4, cancellationToken); - await oprot.WriteI64Async(Success[_iter4], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getCounters_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getCounterArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _key; - - public getCounterArgs() - { - } - - [DataMember(Order = 0)] - public string Key - { - get { return _key; } - set - { - __isset.key = true; - this._key = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCounter_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Key != null && __isset.key) - { - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeKey() - { - return __isset.key; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getCounter_args("); - bool __first = true; - if (Key != null && __isset.key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Key: "); - sb.Append(Key); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool key; - } - } - - - [DataContract(Namespace = "")] - public partial class getCounterResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _success; - - public getCounterResult() - { - } - - [DataMember(Order = 0)] - public long Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCounter_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getCounter_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class setOptionArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _key; - private string _value; - - public setOptionArgs() - { - } - - [DataMember(Order = 0)] - public string Key - { - get { return _key; } - set - { - __isset.key = true; - this._key = value; - } - } - - [DataMember(Order = 0)] - public string Value - { - get { return _value; } - set - { - __isset.@value = true; - this._value = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Value = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("setOption_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Key != null && __isset.key) - { - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Value != null && __isset.@value) - { - field.Name = "value"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Value, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("setOption_args("); - bool __first = true; - if (Key != null && __isset.key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Key: "); - sb.Append(Key); - } - if (Value != null && __isset.@value) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Value: "); - sb.Append(Value); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool key; - [DataMember] public bool @value; - } - - #region XmlSerializer support - - public bool ShouldSerializeKey() - { - return __isset.key; - } - - public bool ShouldSerializeValue() - { - return __isset.@value; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class setOptionResult : TBase - { - public setOptionResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("setOption_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("setOption_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getOptionArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _key; - - public getOptionArgs() - { - } - - [DataMember(Order = 0)] - public string Key - { - get { return _key; } - set - { - __isset.key = true; - this._key = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Key = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getOption_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Key != null && __isset.key) - { - field.Name = "key"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeKey() - { - return __isset.key; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getOption_args("); - bool __first = true; - if (Key != null && __isset.key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Key: "); - sb.Append(Key); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool key; - } - } - - - [DataContract(Namespace = "")] - public partial class getOptionResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public getOptionResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getOption_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getOption_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getOptionsArgs : TBase - { - public getOptionsArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getOptions_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("getOptions_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class getOptionsResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _success; - - public getOptionsResult() - { - } - - [DataMember(Order = 0)] - public Dictionary Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map5 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i6 = 0; _i6 < _map5.Count; ++_i6) - { - string _key7; - string _val8; - _key7 = await iprot.ReadStringAsync(cancellationToken); - _val8 = await iprot.ReadStringAsync(cancellationToken); - Success[_key7] = _val8; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getOptions_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), - cancellationToken); - foreach (string _iter9 in Success.Keys) - { - await oprot.WriteStringAsync(_iter9, cancellationToken); - await oprot.WriteStringAsync(Success[_iter9], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getOptions_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class getCpuProfileArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _profileDurationInSec; - - public getCpuProfileArgs() - { - } - - [DataMember(Order = 0)] - public int ProfileDurationInSec - { - get { return _profileDurationInSec; } - set - { - __isset.profileDurationInSec = true; - this._profileDurationInSec = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ProfileDurationInSec = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCpuProfile_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.profileDurationInSec) - { - field.Name = "profileDurationInSec"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ProfileDurationInSec, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeProfileDurationInSec() - { - return __isset.profileDurationInSec; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getCpuProfile_args("); - bool __first = true; - if (__isset.profileDurationInSec) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("ProfileDurationInSec: "); - sb.Append(ProfileDurationInSec); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool profileDurationInSec; - } - } - - - [DataContract(Namespace = "")] - public partial class getCpuProfileResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public getCpuProfileResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("getCpuProfile_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("getCpuProfile_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class aliveSinceArgs : TBase - { - public aliveSinceArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("aliveSince_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("aliveSince_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class aliveSinceResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _success; - - public aliveSinceResult() - { - } - - [DataMember(Order = 0)] - public long Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("aliveSince_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("aliveSince_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class reinitializeArgs : TBase - { - public reinitializeArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("reinitialize_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("reinitialize_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class shutdownArgs : TBase - { - public shutdownArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("shutdown_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("shutdown_args("); - sb.Append(")"); - return sb.ToString(); - } - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs deleted file mode 100644 index 2518022b463..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/Facebook/FB303/Test/fb_status.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Facebook.FB303.Test -{ - /// - /// Common status reporting mechanism across all services - /// - public enum fb_status - { - DEAD = 0, - STARTING = 1, - ALIVE = 2, - STOPPING = 3, - STOPPED = 4, - WARNING = 5, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs deleted file mode 100644 index 08a8cdd0834..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bonk.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Bonk : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _message; - private int _type; - - public Bonk() - { - } - - [DataMember(Order = 0)] - public string Message - { - get { return _message; } - set - { - __isset.message = true; - this._message = value; - } - } - - [DataMember(Order = 0)] - public int Type - { - get { return _type; } - set - { - __isset.type = true; - this._type = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Message = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Type = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Bonk"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Message != null && __isset.message) - { - field.Name = "message"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Message, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.type) - { - field.Name = "type"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Bonk("); - bool __first = true; - if (Message != null && __isset.message) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Message: "); - sb.Append(Message); - } - if (__isset.type) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Type: "); - sb.Append(Type); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool message; - [DataMember] public bool type; - } - - #region XmlSerializer support - - public bool ShouldSerializeMessage() - { - return __isset.message; - } - - public bool ShouldSerializeType() - { - return __isset.type; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs deleted file mode 100644 index 06030a5bbf3..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/BoolTest.cs +++ /dev/null @@ -1,214 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class BoolTest : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private bool _b; - private string _s; - - public BoolTest() - { - this._b = true; - this.__isset.b = true; - this._s = "true"; - this.__isset.s = true; - } - - [DataMember(Order = 0)] - public bool B - { - get { return _b; } - set - { - __isset.b = true; - this._b = value; - } - } - - [DataMember(Order = 0)] - public string S - { - get { return _s; } - set - { - __isset.s = true; - this._s = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - B = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - S = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("BoolTest"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.b) - { - field.Name = "b"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(B, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (S != null && __isset.s) - { - field.Name = "s"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(S, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("BoolTest("); - bool __first = true; - if (__isset.b) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("B: "); - sb.Append(B); - } - if (S != null && __isset.s) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("S: "); - sb.Append(S); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool b; - [DataMember] public bool s; - } - - #region XmlSerializer support - - public bool ShouldSerializeB() - { - return __isset.b; - } - - public bool ShouldSerializeS() - { - return __isset.s; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs deleted file mode 100644 index 5e301db4605..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Bools.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Bools : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private bool _im_false; - private bool _im_true; - - public Bools() - { - } - - [DataMember(Order = 0)] - public bool Im_true - { - get { return _im_true; } - set - { - __isset.im_true = true; - this._im_true = value; - } - } - - [DataMember(Order = 0)] - public bool Im_false - { - get { return _im_false; } - set - { - __isset.im_false = true; - this._im_false = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - Im_true = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Bool) - { - Im_false = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Bools"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.im_true) - { - field.Name = "im_true"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Im_true, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.im_false) - { - field.Name = "im_false"; - field.Type = TType.Bool; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Im_false, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Bools("); - bool __first = true; - if (__isset.im_true) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Im_true: "); - sb.Append(Im_true); - } - if (__isset.im_false) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Im_false: "); - sb.Append(Im_false); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool im_true; - [DataMember] public bool im_false; - } - - #region XmlSerializer support - - public bool ShouldSerializeIm_true() - { - return __isset.im_true; - } - - public bool ShouldSerializeIm_false() - { - return __isset.im_false; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs deleted file mode 100644 index d1bbc1f4a7e..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/CrazyNesting.cs +++ /dev/null @@ -1,482 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class CrazyNesting : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _binary_field; - private THashSet _set_field; - private string _string_field; - - public CrazyNesting() - { - } - - public CrazyNesting( - List, Dictionary>>>>> list_field) - : this() - { - this.List_field = list_field; - } - - [DataMember(Order = 0)] - public string String_field - { - get { return _string_field; } - set - { - __isset.string_field = true; - this._string_field = value; - } - } - - [DataMember(Order = 0)] - public THashSet Set_field - { - get { return _set_field; } - set - { - __isset.set_field = true; - this._set_field = value; - } - } - - [DataMember(Order = 0)] - public List, Dictionary>>>>> List_field - { get; set; } - - [DataMember(Order = 0)] - public byte[] Binary_field - { - get { return _binary_field; } - set - { - __isset.binary_field = true; - this._binary_field = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_list_field = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_field = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Set) - { - { - Set_field = new THashSet(); - TSet _set9 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i10 = 0; _i10 < _set9.Count; ++_i10) - { - Insanity _elem11; - _elem11 = new Insanity(); - await _elem11.ReadAsync(iprot, cancellationToken); - Set_field.Add(_elem11); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.List) - { - { - List_field = - new List - < - Dictionary - , - Dictionary>>>>>(); - TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i13 = 0; _i13 < _list12.Count; ++_i13) - { - Dictionary - , - Dictionary>>>> _elem14; - { - _elem14 = - new Dictionary - , - Dictionary>>>>(); - TMap _map15 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i16 = 0; _i16 < _map15.Count; ++_i16) - { - THashSet _key17; - Dictionary>>> _val18; - { - _key17 = new THashSet(); - TSet _set19 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i20 = 0; _i20 < _set19.Count; ++_i20) - { - int _elem21; - _elem21 = await iprot.ReadI32Async(cancellationToken); - _key17.Add(_elem21); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - { - _val18 = - new Dictionary - >>>(); - TMap _map22 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i23 = 0; _i23 < _map22.Count; ++_i23) - { - int _key24; - THashSet>> _val25; - _key24 = await iprot.ReadI32Async(cancellationToken); - { - _val25 = new THashSet>>(); - TSet _set26 = - await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i27 = 0; _i27 < _set26.Count; ++_i27) - { - List> _elem28; - { - _elem28 = new List>(); - TList _list29 = - await - iprot.ReadListBeginAsync(cancellationToken); - for (int _i30 = 0; _i30 < _list29.Count; ++_i30) - { - Dictionary _elem31; - { - _elem31 = new Dictionary(); - TMap _map32 = - await - iprot.ReadMapBeginAsync( - cancellationToken); - for (int _i33 = 0; - _i33 < _map32.Count; - ++_i33) - { - Insanity _key34; - string _val35; - _key34 = new Insanity(); - await - _key34.ReadAsync(iprot, - cancellationToken); - _val35 = - await - iprot.ReadStringAsync( - cancellationToken); - _elem31[_key34] = _val35; - } - await - iprot.ReadMapEndAsync(cancellationToken); - } - _elem28.Add(_elem31); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _val25.Add(_elem28); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - _val18[_key24] = _val25; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - _elem14[_key17] = _val18; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - List_field.Add(_elem14); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_list_field = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Binary_field = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_list_field) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CrazyNesting"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_field != null && __isset.string_field) - { - field.Name = "string_field"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_field, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Set_field != null && __isset.set_field) - { - field.Name = "set_field"; - field.Type = TType.Set; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.Struct, Set_field.Count), cancellationToken); - foreach (Insanity _iter36 in Set_field) - { - await _iter36.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "list_field"; - field.Type = TType.List; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Map, List_field.Count), cancellationToken); - foreach ( - Dictionary, Dictionary>>>> _iter37 - in List_field) - { - { - await - oprot.WriteMapBeginAsync(new TMap(TType.Set, TType.Map, _iter37.Count), - cancellationToken); - foreach (THashSet _iter38 in _iter37.Keys) - { - { - await - oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter38.Count), cancellationToken); - foreach (int _iter39 in _iter38) - { - await oprot.WriteI32Async(_iter39, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.I32, TType.Set, _iter37[_iter38].Count), cancellationToken); - foreach (int _iter40 in _iter37[_iter38].Keys) - { - await oprot.WriteI32Async(_iter40, cancellationToken); - { - await - oprot.WriteSetBeginAsync( - new TSet(TType.List, _iter37[_iter38][_iter40].Count), - cancellationToken); - foreach ( - List> _iter41 in _iter37[_iter38][_iter40]) - { - { - await - oprot.WriteListBeginAsync(new TList(TType.Map, _iter41.Count), - cancellationToken); - foreach (Dictionary _iter42 in _iter41) - { - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.Struct, TType.String, _iter42.Count), - cancellationToken); - foreach (Insanity _iter43 in _iter42.Keys) - { - await _iter43.WriteAsync(oprot, cancellationToken); - await - oprot.WriteStringAsync(_iter42[_iter43], - cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - if (Binary_field != null && __isset.binary_field) - { - field.Name = "binary_field"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Binary_field, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CrazyNesting("); - bool __first = true; - if (String_field != null && __isset.string_field) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("String_field: "); - sb.Append(String_field); - } - if (Set_field != null && __isset.set_field) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Set_field: "); - sb.Append(Set_field); - } - if (!__first) - { - sb.Append(", "); - } - sb.Append("List_field: "); - sb.Append(List_field); - if (Binary_field != null && __isset.binary_field) - { - sb.Append(", Binary_field: "); - sb.Append(Binary_field); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool string_field; - [DataMember] public bool set_field; - [DataMember] public bool binary_field; - } - - #region XmlSerializer support - - public bool ShouldSerializeString_field() - { - return __isset.string_field; - } - - public bool ShouldSerializeSet_field() - { - return __isset.set_field; - } - - public bool ShouldSerializeBinary_field() - { - return __isset.binary_field; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs deleted file mode 100644 index 59096b47c0d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/EmptyStruct.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class EmptyStruct : TBase - { - public EmptyStruct() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("EmptyStruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("EmptyStruct("); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs deleted file mode 100644 index ed8c0e72876..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/GuessProtocolStruct.cs +++ /dev/null @@ -1,185 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class GuessProtocolStruct : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _map_field; - - public GuessProtocolStruct() - { - } - - [DataMember(Order = 0)] - public Dictionary Map_field - { - get { return _map_field; } - set - { - __isset.map_field = true; - this._map_field = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 7: - if (field.Type == TType.Map) - { - { - Map_field = new Dictionary(); - TMap _map65 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i66 = 0; _i66 < _map65.Count; ++_i66) - { - string _key67; - string _val68; - _key67 = await iprot.ReadStringAsync(cancellationToken); - _val68 = await iprot.ReadStringAsync(cancellationToken); - Map_field[_key67] = _val68; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("GuessProtocolStruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Map_field != null && __isset.map_field) - { - field.Name = "map_field"; - field.Type = TType.Map; - field.ID = 7; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Map_field.Count), - cancellationToken); - foreach (string _iter69 in Map_field.Keys) - { - await oprot.WriteStringAsync(_iter69, cancellationToken); - await oprot.WriteStringAsync(Map_field[_iter69], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeMap_field() - { - return __isset.map_field; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("GuessProtocolStruct("); - bool __first = true; - if (Map_field != null && __isset.map_field) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Map_field: "); - sb.Append(Map_field); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool map_field; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs deleted file mode 100644 index 34b2c7aedc6..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Insanity.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Insanity : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _userMap; - private List _xtructs; - - public Insanity() - { - } - - [DataMember(Order = 0)] - public Dictionary UserMap - { - get { return _userMap; } - set - { - __isset.userMap = true; - this._userMap = value; - } - } - - [DataMember(Order = 0)] - public List Xtructs - { - get { return _xtructs; } - set - { - __isset.xtructs = true; - this._xtructs = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - UserMap = new Dictionary(); - TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i1 = 0; _i1 < _map0.Count; ++_i1) - { - Numberz _key2; - long _val3; - _key2 = (Numberz) await iprot.ReadI32Async(cancellationToken); - _val3 = await iprot.ReadI64Async(cancellationToken); - UserMap[_key2] = _val3; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Xtructs = new List(); - TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i5 = 0; _i5 < _list4.Count; ++_i5) - { - Xtruct _elem6; - _elem6 = new Xtruct(); - await _elem6.ReadAsync(iprot, cancellationToken); - Xtructs.Add(_elem6); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Insanity"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (UserMap != null && __isset.userMap) - { - field.Name = "userMap"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I64, UserMap.Count), cancellationToken); - foreach (Numberz _iter7 in UserMap.Keys) - { - await oprot.WriteI32Async((int) _iter7, cancellationToken); - await oprot.WriteI64Async(UserMap[_iter7], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Xtructs != null && __isset.xtructs) - { - field.Name = "xtructs"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Xtructs.Count), cancellationToken); - foreach (Xtruct _iter8 in Xtructs) - { - await _iter8.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Insanity("); - bool __first = true; - if (UserMap != null && __isset.userMap) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("UserMap: "); - sb.Append(UserMap); - } - if (Xtructs != null && __isset.xtructs) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Xtructs: "); - sb.Append(Xtructs); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool userMap; - [DataMember] public bool xtructs; - } - - #region XmlSerializer support - - public bool ShouldSerializeUserMap() - { - return __isset.userMap; - } - - public bool ShouldSerializeXtructs() - { - return __isset.xtructs; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs deleted file mode 100644 index 0e6eccf1342..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/LargeDeltas.cs +++ /dev/null @@ -1,626 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class LargeDeltas : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private THashSet _a_set2500; - private Bools _b1; - private Bools _b10; - private Bools _b100; - private Bools _b1000; - private List _big_numbers; - private bool _check_false; - private bool _check_true; - private VersioningTestV2 _vertwo2000; - private VersioningTestV2 _vertwo3000; - - public LargeDeltas() - { - } - - [DataMember(Order = 0)] - public Bools B1 - { - get { return _b1; } - set - { - __isset.b1 = true; - this._b1 = value; - } - } - - [DataMember(Order = 0)] - public Bools B10 - { - get { return _b10; } - set - { - __isset.b10 = true; - this._b10 = value; - } - } - - [DataMember(Order = 0)] - public Bools B100 - { - get { return _b100; } - set - { - __isset.b100 = true; - this._b100 = value; - } - } - - [DataMember(Order = 0)] - public bool Check_true - { - get { return _check_true; } - set - { - __isset.check_true = true; - this._check_true = value; - } - } - - [DataMember(Order = 0)] - public Bools B1000 - { - get { return _b1000; } - set - { - __isset.b1000 = true; - this._b1000 = value; - } - } - - [DataMember(Order = 0)] - public bool Check_false - { - get { return _check_false; } - set - { - __isset.check_false = true; - this._check_false = value; - } - } - - [DataMember(Order = 0)] - public VersioningTestV2 Vertwo2000 - { - get { return _vertwo2000; } - set - { - __isset.vertwo2000 = true; - this._vertwo2000 = value; - } - } - - [DataMember(Order = 0)] - public THashSet A_set2500 - { - get { return _a_set2500; } - set - { - __isset.a_set2500 = true; - this._a_set2500 = value; - } - } - - [DataMember(Order = 0)] - public VersioningTestV2 Vertwo3000 - { - get { return _vertwo3000; } - set - { - __isset.vertwo3000 = true; - this._vertwo3000 = value; - } - } - - [DataMember(Order = 0)] - public List Big_numbers - { - get { return _big_numbers; } - set - { - __isset.big_numbers = true; - this._big_numbers = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - B1 = new Bools(); - await B1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 10: - if (field.Type == TType.Struct) - { - B10 = new Bools(); - await B10.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 100: - if (field.Type == TType.Struct) - { - B100 = new Bools(); - await B100.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 500: - if (field.Type == TType.Bool) - { - Check_true = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1000: - if (field.Type == TType.Struct) - { - B1000 = new Bools(); - await B1000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1500: - if (field.Type == TType.Bool) - { - Check_false = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2000: - if (field.Type == TType.Struct) - { - Vertwo2000 = new VersioningTestV2(); - await Vertwo2000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2500: - if (field.Type == TType.Set) - { - { - A_set2500 = new THashSet(); - TSet _set70 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i71 = 0; _i71 < _set70.Count; ++_i71) - { - string _elem72; - _elem72 = await iprot.ReadStringAsync(cancellationToken); - A_set2500.Add(_elem72); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3000: - if (field.Type == TType.Struct) - { - Vertwo3000 = new VersioningTestV2(); - await Vertwo3000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4000: - if (field.Type == TType.List) - { - { - Big_numbers = new List(); - TList _list73 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i74 = 0; _i74 < _list73.Count; ++_i74) - { - int _elem75; - _elem75 = await iprot.ReadI32Async(cancellationToken); - Big_numbers.Add(_elem75); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("LargeDeltas"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (B1 != null && __isset.b1) - { - field.Name = "b1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B10 != null && __isset.b10) - { - field.Name = "b10"; - field.Type = TType.Struct; - field.ID = 10; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B10.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B100 != null && __isset.b100) - { - field.Name = "b100"; - field.Type = TType.Struct; - field.ID = 100; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B100.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.check_true) - { - field.Name = "check_true"; - field.Type = TType.Bool; - field.ID = 500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Check_true, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B1000 != null && __isset.b1000) - { - field.Name = "b1000"; - field.Type = TType.Struct; - field.ID = 1000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B1000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.check_false) - { - field.Name = "check_false"; - field.Type = TType.Bool; - field.ID = 1500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Check_false, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Vertwo2000 != null && __isset.vertwo2000) - { - field.Name = "vertwo2000"; - field.Type = TType.Struct; - field.ID = 2000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Vertwo2000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (A_set2500 != null && __isset.a_set2500) - { - field.Name = "a_set2500"; - field.Type = TType.Set; - field.ID = 2500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.String, A_set2500.Count), cancellationToken); - foreach (string _iter76 in A_set2500) - { - await oprot.WriteStringAsync(_iter76, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Vertwo3000 != null && __isset.vertwo3000) - { - field.Name = "vertwo3000"; - field.Type = TType.Struct; - field.ID = 3000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Vertwo3000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Big_numbers != null && __isset.big_numbers) - { - field.Name = "big_numbers"; - field.Type = TType.List; - field.ID = 4000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Big_numbers.Count), cancellationToken); - foreach (int _iter77 in Big_numbers) - { - await oprot.WriteI32Async(_iter77, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("LargeDeltas("); - bool __first = true; - if (B1 != null && __isset.b1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("B1: "); - sb.Append(B1 == null ? "" : B1.ToString()); - } - if (B10 != null && __isset.b10) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("B10: "); - sb.Append(B10 == null ? "" : B10.ToString()); - } - if (B100 != null && __isset.b100) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("B100: "); - sb.Append(B100 == null ? "" : B100.ToString()); - } - if (__isset.check_true) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Check_true: "); - sb.Append(Check_true); - } - if (B1000 != null && __isset.b1000) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("B1000: "); - sb.Append(B1000 == null ? "" : B1000.ToString()); - } - if (__isset.check_false) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Check_false: "); - sb.Append(Check_false); - } - if (Vertwo2000 != null && __isset.vertwo2000) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Vertwo2000: "); - sb.Append(Vertwo2000 == null ? "" : Vertwo2000.ToString()); - } - if (A_set2500 != null && __isset.a_set2500) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("A_set2500: "); - sb.Append(A_set2500); - } - if (Vertwo3000 != null && __isset.vertwo3000) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Vertwo3000: "); - sb.Append(Vertwo3000 == null ? "" : Vertwo3000.ToString()); - } - if (Big_numbers != null && __isset.big_numbers) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Big_numbers: "); - sb.Append(Big_numbers); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool b1; - [DataMember] public bool b10; - [DataMember] public bool b100; - [DataMember] public bool check_true; - [DataMember] public bool b1000; - [DataMember] public bool check_false; - [DataMember] public bool vertwo2000; - [DataMember] public bool a_set2500; - [DataMember] public bool vertwo3000; - [DataMember] public bool big_numbers; - } - - #region XmlSerializer support - - public bool ShouldSerializeB1() - { - return __isset.b1; - } - - public bool ShouldSerializeB10() - { - return __isset.b10; - } - - public bool ShouldSerializeB100() - { - return __isset.b100; - } - - public bool ShouldSerializeCheck_true() - { - return __isset.check_true; - } - - public bool ShouldSerializeB1000() - { - return __isset.b1000; - } - - public bool ShouldSerializeCheck_false() - { - return __isset.check_false; - } - - public bool ShouldSerializeVertwo2000() - { - return __isset.vertwo2000; - } - - public bool ShouldSerializeA_set2500() - { - return __isset.a_set2500; - } - - public bool ShouldSerializeVertwo3000() - { - return __isset.vertwo3000; - } - - public bool ShouldSerializeBig_numbers() - { - return __isset.big_numbers; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs deleted file mode 100644 index 46facba9145..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListBonks.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class ListBonks : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List _bonk; - - public ListBonks() - { - } - - [DataMember(Order = 0)] - public List Bonk - { - get { return _bonk; } - set - { - __isset.bonk = true; - this._bonk = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Bonk = new List(); - TList _list128 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i129 = 0; _i129 < _list128.Count; ++_i129) - { - Bonk _elem130; - _elem130 = new Bonk(); - await _elem130.ReadAsync(iprot, cancellationToken); - Bonk.Add(_elem130); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListBonks"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Bonk != null && __isset.bonk) - { - field.Name = "bonk"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Bonk.Count), cancellationToken); - foreach (Bonk _iter131 in Bonk) - { - await _iter131.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeBonk() - { - return __isset.bonk; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("ListBonks("); - bool __first = true; - if (Bonk != null && __isset.bonk) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Bonk: "); - sb.Append(Bonk); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool bonk; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs deleted file mode 100644 index 6f489dd8ecc..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV1.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class ListTypeVersioningV1 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _hello; - private List _myints; - - public ListTypeVersioningV1() - { - } - - [DataMember(Order = 0)] - public List Myints - { - get { return _myints; } - set - { - __isset.myints = true; - this._myints = value; - } - } - - [DataMember(Order = 0)] - public string Hello - { - get { return _hello; } - set - { - __isset.hello = true; - this._hello = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Myints = new List(); - TList _list57 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i58 = 0; _i58 < _list57.Count; ++_i58) - { - int _elem59; - _elem59 = await iprot.ReadI32Async(cancellationToken); - Myints.Add(_elem59); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Hello = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListTypeVersioningV1"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Myints != null && __isset.myints) - { - field.Name = "myints"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Myints.Count), cancellationToken); - foreach (int _iter60 in Myints) - { - await oprot.WriteI32Async(_iter60, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Hello != null && __isset.hello) - { - field.Name = "hello"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ListTypeVersioningV1("); - bool __first = true; - if (Myints != null && __isset.myints) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Myints: "); - sb.Append(Myints); - } - if (Hello != null && __isset.hello) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool myints; - [DataMember] public bool hello; - } - - #region XmlSerializer support - - public bool ShouldSerializeMyints() - { - return __isset.myints; - } - - public bool ShouldSerializeHello() - { - return __isset.hello; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs deleted file mode 100644 index abaf3044a73..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ListTypeVersioningV2.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class ListTypeVersioningV2 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _hello; - private List _strings; - - public ListTypeVersioningV2() - { - } - - [DataMember(Order = 0)] - public List Strings - { - get { return _strings; } - set - { - __isset.strings = true; - this._strings = value; - } - } - - [DataMember(Order = 0)] - public string Hello - { - get { return _hello; } - set - { - __isset.hello = true; - this._hello = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Strings = new List(); - TList _list61 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i62 = 0; _i62 < _list61.Count; ++_i62) - { - string _elem63; - _elem63 = await iprot.ReadStringAsync(cancellationToken); - Strings.Add(_elem63); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Hello = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListTypeVersioningV2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Strings != null && __isset.strings) - { - field.Name = "strings"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Strings.Count), cancellationToken); - foreach (string _iter64 in Strings) - { - await oprot.WriteStringAsync(_iter64, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Hello != null && __isset.hello) - { - field.Name = "hello"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ListTypeVersioningV2("); - bool __first = true; - if (Strings != null && __isset.strings) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Strings: "); - sb.Append(Strings); - } - if (Hello != null && __isset.hello) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool strings; - [DataMember] public bool hello; - } - - #region XmlSerializer support - - public bool ShouldSerializeStrings() - { - return __isset.strings; - } - - public bool ShouldSerializeHello() - { - return __isset.hello; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs deleted file mode 100644 index 1b015cb65c5..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsBonk.cs +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class NestedListsBonk : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List>> _bonk; - - public NestedListsBonk() - { - } - - [DataMember(Order = 0)] - public List>> Bonk - { - get { return _bonk; } - set - { - __isset.bonk = true; - this._bonk = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Bonk = new List>>(); - TList _list132 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i133 = 0; _i133 < _list132.Count; ++_i133) - { - List> _elem134; - { - _elem134 = new List>(); - TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i136 = 0; _i136 < _list135.Count; ++_i136) - { - List _elem137; - { - _elem137 = new List(); - TList _list138 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i139 = 0; _i139 < _list138.Count; ++_i139) - { - Bonk _elem140; - _elem140 = new Bonk(); - await _elem140.ReadAsync(iprot, cancellationToken); - _elem137.Add(_elem140); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _elem134.Add(_elem137); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Bonk.Add(_elem134); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsBonk"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Bonk != null && __isset.bonk) - { - field.Name = "bonk"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Bonk.Count), cancellationToken); - foreach (List> _iter141 in Bonk) - { - { - await - oprot.WriteListBeginAsync(new TList(TType.List, _iter141.Count), cancellationToken); - foreach (List _iter142 in _iter141) - { - { - await - oprot.WriteListBeginAsync(new TList(TType.Struct, _iter142.Count), - cancellationToken); - foreach (Bonk _iter143 in _iter142) - { - await _iter143.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeBonk() - { - return __isset.bonk; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("NestedListsBonk("); - bool __first = true; - if (Bonk != null && __isset.bonk) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Bonk: "); - sb.Append(Bonk); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool bonk; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs deleted file mode 100644 index bbcd5528289..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x2.cs +++ /dev/null @@ -1,197 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class NestedListsI32x2 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List> _integerlist; - - public NestedListsI32x2() - { - } - - [DataMember(Order = 0)] - public List> Integerlist - { - get { return _integerlist; } - set - { - __isset.integerlist = true; - this._integerlist = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Integerlist = new List>(); - TList _list78 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i79 = 0; _i79 < _list78.Count; ++_i79) - { - List _elem80; - { - _elem80 = new List(); - TList _list81 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i82 = 0; _i82 < _list81.Count; ++_i82) - { - int _elem83; - _elem83 = await iprot.ReadI32Async(cancellationToken); - _elem80.Add(_elem83); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Integerlist.Add(_elem80); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsI32x2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Integerlist != null && __isset.integerlist) - { - field.Name = "integerlist"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); - foreach (List _iter84 in Integerlist) - { - { - await oprot.WriteListBeginAsync(new TList(TType.I32, _iter84.Count), cancellationToken); - foreach (int _iter85 in _iter84) - { - await oprot.WriteI32Async(_iter85, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeIntegerlist() - { - return __isset.integerlist; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("NestedListsI32x2("); - bool __first = true; - if (Integerlist != null && __isset.integerlist) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Integerlist: "); - sb.Append(Integerlist); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool integerlist; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs deleted file mode 100644 index 3f1a851b3e7..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedListsI32x3.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class NestedListsI32x3 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List>> _integerlist; - - public NestedListsI32x3() - { - } - - [DataMember(Order = 0)] - public List>> Integerlist - { - get { return _integerlist; } - set - { - __isset.integerlist = true; - this._integerlist = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Integerlist = new List>>(); - TList _list86 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i87 = 0; _i87 < _list86.Count; ++_i87) - { - List> _elem88; - { - _elem88 = new List>(); - TList _list89 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i90 = 0; _i90 < _list89.Count; ++_i90) - { - List _elem91; - { - _elem91 = new List(); - TList _list92 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i93 = 0; _i93 < _list92.Count; ++_i93) - { - int _elem94; - _elem94 = await iprot.ReadI32Async(cancellationToken); - _elem91.Add(_elem94); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _elem88.Add(_elem91); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Integerlist.Add(_elem88); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsI32x3"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Integerlist != null && __isset.integerlist) - { - field.Name = "integerlist"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); - foreach (List> _iter95 in Integerlist) - { - { - await oprot.WriteListBeginAsync(new TList(TType.List, _iter95.Count), cancellationToken); - foreach (List _iter96 in _iter95) - { - { - await - oprot.WriteListBeginAsync(new TList(TType.I32, _iter96.Count), - cancellationToken); - foreach (int _iter97 in _iter96) - { - await oprot.WriteI32Async(_iter97, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeIntegerlist() - { - return __isset.integerlist; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("NestedListsI32x3("); - bool __first = true; - if (Integerlist != null && __isset.integerlist) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Integerlist: "); - sb.Append(Integerlist); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool integerlist; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs deleted file mode 100644 index 77b1416aa2f..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/NestedMixedx2.cs +++ /dev/null @@ -1,391 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class NestedMixedx2 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List> _int_set_list; - private Dictionary> _map_int_strset; - private List>> _map_int_strset_list; - - public NestedMixedx2() - { - } - - [DataMember(Order = 0)] - public List> Int_set_list - { - get { return _int_set_list; } - set - { - __isset.int_set_list = true; - this._int_set_list = value; - } - } - - [DataMember(Order = 0)] - public Dictionary> Map_int_strset - { - get { return _map_int_strset; } - set - { - __isset.map_int_strset = true; - this._map_int_strset = value; - } - } - - [DataMember(Order = 0)] - public List>> Map_int_strset_list - { - get { return _map_int_strset_list; } - set - { - __isset.map_int_strset_list = true; - this._map_int_strset_list = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Int_set_list = new List>(); - TList _list98 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i99 = 0; _i99 < _list98.Count; ++_i99) - { - THashSet _elem100; - { - _elem100 = new THashSet(); - TSet _set101 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i102 = 0; _i102 < _set101.Count; ++_i102) - { - int _elem103; - _elem103 = await iprot.ReadI32Async(cancellationToken); - _elem100.Add(_elem103); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - Int_set_list.Add(_elem100); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Map) - { - { - Map_int_strset = new Dictionary>(); - TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i105 = 0; _i105 < _map104.Count; ++_i105) - { - int _key106; - THashSet _val107; - _key106 = await iprot.ReadI32Async(cancellationToken); - { - _val107 = new THashSet(); - TSet _set108 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i109 = 0; _i109 < _set108.Count; ++_i109) - { - string _elem110; - _elem110 = await iprot.ReadStringAsync(cancellationToken); - _val107.Add(_elem110); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - Map_int_strset[_key106] = _val107; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.List) - { - { - Map_int_strset_list = new List>>(); - TList _list111 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i112 = 0; _i112 < _list111.Count; ++_i112) - { - Dictionary> _elem113; - { - _elem113 = new Dictionary>(); - TMap _map114 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i115 = 0; _i115 < _map114.Count; ++_i115) - { - int _key116; - THashSet _val117; - _key116 = await iprot.ReadI32Async(cancellationToken); - { - _val117 = new THashSet(); - TSet _set118 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i119 = 0; _i119 < _set118.Count; ++_i119) - { - string _elem120; - _elem120 = await iprot.ReadStringAsync(cancellationToken); - _val117.Add(_elem120); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - _elem113[_key116] = _val117; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Map_int_strset_list.Add(_elem113); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedMixedx2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Int_set_list != null && __isset.int_set_list) - { - field.Name = "int_set_list"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Set, Int_set_list.Count), cancellationToken); - foreach (THashSet _iter121 in Int_set_list) - { - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter121.Count), cancellationToken); - foreach (int _iter122 in _iter121) - { - await oprot.WriteI32Async(_iter122, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Map_int_strset != null && __isset.map_int_strset) - { - field.Name = "map_int_strset"; - field.Type = TType.Map; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, Map_int_strset.Count), - cancellationToken); - foreach (int _iter123 in Map_int_strset.Keys) - { - await oprot.WriteI32Async(_iter123, cancellationToken); - { - await - oprot.WriteSetBeginAsync(new TSet(TType.String, Map_int_strset[_iter123].Count), - cancellationToken); - foreach (string _iter124 in Map_int_strset[_iter123]) - { - await oprot.WriteStringAsync(_iter124, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Map_int_strset_list != null && __isset.map_int_strset_list) - { - field.Name = "map_int_strset_list"; - field.Type = TType.List; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteListBeginAsync(new TList(TType.Map, Map_int_strset_list.Count), cancellationToken); - foreach (Dictionary> _iter125 in Map_int_strset_list) - { - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter125.Count), - cancellationToken); - foreach (int _iter126 in _iter125.Keys) - { - await oprot.WriteI32Async(_iter126, cancellationToken); - { - await - oprot.WriteSetBeginAsync(new TSet(TType.String, _iter125[_iter126].Count), - cancellationToken); - foreach (string _iter127 in _iter125[_iter126]) - { - await oprot.WriteStringAsync(_iter127, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NestedMixedx2("); - bool __first = true; - if (Int_set_list != null && __isset.int_set_list) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Int_set_list: "); - sb.Append(Int_set_list); - } - if (Map_int_strset != null && __isset.map_int_strset) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Map_int_strset: "); - sb.Append(Map_int_strset); - } - if (Map_int_strset_list != null && __isset.map_int_strset_list) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Map_int_strset_list: "); - sb.Append(Map_int_strset_list); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool int_set_list; - [DataMember] public bool map_int_strset; - [DataMember] public bool map_int_strset_list; - } - - #region XmlSerializer support - - public bool ShouldSerializeInt_set_list() - { - return __isset.int_set_list; - } - - public bool ShouldSerializeMap_int_strset() - { - return __isset.map_int_strset; - } - - public bool ShouldSerializeMap_int_strset_list() - { - return __isset.map_int_strset_list; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs deleted file mode 100644 index 38a514568d9..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Numberz.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace ThriftAsync.Test -{ - /// - /// Docstring! - /// - public enum Numberz - { - ONE = 1, - TWO = 2, - THREE = 3, - FIVE = 5, - SIX = 6, - EIGHT = 8, - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs deleted file mode 100644 index 9f776c1155d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/OneField.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class OneField : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private EmptyStruct _field; - - public OneField() - { - } - - [DataMember(Order = 0)] - public EmptyStruct Field - { - get { return _field; } - set - { - __isset.field = true; - this._field = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Field = new EmptyStruct(); - await Field.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("OneField"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Field != null && __isset.field) - { - field.Name = "field"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Field.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeField() - { - return __isset.field; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("OneField("); - bool __first = true; - if (Field != null && __isset.field) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Field: "); - sb.Append(Field == null ? "" : Field.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool field; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs deleted file mode 100644 index 95c1030ee44..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/SecondService.cs +++ /dev/null @@ -1,638 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - public partial class SecondService - { - [ServiceContract(Namespace = "")] - public interface IAsync - { - [OperationContract] - Task blahBlahAsync(CancellationToken cancellationToken); - - /// - /// Prints 'testString("%s")' with thing as '%s' - /// @param string thing - the string to print - /// @return string - returns the string 'thing' - /// - /// - [OperationContract] - Task secondtestStringAsync(string thing, CancellationToken cancellationToken); - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task blahBlahAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Call, SeqId), - cancellationToken); - - var args = new blahBlahArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new blahBlahResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task secondtestStringAsync(string thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Call, SeqId), - cancellationToken); - - var args = new secondtestStringArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new secondtestStringResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "secondtestString failed: unknown result"); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - protected Dictionary processMap_ = new Dictionary(); - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["blahBlah"] = blahBlah_ProcessAsync; - processMap_["secondtestString"] = secondtestString_ProcessAsync; - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task blahBlah_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new blahBlahArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new blahBlahResult(); - try - { - await _iAsync.blahBlahAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task secondtestString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new secondtestStringArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new secondtestStringResult(); - try - { - result.Success = await _iAsync.secondtestStringAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - protected delegate Task ProcessFunction( - int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - } - - - [DataContract(Namespace = "")] - public partial class blahBlahArgs : TBase - { - public blahBlahArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("blahBlah_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("blahBlah_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class blahBlahResult : TBase - { - public blahBlahResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("blahBlah_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("blahBlah_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class secondtestStringArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _thing; - - public secondtestStringArgs() - { - } - - [DataMember(Order = 0)] - public string Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("secondtestString_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("secondtestString_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class secondtestStringResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public secondtestStringResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("secondtestString_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("secondtestString_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs deleted file mode 100644 index 49f8161c513..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructA.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class StructA : TBase - { - public StructA() - { - } - - public StructA(string s) : this() - { - this.S = s; - } - - [DataMember(Order = 0)] - public string S { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_s = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - S = await iprot.ReadStringAsync(cancellationToken); - isset_s = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_s) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("StructA"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "s"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(S, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("StructA("); - sb.Append(", S: "); - sb.Append(S); - sb.Append(")"); - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs deleted file mode 100644 index 5d777e991ef..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/StructB.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class StructB : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private StructA _aa; - - public StructB() - { - } - - public StructB(StructA ab) : this() - { - this.Ab = ab; - } - - [DataMember(Order = 0)] - public StructA Aa - { - get { return _aa; } - set - { - __isset.aa = true; - this._aa = value; - } - } - - [DataMember(Order = 0)] - public StructA Ab { get; set; } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_ab = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Aa = new StructA(); - await Aa.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ab = new StructA(); - await Ab.ReadAsync(iprot, cancellationToken); - isset_ab = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_ab) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("StructB"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Aa != null && __isset.aa) - { - field.Name = "aa"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Aa.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "ab"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ab.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeAa() - { - return __isset.aa; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("StructB("); - bool __first = true; - if (Aa != null && __isset.aa) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Aa: "); - sb.Append(Aa == null ? "" : Aa.ToString()); - } - if (!__first) - { - sb.Append(", "); - } - sb.Append("Ab: "); - sb.Append(Ab == null ? "" : Ab.ToString()); - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool aa; - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs deleted file mode 100644 index 163ca55b4c3..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTest.cs +++ /dev/null @@ -1,7866 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - public partial class ThriftTest - { - [ServiceContract(Namespace = "")] - public interface IAsync - { - /// - /// Prints "testVoid()" and returns nothing. - /// - [OperationContract] - Task testVoidAsync(CancellationToken cancellationToken); - - /// - /// Prints 'testString("%s")' with thing as '%s' - /// @param string thing - the string to print - /// @return string - returns the string 'thing' - /// - /// - [OperationContract] - Task testStringAsync(string thing, CancellationToken cancellationToken); - - /// - /// Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' - /// @param bool thing - the bool data to print - /// @return bool - returns the bool 'thing' - /// - /// - [OperationContract] - Task testBoolAsync(bool thing, CancellationToken cancellationToken); - - /// - /// Prints 'testByte("%d")' with thing as '%d' - /// The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. - /// @param byte thing - the i8/byte to print - /// @return i8 - returns the i8/byte 'thing' - /// - /// - [OperationContract] - Task testByteAsync(sbyte thing, CancellationToken cancellationToken); - - /// - /// Prints 'testI32("%d")' with thing as '%d' - /// @param i32 thing - the i32 to print - /// @return i32 - returns the i32 'thing' - /// - /// - [OperationContract] - Task testI32Async(int thing, CancellationToken cancellationToken); - - /// - /// Prints 'testI64("%d")' with thing as '%d' - /// @param i64 thing - the i64 to print - /// @return i64 - returns the i64 'thing' - /// - /// - [OperationContract] - Task testI64Async(long thing, CancellationToken cancellationToken); - - /// - /// Prints 'testDouble("%f")' with thing as '%f' - /// @param double thing - the double to print - /// @return double - returns the double 'thing' - /// - /// - [OperationContract] - Task testDoubleAsync(double thing, CancellationToken cancellationToken); - - /// - /// Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data - /// @param binary thing - the binary data to print - /// @return binary - returns the binary 'thing' - /// - /// - [OperationContract] - Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken); - - /// - /// Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values - /// @param Xtruct thing - the Xtruct to print - /// @return Xtruct - returns the Xtruct 'thing' - /// - /// - [OperationContract] - Task testStructAsync(Xtruct thing, CancellationToken cancellationToken); - - /// - /// Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct - /// @param Xtruct2 thing - the Xtruct2 to print - /// @return Xtruct2 - returns the Xtruct2 'thing' - /// - /// - [OperationContract] - Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken); - - /// - /// Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs - /// separated by commas and new lines - /// @param map - /// - /// thing - the map - /// - /// to print - /// @return map - returns the map 'thing' - /// - /// - [OperationContract] - Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken); - - /// - /// Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs - /// separated by commas and new lines - /// @param map - /// - /// thing - the map - /// - /// to print - /// @return map - returns the map 'thing' - /// - /// - [OperationContract] - Task> testStringMapAsync(Dictionary thing, - CancellationToken cancellationToken); - - /// - /// Prints 'testSet("{%s}")' where thing has been formatted into a string of values - /// separated by commas and new lines - /// @param set - /// - /// thing - the set - /// - /// to print - /// @return set - returns the set 'thing' - /// - /// - [OperationContract] - Task> testSetAsync(THashSet thing, CancellationToken cancellationToken); - - /// - /// Prints 'testList("{%s}")' where thing has been formatted into a string of values - /// separated by commas and new lines - /// @param list - /// - /// thing - the list - /// - /// to print - /// @return list - returns the list 'thing' - /// - /// - [OperationContract] - Task> testListAsync(List thing, CancellationToken cancellationToken); - - /// - /// Prints 'testEnum("%d")' where thing has been formatted into it's numeric value - /// @param Numberz thing - the Numberz to print - /// @return Numberz - returns the Numberz 'thing' - /// - /// - [OperationContract] - Task testEnumAsync(Numberz thing, CancellationToken cancellationToken); - - /// - /// Prints 'testTypedef("%d")' with thing as '%d' - /// @param UserId thing - the UserId to print - /// @return UserId - returns the UserId 'thing' - /// - /// - [OperationContract] - Task testTypedefAsync(long thing, CancellationToken cancellationToken); - - /// - /// Prints 'testMapMap("%d")' with hello as '%d' - /// @param i32 hello - the i32 to print - /// @return map - /// > - returns a dictionary with these values: - /// {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } - /// - /// - [OperationContract] - Task>> testMapMapAsync(int hello, CancellationToken cancellationToken); - - /// - /// So you think you've got this all worked, out eh? - /// Creates a the returned map with these values and prints it out: - /// { 1 => { 2 => argument, - /// 3 => argument, - /// }, - /// 2 => { 6 => - /// - /// , }, - /// } - /// @return map> - a map with the above values - /// - /// - [OperationContract] - Task>> testInsanityAsync(Insanity argument, - CancellationToken cancellationToken); - - /// - /// Prints 'testMulti()' - /// @param byte arg0 - - /// @param i32 arg1 - - /// @param i64 arg2 - - /// @param map - /// - /// arg3 - - /// @param Numberz arg4 - - /// @param UserId arg5 - - /// @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 - /// and i64_thing = arg2 - /// - /// - /// - /// - /// - /// - /// - [OperationContract] - Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, - long arg5, CancellationToken cancellationToken); - - /// - /// Print 'testException(%s)' with arg as '%s' - /// @param string arg - a string indication what type of exception to throw - /// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg - /// elsen if arg == "TException" throw TException - /// else do not throw anything - /// - /// - [OperationContract] - [FaultContract(typeof(XceptionFault))] - Task testExceptionAsync(string arg, CancellationToken cancellationToken); - - /// - /// Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' - /// @param string arg - a string indication what type of exception to throw - /// if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" - /// elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an - /// Xception2" - /// else do not throw anything - /// @return Xtruct - an Xtruct with string_thing = arg1 - /// - /// - /// - [OperationContract] - [FaultContract(typeof(XceptionFault))] - [FaultContract(typeof(Xception2Fault))] - Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken); - - /// - /// Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' - /// sleep 'secondsToSleep' - /// Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' - /// @param i32 secondsToSleep - the number of seconds to sleep - /// - /// - [OperationContract] - Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken); - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task testVoidAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testVoidArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testVoidResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task testStringAsync(string thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testStringArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStringResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testString failed: unknown result"); - } - - public async Task testBoolAsync(bool thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testBoolArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testBoolResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testBool failed: unknown result"); - } - - public async Task testByteAsync(sbyte thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testByteArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testByteResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testByte failed: unknown result"); - } - - public async Task testI32Async(int thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testI32Args(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testI32Result(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testI32 failed: unknown result"); - } - - public async Task testI64Async(long thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testI64Args(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testI64Result(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testI64 failed: unknown result"); - } - - public async Task testDoubleAsync(double thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testDoubleArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testDoubleResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testDouble failed: unknown result"); - } - - public async Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testBinaryArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testBinaryResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testBinary failed: unknown result"); - } - - public async Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testStructArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStructResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testStruct failed: unknown result"); - } - - public async Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testNestArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testNestResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testNest failed: unknown result"); - } - - public async Task> testMapAsync(Dictionary thing, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testMapArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testMap failed: unknown result"); - } - - public async Task> testStringMapAsync(Dictionary thing, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testStringMapArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStringMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testStringMap failed: unknown result"); - } - - public async Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testSetArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testSetResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testSet failed: unknown result"); - } - - public async Task> testListAsync(List thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testListArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testListResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testList failed: unknown result"); - } - - public async Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testEnumArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testEnumResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testEnum failed: unknown result"); - } - - public async Task testTypedefAsync(long thing, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testTypedefArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testTypedefResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testTypedef failed: unknown result"); - } - - public async Task>> testMapMapAsync(int hello, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testMapMapArgs(); - args.Hello = hello; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMapMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testMapMap failed: unknown result"); - } - - public async Task>> testInsanityAsync(Insanity argument, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testInsanityArgs(); - args.Argument = argument; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testInsanityResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testInsanity failed: unknown result"); - } - - public async Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, - Numberz arg4, long arg5, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testMultiArgs(); - args.Arg0 = arg0; - args.Arg1 = arg1; - args.Arg2 = arg2; - args.Arg3 = arg3; - args.Arg4 = arg4; - args.Arg5 = arg5; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMultiResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testMulti failed: unknown result"); - } - - public async Task testExceptionAsync(string arg, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testExceptionArgs(); - args.Arg = arg; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testExceptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.err1) - { - throw result.Err1; - } - return; - } - - public async Task testMultiExceptionAsync(string arg0, string arg1, - CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Call, SeqId), - cancellationToken); - - var args = new testMultiExceptionArgs(); - args.Arg0 = arg0; - args.Arg1 = arg1; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMultiExceptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.err1) - { - throw result.Err1; - } - if (result.__isset.err2) - { - throw result.Err2; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "testMultiException failed: unknown result"); - } - - public async Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("testOneway", TMessageType.Oneway, SeqId), - cancellationToken); - - var args = new testOnewayArgs(); - args.SecondsToSleep = secondsToSleep; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - protected Dictionary processMap_ = new Dictionary(); - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["testVoid"] = testVoid_ProcessAsync; - processMap_["testString"] = testString_ProcessAsync; - processMap_["testBool"] = testBool_ProcessAsync; - processMap_["testByte"] = testByte_ProcessAsync; - processMap_["testI32"] = testI32_ProcessAsync; - processMap_["testI64"] = testI64_ProcessAsync; - processMap_["testDouble"] = testDouble_ProcessAsync; - processMap_["testBinary"] = testBinary_ProcessAsync; - processMap_["testStruct"] = testStruct_ProcessAsync; - processMap_["testNest"] = testNest_ProcessAsync; - processMap_["testMap"] = testMap_ProcessAsync; - processMap_["testStringMap"] = testStringMap_ProcessAsync; - processMap_["testSet"] = testSet_ProcessAsync; - processMap_["testList"] = testList_ProcessAsync; - processMap_["testEnum"] = testEnum_ProcessAsync; - processMap_["testTypedef"] = testTypedef_ProcessAsync; - processMap_["testMapMap"] = testMapMap_ProcessAsync; - processMap_["testInsanity"] = testInsanity_ProcessAsync; - processMap_["testMulti"] = testMulti_ProcessAsync; - processMap_["testException"] = testException_ProcessAsync; - processMap_["testMultiException"] = testMultiException_ProcessAsync; - processMap_["testOneway"] = testOneway_ProcessAsync; - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task testVoid_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testVoidArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testVoidResult(); - try - { - await _iAsync.testVoidAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testStringArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStringResult(); - try - { - result.Success = await _iAsync.testStringAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testBool_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testBoolArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testBoolResult(); - try - { - result.Success = await _iAsync.testBoolAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testByte_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testByteArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testByteResult(); - try - { - result.Success = await _iAsync.testByteAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testI32_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testI32Args(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testI32Result(); - try - { - result.Success = await _iAsync.testI32Async(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testI64_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testI64Args(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testI64Result(); - try - { - result.Success = await _iAsync.testI64Async(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testDouble_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testDoubleArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testDoubleResult(); - try - { - result.Success = await _iAsync.testDoubleAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testBinary_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testBinaryArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testBinaryResult(); - try - { - result.Success = await _iAsync.testBinaryAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testStructArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStructResult(); - try - { - result.Success = await _iAsync.testStructAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testNest_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testNestArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testNestResult(); - try - { - result.Success = await _iAsync.testNestAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMapResult(); - try - { - result.Success = await _iAsync.testMapAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testStringMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testStringMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStringMapResult(); - try - { - result.Success = await _iAsync.testStringMapAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testSet_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testSetArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testSetResult(); - try - { - result.Success = await _iAsync.testSetAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testList_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testListArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testListResult(); - try - { - result.Success = await _iAsync.testListAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testEnum_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testEnumArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testEnumResult(); - try - { - result.Success = await _iAsync.testEnumAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testTypedef_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testTypedefArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testTypedefResult(); - try - { - result.Success = await _iAsync.testTypedefAsync(args.Thing, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMapMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testMapMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMapMapResult(); - try - { - result.Success = await _iAsync.testMapMapAsync(args.Hello, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testInsanity_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testInsanityArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testInsanityResult(); - try - { - result.Success = await _iAsync.testInsanityAsync(args.Argument, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMulti_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testMultiArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMultiResult(); - try - { - result.Success = - await - _iAsync.testMultiAsync(args.Arg0, args.Arg1, args.Arg2, args.Arg3, args.Arg4, args.Arg5, - cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testExceptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testExceptionResult(); - try - { - try - { - await _iAsync.testExceptionAsync(args.Arg, cancellationToken); - } - catch (Xception err1) - { - result.Err1 = err1; - } - await - oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMultiException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testMultiExceptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMultiExceptionResult(); - try - { - try - { - result.Success = await _iAsync.testMultiExceptionAsync(args.Arg0, args.Arg1, cancellationToken); - } - catch (Xception err1) - { - result.Err1 = err1; - } - catch (Xception2 err2) - { - result.Err2 = err2; - } - await - oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testOneway_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new testOnewayArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - try - { - await _iAsync.testOnewayAsync(args.SecondsToSleep, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - } - } - - protected delegate Task ProcessFunction( - int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - } - - - [DataContract(Namespace = "")] - public partial class testVoidArgs : TBase - { - public testVoidArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testVoid_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testVoid_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class testVoidResult : TBase - { - public testVoidResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testVoid_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testVoid_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class testStringArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _thing; - - public testStringArgs() - { - } - - [DataMember(Order = 0)] - public string Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testString_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testString_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testStringResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _success; - - public testStringResult() - { - } - - [DataMember(Order = 0)] - public string Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testString_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testString_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testBoolArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private bool _thing; - - public testBoolArgs() - { - } - - [DataMember(Order = 0)] - public bool Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - Thing = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBool_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testBool_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testBoolResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private bool _success; - - public testBoolResult() - { - } - - [DataMember(Order = 0)] - public bool Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Bool) - { - Success = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBool_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Bool; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testBool_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testByteArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private sbyte _thing; - - public testByteArgs() - { - } - - [DataMember(Order = 0)] - public sbyte Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testByte_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testByte_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testByteResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private sbyte _success; - - public testByteResult() - { - } - - [DataMember(Order = 0)] - public sbyte Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Byte) - { - Success = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testByte_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Byte; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testByte_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testI32Args : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _thing; - - public testI32Args() - { - } - - [DataMember(Order = 0)] - public int Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI32_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testI32_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testI32Result : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _success; - - public testI32Result() - { - } - - [DataMember(Order = 0)] - public int Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI32_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testI32_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testI64Args : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _thing; - - public testI64Args() - { - } - - [DataMember(Order = 0)] - public long Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I64) - { - Thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI64_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I64; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testI64_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testI64Result : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _success; - - public testI64Result() - { - } - - [DataMember(Order = 0)] - public long Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI64_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testI64_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testDoubleArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private double _thing; - - public testDoubleArgs() - { - } - - [DataMember(Order = 0)] - public double Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Double) - { - Thing = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testDouble_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Double; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testDouble_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testDoubleResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private double _success; - - public testDoubleResult() - { - } - - [DataMember(Order = 0)] - public double Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Double) - { - Success = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testDouble_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Double; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testDouble_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testBinaryArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _thing; - - public testBinaryArgs() - { - } - - [DataMember(Order = 0)] - public byte[] Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBinary_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testBinary_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testBinaryResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private byte[] _success; - - public testBinaryResult() - { - } - - [DataMember(Order = 0)] - public byte[] Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBinary_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testBinary_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testStructArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xtruct _thing; - - public testStructArgs() - { - } - - [DataMember(Order = 0)] - public Xtruct Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Thing = new Xtruct(); - await Thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStruct_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testStruct_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing == null ? "" : Thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testStructResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xtruct _success; - - public testStructResult() - { - } - - [DataMember(Order = 0)] - public Xtruct Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStruct_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testStruct_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testNestArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xtruct2 _thing; - - public testNestArgs() - { - } - - [DataMember(Order = 0)] - public Xtruct2 Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Thing = new Xtruct2(); - await Thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testNest_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testNest_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing == null ? "" : Thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testNestResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xtruct2 _success; - - public testNestResult() - { - } - - [DataMember(Order = 0)] - public Xtruct2 Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct2(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testNest_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testNest_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testMapArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _thing; - - public testMapArgs() - { - } - - [DataMember(Order = 0)] - public Dictionary Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Thing = new Dictionary(); - TMap _map144 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i145 = 0; _i145 < _map144.Count; ++_i145) - { - int _key146; - int _val147; - _key146 = await iprot.ReadI32Async(cancellationToken); - _val147 = await iprot.ReadI32Async(cancellationToken); - Thing[_key146] = _val147; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Thing.Count), cancellationToken); - foreach (int _iter148 in Thing.Keys) - { - await oprot.WriteI32Async(_iter148, cancellationToken); - await oprot.WriteI32Async(Thing[_iter148], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testMap_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testMapResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _success; - - public testMapResult() - { - } - - [DataMember(Order = 0)] - public Dictionary Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map149 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i150 = 0; _i150 < _map149.Count; ++_i150) - { - int _key151; - int _val152; - _key151 = await iprot.ReadI32Async(cancellationToken); - _val152 = await iprot.ReadI32Async(cancellationToken); - Success[_key151] = _val152; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success.Count), - cancellationToken); - foreach (int _iter153 in Success.Keys) - { - await oprot.WriteI32Async(_iter153, cancellationToken); - await oprot.WriteI32Async(Success[_iter153], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testStringMapArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _thing; - - public testStringMapArgs() - { - } - - [DataMember(Order = 0)] - public Dictionary Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Thing = new Dictionary(); - TMap _map154 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i155 = 0; _i155 < _map154.Count; ++_i155) - { - string _key156; - string _val157; - _key156 = await iprot.ReadStringAsync(cancellationToken); - _val157 = await iprot.ReadStringAsync(cancellationToken); - Thing[_key156] = _val157; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStringMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Thing.Count), - cancellationToken); - foreach (string _iter158 in Thing.Keys) - { - await oprot.WriteStringAsync(_iter158, cancellationToken); - await oprot.WriteStringAsync(Thing[_iter158], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testStringMap_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testStringMapResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary _success; - - public testStringMapResult() - { - } - - [DataMember(Order = 0)] - public Dictionary Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map159 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i160 = 0; _i160 < _map159.Count; ++_i160) - { - string _key161; - string _val162; - _key161 = await iprot.ReadStringAsync(cancellationToken); - _val162 = await iprot.ReadStringAsync(cancellationToken); - Success[_key161] = _val162; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStringMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), - cancellationToken); - foreach (string _iter163 in Success.Keys) - { - await oprot.WriteStringAsync(_iter163, cancellationToken); - await oprot.WriteStringAsync(Success[_iter163], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testStringMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testSetArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private THashSet _thing; - - public testSetArgs() - { - } - - [DataMember(Order = 0)] - public THashSet Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Set) - { - { - Thing = new THashSet(); - TSet _set164 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i165 = 0; _i165 < _set164.Count; ++_i165) - { - int _elem166; - _elem166 = await iprot.ReadI32Async(cancellationToken); - Thing.Add(_elem166); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testSet_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Set; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Thing.Count), cancellationToken); - foreach (int _iter167 in Thing) - { - await oprot.WriteI32Async(_iter167, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testSet_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testSetResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private THashSet _success; - - public testSetResult() - { - } - - [DataMember(Order = 0)] - public THashSet Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Set) - { - { - Success = new THashSet(); - TSet _set168 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i169 = 0; _i169 < _set168.Count; ++_i169) - { - int _elem170; - _elem170 = await iprot.ReadI32Async(cancellationToken); - Success.Add(_elem170); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testSet_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Set; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Success.Count), cancellationToken); - foreach (int _iter171 in Success) - { - await oprot.WriteI32Async(_iter171, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testSet_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testListArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List _thing; - - public testListArgs() - { - } - - [DataMember(Order = 0)] - public List Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Thing = new List(); - TList _list172 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i173 = 0; _i173 < _list172.Count; ++_i173) - { - int _elem174; - _elem174 = await iprot.ReadI32Async(cancellationToken); - Thing.Add(_elem174); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testList_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Thing.Count), cancellationToken); - foreach (int _iter175 in Thing) - { - await oprot.WriteI32Async(_iter175, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testList_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testListResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private List _success; - - public testListResult() - { - } - - [DataMember(Order = 0)] - public List Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list176 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i177 = 0; _i177 < _list176.Count; ++_i177) - { - int _elem178; - _elem178 = await iprot.ReadI32Async(cancellationToken); - Success.Add(_elem178); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testList_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Success.Count), cancellationToken); - foreach (int _iter179 in Success) - { - await oprot.WriteI32Async(_iter179, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testList_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testEnumArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Numberz _thing; - - public testEnumArgs() - { - } - - /// - /// - /// - [DataMember(Order = 0)] - public Numberz Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Thing = (Numberz) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testEnum_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testEnum_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testEnumResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Numberz _success; - - public testEnumResult() - { - } - - /// - /// - /// - [DataMember(Order = 0)] - public Numberz Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = (Numberz) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testEnum_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testEnum_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testTypedefArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _thing; - - public testTypedefArgs() - { - } - - [DataMember(Order = 0)] - public long Thing - { - get { return _thing; } - set - { - __isset.thing = true; - this._thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I64) - { - Thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testTypedef_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I64; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeThing() - { - return __isset.thing; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testTypedef_args("); - bool __first = true; - if (__isset.thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool thing; - } - } - - - [DataContract(Namespace = "")] - public partial class testTypedefResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private long _success; - - public testTypedefResult() - { - } - - [DataMember(Order = 0)] - public long Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testTypedef_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testTypedef_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testMapMapArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _hello; - - public testMapMapArgs() - { - } - - [DataMember(Order = 0)] - public int Hello - { - get { return _hello; } - set - { - __isset.hello = true; - this._hello = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Hello = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMapMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.hello) - { - field.Name = "hello"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeHello() - { - return __isset.hello; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testMapMap_args("); - bool __first = true; - if (__isset.hello) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool hello; - } - } - - - [DataContract(Namespace = "")] - public partial class testMapMapResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary> _success; - - public testMapMapResult() - { - } - - [DataMember(Order = 0)] - public Dictionary> Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map180 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i181 = 0; _i181 < _map180.Count; ++_i181) - { - int _key182; - Dictionary _val183; - _key182 = await iprot.ReadI32Async(cancellationToken); - { - _val183 = new Dictionary(); - TMap _map184 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i185 = 0; _i185 < _map184.Count; ++_i185) - { - int _key186; - int _val187; - _key186 = await iprot.ReadI32Async(cancellationToken); - _val187 = await iprot.ReadI32Async(cancellationToken); - _val183[_key186] = _val187; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Success[_key182] = _val183; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMapMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Map, Success.Count), - cancellationToken); - foreach (int _iter188 in Success.Keys) - { - await oprot.WriteI32Async(_iter188, cancellationToken); - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.I32, TType.I32, Success[_iter188].Count), - cancellationToken); - foreach (int _iter189 in Success[_iter188].Keys) - { - await oprot.WriteI32Async(_iter189, cancellationToken); - await oprot.WriteI32Async(Success[_iter188][_iter189], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testMapMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testInsanityArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Insanity _argument; - - public testInsanityArgs() - { - } - - [DataMember(Order = 0)] - public Insanity Argument - { - get { return _argument; } - set - { - __isset.argument = true; - this._argument = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Argument = new Insanity(); - await Argument.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testInsanity_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Argument != null && __isset.argument) - { - field.Name = "argument"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Argument.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeArgument() - { - return __isset.argument; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testInsanity_args("); - bool __first = true; - if (Argument != null && __isset.argument) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Argument: "); - sb.Append(Argument == null ? "" : Argument.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool argument; - } - } - - - [DataContract(Namespace = "")] - public partial class testInsanityResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Dictionary> _success; - - public testInsanityResult() - { - } - - [DataMember(Order = 0)] - public Dictionary> Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map190 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i191 = 0; _i191 < _map190.Count; ++_i191) - { - long _key192; - Dictionary _val193; - _key192 = await iprot.ReadI64Async(cancellationToken); - { - _val193 = new Dictionary(); - TMap _map194 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i195 = 0; _i195 < _map194.Count; ++_i195) - { - Numberz _key196; - Insanity _val197; - _key196 = (Numberz) await iprot.ReadI32Async(cancellationToken); - _val197 = new Insanity(); - await _val197.ReadAsync(iprot, cancellationToken); - _val193[_key196] = _val197; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Success[_key192] = _val193; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testInsanity_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I64, TType.Map, Success.Count), - cancellationToken); - foreach (long _iter198 in Success.Keys) - { - await oprot.WriteI64Async(_iter198, cancellationToken); - { - await - oprot.WriteMapBeginAsync( - new TMap(TType.I32, TType.Struct, Success[_iter198].Count), - cancellationToken); - foreach (Numberz _iter199 in Success[_iter198].Keys) - { - await oprot.WriteI32Async((int) _iter199, cancellationToken); - await Success[_iter198][_iter199].WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testInsanity_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testMultiArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private sbyte _arg0; - private int _arg1; - private long _arg2; - private Dictionary _arg3; - private Numberz _arg4; - private long _arg5; - - public testMultiArgs() - { - } - - [DataMember(Order = 0)] - public sbyte Arg0 - { - get { return _arg0; } - set - { - __isset.arg0 = true; - this._arg0 = value; - } - } - - [DataMember(Order = 0)] - public int Arg1 - { - get { return _arg1; } - set - { - __isset.arg1 = true; - this._arg1 = value; - } - } - - [DataMember(Order = 0)] - public long Arg2 - { - get { return _arg2; } - set - { - __isset.arg2 = true; - this._arg2 = value; - } - } - - [DataMember(Order = 0)] - public Dictionary Arg3 - { - get { return _arg3; } - set - { - __isset.arg3 = true; - this._arg3 = value; - } - } - - /// - /// - /// - [DataMember(Order = 0)] - public Numberz Arg4 - { - get { return _arg4; } - set - { - __isset.arg4 = true; - this._arg4 = value; - } - } - - [DataMember(Order = 0)] - public long Arg5 - { - get { return _arg5; } - set - { - __isset.arg5 = true; - this._arg5 = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Arg0 = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Arg1 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I64) - { - Arg2 = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Map) - { - { - Arg3 = new Dictionary(); - TMap _map200 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i201 = 0; _i201 < _map200.Count; ++_i201) - { - short _key202; - string _val203; - _key202 = await iprot.ReadI16Async(cancellationToken); - _val203 = await iprot.ReadStringAsync(cancellationToken); - Arg3[_key202] = _val203; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.I32) - { - Arg4 = (Numberz) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.I64) - { - Arg5 = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMulti_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.arg0) - { - field.Name = "arg0"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Arg0, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg1) - { - field.Name = "arg1"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Arg1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg2) - { - field.Name = "arg2"; - field.Type = TType.I64; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Arg2, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Arg3 != null && __isset.arg3) - { - field.Name = "arg3"; - field.Type = TType.Map; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await - oprot.WriteMapBeginAsync(new TMap(TType.I16, TType.String, Arg3.Count), - cancellationToken); - foreach (short _iter204 in Arg3.Keys) - { - await oprot.WriteI16Async(_iter204, cancellationToken); - await oprot.WriteStringAsync(Arg3[_iter204], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg4) - { - field.Name = "arg4"; - field.Type = TType.I32; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Arg4, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg5) - { - field.Name = "arg5"; - field.Type = TType.I64; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Arg5, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMulti_args("); - bool __first = true; - if (__isset.arg0) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg0: "); - sb.Append(Arg0); - } - if (__isset.arg1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg1: "); - sb.Append(Arg1); - } - if (__isset.arg2) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg2: "); - sb.Append(Arg2); - } - if (Arg3 != null && __isset.arg3) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg3: "); - sb.Append(Arg3); - } - if (__isset.arg4) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg4: "); - sb.Append(Arg4); - } - if (__isset.arg5) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg5: "); - sb.Append(Arg5); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool arg0; - [DataMember] public bool arg1; - [DataMember] public bool arg2; - [DataMember] public bool arg3; - [DataMember] public bool arg4; - [DataMember] public bool arg5; - } - - #region XmlSerializer support - - public bool ShouldSerializeArg0() - { - return __isset.arg0; - } - - public bool ShouldSerializeArg1() - { - return __isset.arg1; - } - - public bool ShouldSerializeArg2() - { - return __isset.arg2; - } - - public bool ShouldSerializeArg3() - { - return __isset.arg3; - } - - public bool ShouldSerializeArg4() - { - return __isset.arg4; - } - - public bool ShouldSerializeArg5() - { - return __isset.arg5; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class testMultiResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xtruct _success; - - public testMultiResult() - { - } - - [DataMember(Order = 0)] - public Xtruct Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMulti_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testMulti_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class testExceptionArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _arg; - - public testExceptionArgs() - { - } - - [DataMember(Order = 0)] - public string Arg - { - get { return _arg; } - set - { - __isset.arg = true; - this._arg = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Arg = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testException_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Arg != null && __isset.arg) - { - field.Name = "arg"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeArg() - { - return __isset.arg; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testException_args("); - bool __first = true; - if (Arg != null && __isset.arg) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg: "); - sb.Append(Arg); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool arg; - } - } - - - [DataContract(Namespace = "")] - public partial class testExceptionResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xception _err1; - - public testExceptionResult() - { - } - - [DataMember(Order = 0)] - public Xception Err1 - { - get { return _err1; } - set - { - __isset.err1 = true; - this._err1 = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Err1 = new Xception(); - await Err1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testException_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.err1) - { - if (Err1 != null) - { - field.Name = "Err1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeErr1() - { - return __isset.err1; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testException_result("); - bool __first = true; - if (Err1 != null && __isset.err1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Err1: "); - sb.Append(Err1 == null ? "" : Err1.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool err1; - } - } - - - [DataContract(Namespace = "")] - public partial class testMultiExceptionArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _arg0; - private string _arg1; - - public testMultiExceptionArgs() - { - } - - [DataMember(Order = 0)] - public string Arg0 - { - get { return _arg0; } - set - { - __isset.arg0 = true; - this._arg0 = value; - } - } - - [DataMember(Order = 0)] - public string Arg1 - { - get { return _arg1; } - set - { - __isset.arg1 = true; - this._arg1 = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Arg0 = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Arg1 = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMultiException_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Arg0 != null && __isset.arg0) - { - field.Name = "arg0"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg0, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Arg1 != null && __isset.arg1) - { - field.Name = "arg1"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMultiException_args("); - bool __first = true; - if (Arg0 != null && __isset.arg0) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg0: "); - sb.Append(Arg0); - } - if (Arg1 != null && __isset.arg1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Arg1: "); - sb.Append(Arg1); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool arg0; - [DataMember] public bool arg1; - } - - #region XmlSerializer support - - public bool ShouldSerializeArg0() - { - return __isset.arg0; - } - - public bool ShouldSerializeArg1() - { - return __isset.arg1; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class testMultiExceptionResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private Xception _err1; - private Xception2 _err2; - private Xtruct _success; - - public testMultiExceptionResult() - { - } - - [DataMember(Order = 0)] - public Xtruct Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public Xception Err1 - { - get { return _err1; } - set - { - __isset.err1 = true; - this._err1 = value; - } - } - - [DataMember(Order = 0)] - public Xception2 Err2 - { - get { return _err2; } - set - { - __isset.err2 = true; - this._err2 = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Err1 = new Xception(); - await Err1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Err2 = new Xception2(); - await Err2.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMultiException_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.err1) - { - if (Err1 != null) - { - field.Name = "Err1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if (this.__isset.err2) - { - if (Err2 != null) - { - field.Name = "Err2"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err2.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMultiException_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - if (Err1 != null && __isset.err1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Err1: "); - sb.Append(Err1 == null ? "" : Err1.ToString()); - } - if (Err2 != null && __isset.err2) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Err2: "); - sb.Append(Err2 == null ? "" : Err2.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool err1; - [DataMember] public bool err2; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeErr1() - { - return __isset.err1; - } - - public bool ShouldSerializeErr2() - { - return __isset.err2; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class testOnewayArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _secondsToSleep; - - public testOnewayArgs() - { - } - - [DataMember(Order = 0)] - public int SecondsToSleep - { - get { return _secondsToSleep; } - set - { - __isset.secondsToSleep = true; - this._secondsToSleep = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - SecondsToSleep = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testOneway_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.secondsToSleep) - { - field.Name = "secondsToSleep"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(SecondsToSleep, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSecondsToSleep() - { - return __isset.secondsToSleep; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("testOneway_args("); - bool __first = true; - if (__isset.secondsToSleep) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("SecondsToSleep: "); - sb.Append(SecondsToSleep); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool secondsToSleep; - } - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs deleted file mode 100644 index 740969bc3a1..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/ThriftTestAsync.Constants.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; - - -namespace ThriftAsync.Test -{ - public static class ThriftTestAsyncConstants - { - public static Numberz myNumberz = Numberz.ONE; - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs deleted file mode 100644 index f1d829e064d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV1.cs +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class VersioningTestV1 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _begin_in_both; - private int _end_in_both; - private string _old_string; - - public VersioningTestV1() - { - } - - [DataMember(Order = 0)] - public int Begin_in_both - { - get { return _begin_in_both; } - set - { - __isset.begin_in_both = true; - this._begin_in_both = value; - } - } - - [DataMember(Order = 0)] - public string Old_string - { - get { return _old_string; } - set - { - __isset.old_string = true; - this._old_string = value; - } - } - - [DataMember(Order = 0)] - public int End_in_both - { - get { return _end_in_both; } - set - { - __isset.end_in_both = true; - this._end_in_both = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Begin_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Old_string = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 12: - if (field.Type == TType.I32) - { - End_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("VersioningTestV1"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.begin_in_both) - { - field.Name = "begin_in_both"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Begin_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Old_string != null && __isset.old_string) - { - field.Name = "old_string"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Old_string, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.end_in_both) - { - field.Name = "end_in_both"; - field.Type = TType.I32; - field.ID = 12; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(End_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("VersioningTestV1("); - bool __first = true; - if (__isset.begin_in_both) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Begin_in_both: "); - sb.Append(Begin_in_both); - } - if (Old_string != null && __isset.old_string) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Old_string: "); - sb.Append(Old_string); - } - if (__isset.end_in_both) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("End_in_both: "); - sb.Append(End_in_both); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool begin_in_both; - [DataMember] public bool old_string; - [DataMember] public bool end_in_both; - } - - #region XmlSerializer support - - public bool ShouldSerializeBegin_in_both() - { - return __isset.begin_in_both; - } - - public bool ShouldSerializeOld_string() - { - return __isset.old_string; - } - - public bool ShouldSerializeEnd_in_both() - { - return __isset.end_in_both; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs deleted file mode 100644 index 405f9b49ce9..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/VersioningTestV2.cs +++ /dev/null @@ -1,735 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class VersioningTestV2 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _begin_in_both; - private int _end_in_both; - private sbyte _newbyte; - private double _newdouble; - private int _newint; - private List _newlist; - private long _newlong; - private Dictionary _newmap; - private THashSet _newset; - private short _newshort; - private string _newstring; - private Bonk _newstruct; - - public VersioningTestV2() - { - } - - [DataMember(Order = 0)] - public int Begin_in_both - { - get { return _begin_in_both; } - set - { - __isset.begin_in_both = true; - this._begin_in_both = value; - } - } - - [DataMember(Order = 0)] - public int Newint - { - get { return _newint; } - set - { - __isset.newint = true; - this._newint = value; - } - } - - [DataMember(Order = 0)] - public sbyte Newbyte - { - get { return _newbyte; } - set - { - __isset.newbyte = true; - this._newbyte = value; - } - } - - [DataMember(Order = 0)] - public short Newshort - { - get { return _newshort; } - set - { - __isset.newshort = true; - this._newshort = value; - } - } - - [DataMember(Order = 0)] - public long Newlong - { - get { return _newlong; } - set - { - __isset.newlong = true; - this._newlong = value; - } - } - - [DataMember(Order = 0)] - public double Newdouble - { - get { return _newdouble; } - set - { - __isset.newdouble = true; - this._newdouble = value; - } - } - - [DataMember(Order = 0)] - public Bonk Newstruct - { - get { return _newstruct; } - set - { - __isset.newstruct = true; - this._newstruct = value; - } - } - - [DataMember(Order = 0)] - public List Newlist - { - get { return _newlist; } - set - { - __isset.newlist = true; - this._newlist = value; - } - } - - [DataMember(Order = 0)] - public THashSet Newset - { - get { return _newset; } - set - { - __isset.newset = true; - this._newset = value; - } - } - - [DataMember(Order = 0)] - public Dictionary Newmap - { - get { return _newmap; } - set - { - __isset.newmap = true; - this._newmap = value; - } - } - - [DataMember(Order = 0)] - public string Newstring - { - get { return _newstring; } - set - { - __isset.newstring = true; - this._newstring = value; - } - } - - [DataMember(Order = 0)] - public int End_in_both - { - get { return _end_in_both; } - set - { - __isset.end_in_both = true; - this._end_in_both = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Begin_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Newint = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Byte) - { - Newbyte = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I16) - { - Newshort = await iprot.ReadI16Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.I64) - { - Newlong = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.Double) - { - Newdouble = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 7: - if (field.Type == TType.Struct) - { - Newstruct = new Bonk(); - await Newstruct.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 8: - if (field.Type == TType.List) - { - { - Newlist = new List(); - TList _list44 = await iprot.ReadListBeginAsync(cancellationToken); - for (int _i45 = 0; _i45 < _list44.Count; ++_i45) - { - int _elem46; - _elem46 = await iprot.ReadI32Async(cancellationToken); - Newlist.Add(_elem46); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.Set) - { - { - Newset = new THashSet(); - TSet _set47 = await iprot.ReadSetBeginAsync(cancellationToken); - for (int _i48 = 0; _i48 < _set47.Count; ++_i48) - { - int _elem49; - _elem49 = await iprot.ReadI32Async(cancellationToken); - Newset.Add(_elem49); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 10: - if (field.Type == TType.Map) - { - { - Newmap = new Dictionary(); - TMap _map50 = await iprot.ReadMapBeginAsync(cancellationToken); - for (int _i51 = 0; _i51 < _map50.Count; ++_i51) - { - int _key52; - int _val53; - _key52 = await iprot.ReadI32Async(cancellationToken); - _val53 = await iprot.ReadI32Async(cancellationToken); - Newmap[_key52] = _val53; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.String) - { - Newstring = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 12: - if (field.Type == TType.I32) - { - End_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("VersioningTestV2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.begin_in_both) - { - field.Name = "begin_in_both"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Begin_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newint) - { - field.Name = "newint"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Newint, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newbyte) - { - field.Name = "newbyte"; - field.Type = TType.Byte; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Newbyte, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newshort) - { - field.Name = "newshort"; - field.Type = TType.I16; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI16Async(Newshort, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newlong) - { - field.Name = "newlong"; - field.Type = TType.I64; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Newlong, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newdouble) - { - field.Name = "newdouble"; - field.Type = TType.Double; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Newdouble, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newstruct != null && __isset.newstruct) - { - field.Name = "newstruct"; - field.Type = TType.Struct; - field.ID = 7; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Newstruct.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newlist != null && __isset.newlist) - { - field.Name = "newlist"; - field.Type = TType.List; - field.ID = 8; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Newlist.Count), cancellationToken); - foreach (int _iter54 in Newlist) - { - await oprot.WriteI32Async(_iter54, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newset != null && __isset.newset) - { - field.Name = "newset"; - field.Type = TType.Set; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Newset.Count), cancellationToken); - foreach (int _iter55 in Newset) - { - await oprot.WriteI32Async(_iter55, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newmap != null && __isset.newmap) - { - field.Name = "newmap"; - field.Type = TType.Map; - field.ID = 10; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Newmap.Count), cancellationToken); - foreach (int _iter56 in Newmap.Keys) - { - await oprot.WriteI32Async(_iter56, cancellationToken); - await oprot.WriteI32Async(Newmap[_iter56], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newstring != null && __isset.newstring) - { - field.Name = "newstring"; - field.Type = TType.String; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Newstring, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.end_in_both) - { - field.Name = "end_in_both"; - field.Type = TType.I32; - field.ID = 12; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(End_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("VersioningTestV2("); - bool __first = true; - if (__isset.begin_in_both) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Begin_in_both: "); - sb.Append(Begin_in_both); - } - if (__isset.newint) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newint: "); - sb.Append(Newint); - } - if (__isset.newbyte) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newbyte: "); - sb.Append(Newbyte); - } - if (__isset.newshort) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newshort: "); - sb.Append(Newshort); - } - if (__isset.newlong) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newlong: "); - sb.Append(Newlong); - } - if (__isset.newdouble) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newdouble: "); - sb.Append(Newdouble); - } - if (Newstruct != null && __isset.newstruct) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newstruct: "); - sb.Append(Newstruct == null ? "" : Newstruct.ToString()); - } - if (Newlist != null && __isset.newlist) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newlist: "); - sb.Append(Newlist); - } - if (Newset != null && __isset.newset) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newset: "); - sb.Append(Newset); - } - if (Newmap != null && __isset.newmap) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newmap: "); - sb.Append(Newmap); - } - if (Newstring != null && __isset.newstring) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Newstring: "); - sb.Append(Newstring); - } - if (__isset.end_in_both) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("End_in_both: "); - sb.Append(End_in_both); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool begin_in_both; - [DataMember] public bool newint; - [DataMember] public bool newbyte; - [DataMember] public bool newshort; - [DataMember] public bool newlong; - [DataMember] public bool newdouble; - [DataMember] public bool newstruct; - [DataMember] public bool newlist; - [DataMember] public bool newset; - [DataMember] public bool newmap; - [DataMember] public bool newstring; - [DataMember] public bool end_in_both; - } - - #region XmlSerializer support - - public bool ShouldSerializeBegin_in_both() - { - return __isset.begin_in_both; - } - - public bool ShouldSerializeNewint() - { - return __isset.newint; - } - - public bool ShouldSerializeNewbyte() - { - return __isset.newbyte; - } - - public bool ShouldSerializeNewshort() - { - return __isset.newshort; - } - - public bool ShouldSerializeNewlong() - { - return __isset.newlong; - } - - public bool ShouldSerializeNewdouble() - { - return __isset.newdouble; - } - - public bool ShouldSerializeNewstruct() - { - return __isset.newstruct; - } - - public bool ShouldSerializeNewlist() - { - return __isset.newlist; - } - - public bool ShouldSerializeNewset() - { - return __isset.newset; - } - - public bool ShouldSerializeNewmap() - { - return __isset.newmap; - } - - public bool ShouldSerializeNewstring() - { - return __isset.newstring; - } - - public bool ShouldSerializeEnd_in_both() - { - return __isset.end_in_both; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs deleted file mode 100644 index 2df4ee10729..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception.cs +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - public partial class Xception : TException, TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _errorCode; - private string _message; - - public Xception() - { - } - - [DataMember(Order = 0)] - public int ErrorCode - { - get { return _errorCode; } - set - { - __isset.errorCode = true; - this._errorCode = value; - } - } - - [DataMember(Order = 0)] - public string Message - { - get { return _message; } - set - { - __isset.message = true; - this._message = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ErrorCode = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Message = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xception"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.errorCode) - { - field.Name = "errorCode"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ErrorCode, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Message != null && __isset.message) - { - field.Name = "message"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Message, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xception("); - bool __first = true; - if (__isset.errorCode) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("ErrorCode: "); - sb.Append(ErrorCode); - } - if (Message != null && __isset.message) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Message: "); - sb.Append(Message); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool errorCode; - [DataMember] public bool message; - } - - #region XmlSerializer support - - public bool ShouldSerializeErrorCode() - { - return __isset.errorCode; - } - - public bool ShouldSerializeMessage() - { - return __isset.message; - } - - #endregion XmlSerializer support - } - - - [DataContract] - public partial class XceptionFault - { - private int _errorCode; - private string _message; - - [DataMember(Order = 0)] - public int ErrorCode - { - get { return _errorCode; } - set { this._errorCode = value; } - } - - [DataMember(Order = 0)] - public string Message - { - get { return _message; } - set { this._message = value; } - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs deleted file mode 100644 index e5c1f8e6d8a..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xception2.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - public partial class Xception2 : TException, TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _errorCode; - private Xtruct _struct_thing; - - public Xception2() - { - } - - [DataMember(Order = 0)] - public int ErrorCode - { - get { return _errorCode; } - set - { - __isset.errorCode = true; - this._errorCode = value; - } - } - - [DataMember(Order = 0)] - public Xtruct Struct_thing - { - get { return _struct_thing; } - set - { - __isset.struct_thing = true; - this._struct_thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ErrorCode = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Struct_thing = new Xtruct(); - await Struct_thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xception2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.errorCode) - { - field.Name = "errorCode"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ErrorCode, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Struct_thing != null && __isset.struct_thing) - { - field.Name = "struct_thing"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Struct_thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xception2("); - bool __first = true; - if (__isset.errorCode) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("ErrorCode: "); - sb.Append(ErrorCode); - } - if (Struct_thing != null && __isset.struct_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Struct_thing: "); - sb.Append(Struct_thing == null ? "" : Struct_thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool errorCode; - [DataMember] public bool struct_thing; - } - - #region XmlSerializer support - - public bool ShouldSerializeErrorCode() - { - return __isset.errorCode; - } - - public bool ShouldSerializeStruct_thing() - { - return __isset.struct_thing; - } - - #endregion XmlSerializer support - } - - - [DataContract] - public partial class Xception2Fault - { - private int _errorCode; - private Xtruct _struct_thing; - - [DataMember(Order = 0)] - public int ErrorCode - { - get { return _errorCode; } - set { this._errorCode = value; } - } - - [DataMember(Order = 0)] - public Xtruct Struct_thing - { - get { return _struct_thing; } - set { this._struct_thing = value; } - } - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs deleted file mode 100644 index 23f0013aa7d..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct.cs +++ /dev/null @@ -1,351 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Xtruct : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private sbyte _byte_thing; - private short _i16_thing; - private int _i32_thing; - private long _i64_thing; - private string _string_thing; - - public Xtruct() - { - } - - [DataMember(Order = 0)] - public string String_thing - { - get { return _string_thing; } - set - { - __isset.string_thing = true; - this._string_thing = value; - } - } - - [DataMember(Order = 0)] - public sbyte Byte_thing - { - get { return _byte_thing; } - set - { - __isset.byte_thing = true; - this._byte_thing = value; - } - } - - [DataMember(Order = 0)] - public short I16_thing - { - get { return _i16_thing; } - set - { - __isset.i16_thing = true; - this._i16_thing = value; - } - } - - [DataMember(Order = 0)] - public int I32_thing - { - get { return _i32_thing; } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - [DataMember(Order = 0)] - public long I64_thing - { - get { return _i64_thing; } - set - { - __isset.i64_thing = true; - this._i64_thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Byte) - { - Byte_thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 7: - if (field.Type == TType.I16) - { - I16_thing = await iprot.ReadI16Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.I64) - { - I64_thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_thing != null && __isset.string_thing) - { - field.Name = "string_thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.byte_thing) - { - field.Name = "byte_thing"; - field.Type = TType.Byte; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Byte_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i16_thing) - { - field.Name = "i16_thing"; - field.Type = TType.I16; - field.ID = 7; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI16Async(I16_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i64_thing) - { - field.Name = "i64_thing"; - field.Type = TType.I64; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(I64_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct("); - bool __first = true; - if (String_thing != null && __isset.string_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("String_thing: "); - sb.Append(String_thing); - } - if (__isset.byte_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Byte_thing: "); - sb.Append(Byte_thing); - } - if (__isset.i16_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I16_thing: "); - sb.Append(I16_thing); - } - if (__isset.i32_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - if (__isset.i64_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I64_thing: "); - sb.Append(I64_thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool string_thing; - [DataMember] public bool byte_thing; - [DataMember] public bool i16_thing; - [DataMember] public bool i32_thing; - [DataMember] public bool i64_thing; - } - - #region XmlSerializer support - - public bool ShouldSerializeString_thing() - { - return __isset.string_thing; - } - - public bool ShouldSerializeByte_thing() - { - return __isset.byte_thing; - } - - public bool ShouldSerializeI16_thing() - { - return __isset.i16_thing; - } - - public bool ShouldSerializeI32_thing() - { - return __isset.i32_thing; - } - - public bool ShouldSerializeI64_thing() - { - return __isset.i64_thing; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs deleted file mode 100644 index bf0296ffe5b..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct2.cs +++ /dev/null @@ -1,258 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Xtruct2 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private sbyte _byte_thing; - private int _i32_thing; - private Xtruct _struct_thing; - - public Xtruct2() - { - } - - [DataMember(Order = 0)] - public sbyte Byte_thing - { - get { return _byte_thing; } - set - { - __isset.byte_thing = true; - this._byte_thing = value; - } - } - - [DataMember(Order = 0)] - public Xtruct Struct_thing - { - get { return _struct_thing; } - set - { - __isset.struct_thing = true; - this._struct_thing = value; - } - } - - [DataMember(Order = 0)] - public int I32_thing - { - get { return _i32_thing; } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Byte_thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Struct_thing = new Xtruct(); - await Struct_thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.byte_thing) - { - field.Name = "byte_thing"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Byte_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Struct_thing != null && __isset.struct_thing) - { - field.Name = "struct_thing"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Struct_thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct2("); - bool __first = true; - if (__isset.byte_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Byte_thing: "); - sb.Append(Byte_thing); - } - if (Struct_thing != null && __isset.struct_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Struct_thing: "); - sb.Append(Struct_thing == null ? "" : Struct_thing.ToString()); - } - if (__isset.i32_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool byte_thing; - [DataMember] public bool struct_thing; - [DataMember] public bool i32_thing; - } - - #region XmlSerializer support - - public bool ShouldSerializeByte_thing() - { - return __isset.byte_thing; - } - - public bool ShouldSerializeStruct_thing() - { - return __isset.struct_thing; - } - - public bool ShouldSerializeI32_thing() - { - return __isset.i32_thing; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs deleted file mode 100644 index 1256cbbbd0e..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/Generated/ThriftAsync/Test/Xtruct3.cs +++ /dev/null @@ -1,304 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace ThriftAsync.Test -{ - [DataContract(Namespace = "")] - public partial class Xtruct3 : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _changed; - private int _i32_thing; - private long _i64_thing; - private string _string_thing; - - public Xtruct3() - { - } - - [DataMember(Order = 0)] - public string String_thing - { - get { return _string_thing; } - set - { - __isset.string_thing = true; - this._string_thing = value; - } - } - - [DataMember(Order = 0)] - public int Changed - { - get { return _changed; } - set - { - __isset.changed = true; - this._changed = value; - } - } - - [DataMember(Order = 0)] - public int I32_thing - { - get { return _i32_thing; } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - [DataMember(Order = 0)] - public long I64_thing - { - get { return _i64_thing; } - set - { - __isset.i64_thing = true; - this._i64_thing = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Changed = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.I64) - { - I64_thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct3"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_thing != null && __isset.string_thing) - { - field.Name = "string_thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.changed) - { - field.Name = "changed"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Changed, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i64_thing) - { - field.Name = "i64_thing"; - field.Type = TType.I64; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(I64_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct3("); - bool __first = true; - if (String_thing != null && __isset.string_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("String_thing: "); - sb.Append(String_thing); - } - if (__isset.changed) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Changed: "); - sb.Append(Changed); - } - if (__isset.i32_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - if (__isset.i64_thing) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("I64_thing: "); - sb.Append(I64_thing); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool string_thing; - [DataMember] public bool changed; - [DataMember] public bool i32_thing; - [DataMember] public bool i64_thing; - } - - #region XmlSerializer support - - public bool ShouldSerializeString_thing() - { - return __isset.string_thing; - } - - public bool ShouldSerializeChanged() - { - return __isset.changed; - } - - public bool ShouldSerializeI32_thing() - { - return __isset.i32_thing; - } - - public bool ShouldSerializeI64_thing() - { - return __isset.i64_thing; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift b/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift deleted file mode 100644 index 69b708e00bc..00000000000 --- a/lib/netcore/src/Tests/Thrift.PublicInterfaces.Compile.Tests/ThriftTestAsync.thrift +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * Contains some contributions under the Thrift Software License. - * Please see doc/old-thrift-license.txt in the Thrift distribution for - * details. - */ - -namespace csharp ThriftAsync.Test - -/** - * Docstring! - */ -enum Numberz -{ - ONE = 1, - TWO, - THREE, - FIVE = 5, - SIX, - EIGHT = 8 -} - -const Numberz myNumberz = Numberz.ONE; -// the following is expected to fail: -// const Numberz urNumberz = ONE; - -typedef i64 UserId - -struct Bonk -{ - 1: string message, - 2: i32 type -} - -typedef map MapType - -struct Bools { - 1: bool im_true, - 2: bool im_false, -} - -struct Xtruct -{ - 1: string string_thing, - 4: byte byte_thing, - 7: i16 i16_thing, - 9: i32 i32_thing, - 11: i64 i64_thing -} - -struct Xtruct2 -{ - 1: byte byte_thing, // used to be byte, hence the name - 2: Xtruct struct_thing, - 3: i32 i32_thing -} - -struct Xtruct3 -{ - 1: string string_thing, - 4: i32 changed, - 9: i32 i32_thing, - 11: i64 i64_thing -} - - -struct Insanity -{ - 1: map userMap, - 2: list xtructs -} (python.immutable= "") - -struct CrazyNesting { - 1: string string_field, - 2: optional set set_field, - // Do not insert line break as test/go/Makefile.am is removing this line with pattern match - 3: required list (python.immutable = ""), map(python.immutable = "")> (python.immutable = "")>>>> list_field, - 4: binary binary_field -} - -exception Xception { - 1: i32 errorCode, - 2: string message -} - -exception Xception2 { - 1: i32 errorCode, - 2: Xtruct struct_thing -} - -struct EmptyStruct {} - -struct OneField { - 1: EmptyStruct field -} - -service ThriftTest -{ - /** - * Prints "testVoid()" and returns nothing. - */ - void testVoid(), - - /** - * Prints 'testString("%s")' with thing as '%s' - * @param string thing - the string to print - * @return string - returns the string 'thing' - */ - string testString(1: string thing), - - /** - * Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' - * @param bool thing - the bool data to print - * @return bool - returns the bool 'thing' - */ - bool testBool(1: bool thing), - - /** - * Prints 'testByte("%d")' with thing as '%d' - * The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. - * @param byte thing - the i8/byte to print - * @return i8 - returns the i8/byte 'thing' - */ - byte testByte(1: byte thing), - - /** - * Prints 'testI32("%d")' with thing as '%d' - * @param i32 thing - the i32 to print - * @return i32 - returns the i32 'thing' - */ - i32 testI32(1: i32 thing), - - /** - * Prints 'testI64("%d")' with thing as '%d' - * @param i64 thing - the i64 to print - * @return i64 - returns the i64 'thing' - */ - i64 testI64(1: i64 thing), - - /** - * Prints 'testDouble("%f")' with thing as '%f' - * @param double thing - the double to print - * @return double - returns the double 'thing' - */ - double testDouble(1: double thing), - - /** - * Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data - * @param binary thing - the binary data to print - * @return binary - returns the binary 'thing' - */ - binary testBinary(1: binary thing), - - /** - * Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values - * @param Xtruct thing - the Xtruct to print - * @return Xtruct - returns the Xtruct 'thing' - */ - Xtruct testStruct(1: Xtruct thing), - - /** - * Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct - * @param Xtruct2 thing - the Xtruct2 to print - * @return Xtruct2 - returns the Xtruct2 'thing' - */ - Xtruct2 testNest(1: Xtruct2 thing), - - /** - * Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs - * separated by commas and new lines - * @param map thing - the map to print - * @return map - returns the map 'thing' - */ - map testMap(1: map thing), - - /** - * Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs - * separated by commas and new lines - * @param map thing - the map to print - * @return map - returns the map 'thing' - */ - map testStringMap(1: map thing), - - /** - * Prints 'testSet("{%s}")' where thing has been formatted into a string of values - * separated by commas and new lines - * @param set thing - the set to print - * @return set - returns the set 'thing' - */ - set testSet(1: set thing), - - /** - * Prints 'testList("{%s}")' where thing has been formatted into a string of values - * separated by commas and new lines - * @param list thing - the list to print - * @return list - returns the list 'thing' - */ - list testList(1: list thing), - - /** - * Prints 'testEnum("%d")' where thing has been formatted into it's numeric value - * @param Numberz thing - the Numberz to print - * @return Numberz - returns the Numberz 'thing' - */ - Numberz testEnum(1: Numberz thing), - - /** - * Prints 'testTypedef("%d")' with thing as '%d' - * @param UserId thing - the UserId to print - * @return UserId - returns the UserId 'thing' - */ - UserId testTypedef(1: UserId thing), - - /** - * Prints 'testMapMap("%d")' with hello as '%d' - * @param i32 hello - the i32 to print - * @return map> - returns a dictionary with these values: - * {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } - */ - map> testMapMap(1: i32 hello), - - /** - * So you think you've got this all worked, out eh? - * - * Creates a the returned map with these values and prints it out: - * { 1 => { 2 => argument, - * 3 => argument, - * }, - * 2 => { 6 => , }, - * } - * @return map> - a map with the above values - */ - map> testInsanity(1: Insanity argument), - - /** - * Prints 'testMulti()' - * @param byte arg0 - - * @param i32 arg1 - - * @param i64 arg2 - - * @param map arg3 - - * @param Numberz arg4 - - * @param UserId arg5 - - * @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 - * and i64_thing = arg2 - */ - Xtruct testMulti(1: byte arg0, 2: i32 arg1, 3: i64 arg2, 4: map arg3, 5: Numberz arg4, 6: UserId arg5), - - /** - * Print 'testException(%s)' with arg as '%s' - * @param string arg - a string indication what type of exception to throw - * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg - * elsen if arg == "TException" throw TException - * else do not throw anything - */ - void testException(1: string arg) throws(1: Xception err1), - - /** - * Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' - * @param string arg - a string indication what type of exception to throw - * if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" - * elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2" - * else do not throw anything - * @return Xtruct - an Xtruct with string_thing = arg1 - */ - Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2) - - /** - * Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' - * sleep 'secondsToSleep' - * Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' - * @param i32 secondsToSleep - the number of seconds to sleep - */ - oneway void testOneway(1:i32 secondsToSleep) -} - -service SecondService -{ - void blahBlah() - /** - * Prints 'testString("%s")' with thing as '%s' - * @param string thing - the string to print - * @return string - returns the string 'thing' - */ - string secondtestString(1: string thing), -} - -struct VersioningTestV1 { - 1: i32 begin_in_both, - 3: string old_string, - 12: i32 end_in_both -} - -struct VersioningTestV2 { - 1: i32 begin_in_both, - - 2: i32 newint, - 3: byte newbyte, - 4: i16 newshort, - 5: i64 newlong, - 6: double newdouble - 7: Bonk newstruct, - 8: list newlist, - 9: set newset, - 10: map newmap, - 11: string newstring, - 12: i32 end_in_both -} - -struct ListTypeVersioningV1 { - 1: list myints; - 2: string hello; -} - -struct ListTypeVersioningV2 { - 1: list strings; - 2: string hello; -} - -struct GuessProtocolStruct { - 7: map map_field, -} - -struct LargeDeltas { - 1: Bools b1, - 10: Bools b10, - 100: Bools b100, - 500: bool check_true, - 1000: Bools b1000, - 1500: bool check_false, - 2000: VersioningTestV2 vertwo2000, - 2500: set a_set2500, - 3000: VersioningTestV2 vertwo3000, - 4000: list big_numbers -} - -struct NestedListsI32x2 { - 1: list> integerlist -} -struct NestedListsI32x3 { - 1: list>> integerlist -} -struct NestedMixedx2 { - 1: list> int_set_list - 2: map> map_int_strset - 3: list>> map_int_strset_list -} -struct ListBonks { - 1: list bonk -} -struct NestedListsBonk { - 1: list>> bonk -} - -struct BoolTest { - 1: optional bool b = true; - 2: optional string s = "true"; -} - -struct StructA { - 1: required string s; -} - -struct StructB { - 1: optional StructA aa; - 2: required StructA ab; -} diff --git a/test/Makefile.am b/test/Makefile.am index ff780c39611..51da3ba4220 100755 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -72,6 +72,10 @@ if WITH_HAXE SUBDIRS += haxe endif +if WITH_DOTNETCORE +SUBDIRS += netcore +endif + if WITH_GO SUBDIRS += go PRECROSS_TARGET += precross-go diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift index ca7087375bb..c56f571d6f8 100644 --- a/test/ThriftTest.thrift +++ b/test/ThriftTest.thrift @@ -37,6 +37,7 @@ namespace delphi Thrift.Test namespace cocoa ThriftTest namespace lua ThriftTest namespace xsd test (uri = 'http://thrift.apache.org/ns/ThriftTest') +namespace netcore ThriftAsync.Test // Presence of namespaces and sub-namespaces for which there is // no generator should compile with warnings only diff --git a/test/netcore/.gitignore b/test/netcore/.gitignore deleted file mode 100644 index f7842c38f0e..00000000000 --- a/test/netcore/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# generic ignores -!gen-* -bin/ -obj/ -*.lock.json \ No newline at end of file diff --git a/test/netcore/Makefile.am b/test/netcore/Makefile.am new file mode 100644 index 00000000000..21a6e7dde5d --- /dev/null +++ b/test/netcore/Makefile.am @@ -0,0 +1,68 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = . + +THRIFT = $(top_builddir)/compiler/cpp/thrift + +GENDIR = ThriftTest/gen-netcore + +# Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline. +# The problem does NOT affect Visual Studio builds, only cmdline. +# - For details see https://github.com/dotnet/cli/issues/3199 and related tickets. +# - Workaround is to temporarily copy the Thrift project into the solution +COPYCMD = cp -u -p -r + + +THRIFTCODE = \ + ThriftTest/TestClient.cs \ + ThriftTest/TestServer.cs \ + ThriftTest/Properties/AssemblyInfo.cs \ + ThriftTest/Program.cs + +all-local: \ + ThriftTest.exe + +ThriftTest.exe: $(THRIFTCODE) + $(MKDIR_P) $(GENDIR) + $(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(top_srcdir)/test/ThriftTest.thrift + $(MKDIR_P) ./Thrift + $(COPYCMD) $(top_srcdir)/lib/netcore/Thrift/* ./Thrift + $(DOTNETCORE) --info + $(DOTNETCORE) restore + $(DOTNETCORE) build **/*/project.json -r win10-x64 + $(DOTNETCORE) build **/*/project.json -r osx.10.11-x64 + $(DOTNETCORE) build **/*/project.json -r ubuntu.16.04-x64 + +clean-local: + $(RM) ThriftTest.exe + $(RM) -r $(GENDIR) + $(RM) -r ThriftTest/bin + $(RM) -r ThriftTest/obj + $(RM) -r Thrift + +EXTRA_DIST = \ + $(THRIFTCODE) \ + global.json \ + ThriftTest/project.json \ + ThriftTest/ThriftTest.sln \ + ThriftTest/ThriftTest.xproj \ + build.cmd \ + build.sh + diff --git a/test/netcore/ThriftTest/Program.cs b/test/netcore/ThriftTest/Program.cs index d8aea1df481..94ed9d91038 100644 --- a/test/netcore/ThriftTest/Program.cs +++ b/test/netcore/ThriftTest/Program.cs @@ -16,20 +16,15 @@ // under the License. using System; +using System.Collections.Generic; using Test; -namespace ThirftTest +namespace ThriftTest { public class Program { public static int Main(string[] args) { - if (args.Length == 0) - { - Console.WriteLine("must provide 'server' or 'client' arg"); - return -1; - } - try { Console.SetBufferSize(Console.BufferWidth, 4096); @@ -39,24 +34,41 @@ public static int Main(string[] args) Console.WriteLine("Failed to grow scroll-back buffer"); } - var subArgs = new string[args.Length - 1]; - for (var i = 1; i < args.Length; i++) - { - subArgs[i - 1] = args[i]; + // split mode and options + var subArgs = new List(args); + var firstArg = string.Empty; + if (subArgs.Count > 0) + { + firstArg = subArgs[0]; + subArgs.RemoveAt(0); } - if (args[0] == "client") + // run whatever mode is choosen + switch(firstArg) { - return TestClient.Execute(subArgs); + case "client": + return TestClient.Execute(subArgs); + case "server": + return TestServer.Execute(subArgs); + case "--help": + PrintHelp(); + return 0; + default: + PrintHelp(); + return -1; } + } - if (args[0] == "server") - { - return TestServer.Execute(subArgs) ? 0 : 1; - } + private static void PrintHelp() + { + Console.WriteLine("Usage:"); + Console.WriteLine(" ThriftTest server [options]'"); + Console.WriteLine(" ThriftTest client [options]'"); + Console.WriteLine(" ThriftTest --help"); + Console.WriteLine(""); - Console.WriteLine("first argument must be 'server' or 'client'"); - return 0; + TestServer.PrintOptionsHelp(); + TestClient.PrintOptionsHelp(); } } } diff --git a/test/netcore/ThriftTest/Properties/AssemblyInfo.cs b/test/netcore/ThriftTest/Properties/AssemblyInfo.cs index f6801b4f38c..efc9e334244 100644 --- a/test/netcore/ThriftTest/Properties/AssemblyInfo.cs +++ b/test/netcore/ThriftTest/Properties/AssemblyInfo.cs @@ -1,4 +1,20 @@ -using System.Reflection; +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -6,12 +22,12 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("ThirftTest")] +[assembly: AssemblyTitle("ThriftTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("$safeprojectname$")] -[assembly: AssemblyCopyright("Copyright © 116")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/test/netcore/ThriftTest/TestClient.cs b/test/netcore/ThriftTest/TestClient.cs index 7226d8017ff..d9f95634c71 100644 --- a/test/netcore/ThriftTest/TestClient.cs +++ b/test/netcore/ThriftTest/TestClient.cs @@ -26,7 +26,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using thrift.test; +using ThriftAsync.Test; using Thrift.Collections; using Thrift.Protocols; using Thrift.Transports; @@ -41,6 +41,7 @@ private class TestParams public int numIterations = 1; public IPAddress host = IPAddress.Loopback; public int port = 9090; + public int numThreads = 1; public string url; public string pipe; public bool buffered; @@ -48,6 +49,68 @@ private class TestParams public string protocol; public bool encrypted = false; + internal void Parse( List args) + { + for (var i = 0; i < args.Count; ++i) + { + if (args[i] == "-u") + { + url = args[++i]; + } + else if (args[i] == "-n") + { + numIterations = Convert.ToInt32(args[++i]); + } + else if (args[i].StartsWith("--pipe=")) + { + pipe = args[i].Substring(args[i].IndexOf("=") + 1); + Console.WriteLine("Using named pipes transport"); + } + else if (args[i].StartsWith("--host=")) + { + // check there for ipaddress + host = new IPAddress(Encoding.Unicode.GetBytes(args[i].Substring(args[i].IndexOf("=") + 1))); + } + else if (args[i].StartsWith("--port=")) + { + port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); + } + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") + { + buffered = true; + Console.WriteLine("Using buffered sockets"); + } + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") + { + framed = true; + Console.WriteLine("Using framed transport"); + } + else if (args[i] == "-t") + { + numThreads = Convert.ToInt32(args[++i]); + } + else if (args[i] == "--compact" || args[i] == "--protocol=compact") + { + protocol = "compact"; + Console.WriteLine("Using compact protocol"); + } + else if (args[i] == "--json" || args[i] == "--protocol=json") + { + protocol = "json"; + Console.WriteLine("Using JSON protocol"); + } + else if (args[i] == "--ssl") + { + encrypted = true; + Console.WriteLine("Using encrypted transport"); + } + else + { + throw new ArgumentException(args[i]); + } + } + } + public TClientTransport CreateTransport() { if (url == null) @@ -106,6 +169,7 @@ public TProtocol CreateProtocol(TClientTransport transport) } } + private const int ErrorBaseTypes = 1; private const int ErrorStructs = 2; private const int ErrorContainers = 4; @@ -115,7 +179,7 @@ public TProtocol CreateProtocol(TClientTransport transport) private class ClientTest { private readonly TClientTransport transport; - private readonly ThriftTest.Client client; + private readonly ThriftAsync.Test.ThriftTest.Client client; private readonly int numIterations; private bool done; @@ -124,7 +188,7 @@ private class ClientTest public ClientTest(TestParams param) { transport = param.CreateTransport(); - client = new ThriftTest.Client(param.CreateProtocol(transport)); + client = new ThriftAsync.Test.ThriftTest.Client(param.CreateProtocol(transport)); numIterations = param.numIterations; } @@ -180,68 +244,30 @@ public void Execute() } } - public static int Execute(string[] args) + internal static void PrintOptionsHelp() + { + Console.WriteLine("Client options:"); + Console.WriteLine(" -u "); + Console.WriteLine(" -t <# of threads to run> default = 1"); + Console.WriteLine(" -n <# of iterations> per thread"); + Console.WriteLine(" --pipe="); + Console.WriteLine(" --host="); + Console.WriteLine(" --port="); + Console.WriteLine(" --transport= one of buffered,framed (defaults to none)"); + Console.WriteLine(" --protocol= one of compact,json (defaults to binary)"); + Console.WriteLine(" --ssl"); + Console.WriteLine(); + } + + public static int Execute(List args) { try { var param = new TestParams(); - var numThreads = 1; + try { - for (var i = 0; i < args.Length; i++) - { - if (args[i] == "-u") - { - param.url = args[++i]; - } - else if (args[i] == "-n") - { - param.numIterations = Convert.ToInt32(args[++i]); - } - else if (args[i] == "-pipe") // -pipe - { - param.pipe = args[++i]; - Console.WriteLine("Using named pipes transport"); - } - else if (args[i].Contains("--host=")) - { - // check there for ipaddress - param.host = new IPAddress(Encoding.Unicode.GetBytes(args[i].Substring(args[i].IndexOf("=") + 1))); - } - else if (args[i].Contains("--port=")) - { - param.port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); - } - else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") - { - param.buffered = true; - Console.WriteLine("Using buffered sockets"); - } - else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") - { - param.framed = true; - Console.WriteLine("Using framed transport"); - } - else if (args[i] == "-t") - { - numThreads = Convert.ToInt32(args[++i]); - } - else if (args[i] == "--compact" || args[i] == "--protocol=compact") - { - param.protocol = "compact"; - Console.WriteLine("Using compact protocol"); - } - else if (args[i] == "--json" || args[i] == "--protocol=json") - { - param.protocol = "json"; - Console.WriteLine("Using JSON protocol"); - } - else if (args[i] == "--ssl") - { - param.encrypted = true; - Console.WriteLine("Using encrypted transport"); - } - } + param.Parse(args); } catch (Exception ex) { @@ -251,7 +277,7 @@ public static int Execute(string[] args) return ErrorUnknown; } - var tests = Enumerable.Range(0, numThreads).Select(_ => new ClientTest(param)).ToArray(); + var tests = Enumerable.Range(0, param.numThreads).Select(_ => new ClientTest(param)).ToArray(); //issue tests on separate threads simultaneously var threads = tests.Select(test => new Thread(test.Execute)).ToArray(); @@ -320,7 +346,7 @@ public static byte[] PrepareTestData(bool randomDist) return retval; } - public static async Task ExecuteClientTestAsync(ThriftTest.Client client) + public static async Task ExecuteClientTestAsync(ThriftAsync.Test.ThriftTest.Client client) { var token = CancellationToken.None; var returnCode = 0; @@ -721,9 +747,14 @@ public static async Task ExecuteClientTestAsync(ThriftTest.Client client) var arg2 = long.MaxValue; var multiDict = new Dictionary(); multiDict[1] = "one"; + + var tmpMultiDict = new List(); + foreach (var pair in multiDict) + tmpMultiDict.Add(pair.Key +" => "+ pair.Value); + var arg4 = Numberz.FIVE; long arg5 = 5000000; - Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")"); + Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + ",{" + string.Join(",", tmpMultiDict) + "}," + arg4 + "," + arg5 + ")"); var multiResponse = await client.testMultiAsync(arg0, arg1, arg2, multiDict, arg4, arg5, token); Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); diff --git a/test/netcore/ThriftTest/TestServer.cs b/test/netcore/ThriftTest/TestServer.cs index ad26ffd2819..7976c5d7fca 100644 --- a/test/netcore/ThriftTest/TestServer.cs +++ b/test/netcore/ThriftTest/TestServer.cs @@ -23,7 +23,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using thrift.test; +using ThriftAsync.Test; using Thrift; using Thrift.Collections; using Thrift.Protocols; @@ -33,12 +33,75 @@ namespace Test { + internal class ServerParam + { + internal bool useBufferedSockets = false; + internal bool useFramed = false; + internal bool useEncryption = false; + internal bool compact = false; + internal bool json = false; + internal int port = 9090; + internal string pipe = null; + + internal void Parse(List args) + { + for (var i = 0; i < args.Count; i++) + { + if (args[i].StartsWith("--pipe=")) + { + pipe = args[i].Substring(args[i].IndexOf("=") + 1); + } + else if (args[i].StartsWith("--port=")) + { + port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); + } + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") + { + useBufferedSockets = true; + } + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") + { + useFramed = true; + } + else if (args[i] == "--compact" || args[i] == "--protocol=compact") + { + compact = true; + } + else if (args[i] == "--json" || args[i] == "--protocol=json") + { + json = true; + } + else if (args[i] == "--threaded" || args[i] == "--server-type=threaded") + { + throw new NotImplementedException(args[i]); + } + else if (args[i] == "--threadpool" || args[i] == "--server-type=threadpool") + { + throw new NotImplementedException(args[i]); + } + else if (args[i] == "--prototype" || args[i] == "--processor=prototype") + { + throw new NotImplementedException(args[i]); + } + else if (args[i] == "--ssl") + { + useEncryption = true; + } + else + { + throw new ArgumentException(args[i]); + } + } + + } + } + public class TestServer { public static int _clientID = -1; public delegate void TestLogDelegate(string msg, params object[] values); - public class TradeServerEventHandler : TServerEventHandler + public class MyServerEventHandler : TServerEventHandler { public int callCount = 0; @@ -67,88 +130,88 @@ public Task ProcessContextAsync(object serverContext, TClientTransport transport } }; - public class TestHandlerAsync : ThriftTest.IAsync + public class TestHandlerAsync : ThriftAsync.Test.ThriftTest.IAsync { public TBaseServer server { get; set; } private int handlerID; - private StringBuilder reusableStringBuilder = new StringBuilder(); - private TestLogDelegate testLogDelegate; + private StringBuilder sb = new StringBuilder(); + private TestLogDelegate logger; public TestHandlerAsync() { handlerID = Interlocked.Increment(ref _clientID); - testLogDelegate += testConsoleLogger; - testLogDelegate.Invoke("New TestHandler instance created"); + logger += testConsoleLogger; + logger.Invoke("New TestHandler instance created"); } public void testConsoleLogger(string msg, params object[] values) { - reusableStringBuilder.Clear(); - reusableStringBuilder.AppendFormat("handler{0:D3}:", handlerID); - reusableStringBuilder.AppendFormat(msg, values); - reusableStringBuilder.AppendLine(); - Console.Write(reusableStringBuilder.ToString()); + sb.Clear(); + sb.AppendFormat("handler{0:D3}:", handlerID); + sb.AppendFormat(msg, values); + sb.AppendLine(); + Console.Write(sb.ToString()); } public Task testVoidAsync(CancellationToken cancellationToken) { - testLogDelegate.Invoke("testVoid()"); + logger.Invoke("testVoid()"); return Task.CompletedTask; } public Task testStringAsync(string thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testString({0})", thing); + logger.Invoke("testString({0})", thing); return Task.FromResult(thing); } public Task testBoolAsync(bool thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testBool({0})", thing); + logger.Invoke("testBool({0})", thing); return Task.FromResult(thing); } public Task testByteAsync(sbyte thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testByte({0})", thing); + logger.Invoke("testByte({0})", thing); return Task.FromResult(thing); } public Task testI32Async(int thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testI32({0})", thing); + logger.Invoke("testI32({0})", thing); return Task.FromResult(thing); } public Task testI64Async(long thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testI64({0})", thing); + logger.Invoke("testI64({0})", thing); return Task.FromResult(thing); } public Task testDoubleAsync(double thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testDouble({0})", thing); + logger.Invoke("testDouble({0})", thing); return Task.FromResult(thing); } public Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) { var hex = BitConverter.ToString(thing).Replace("-", string.Empty); - testLogDelegate.Invoke("testBinary({0:X})", hex); + logger.Invoke("testBinary({0:X})", hex); return Task.FromResult(thing); } public Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing.String_thing, thing.Byte_thing, thing.I32_thing, thing.I64_thing); + logger.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing.String_thing, thing.Byte_thing, thing.I32_thing, thing.I64_thing); return Task.FromResult(thing); } public Task testNestAsync(Xtruct2 nest, CancellationToken cancellationToken) { var thing = nest.Struct_thing; - testLogDelegate.Invoke("testNest({{{0}, {{\"{1}\", {2}, {3}, {4}, {5}}}}})", + logger.Invoke("testNest({{{0}, {{\"{1}\", {2}, {3}, {4}, {5}}}}})", nest.Byte_thing, thing.String_thing, thing.Byte_thing, @@ -160,8 +223,8 @@ public Task testNestAsync(Xtruct2 nest, CancellationToken cancellationT public Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken) { - reusableStringBuilder.Clear(); - reusableStringBuilder.Append("testMap({{"); + sb.Clear(); + sb.Append("testMap({{"); var first = true; foreach (var key in thing.Keys) { @@ -171,19 +234,19 @@ public Task> testMapAsync(Dictionary thing, Cance } else { - reusableStringBuilder.Append(", "); + sb.Append(", "); } - reusableStringBuilder.AppendFormat("{0} => {1}", key, thing[key]); + sb.AppendFormat("{0} => {1}", key, thing[key]); } - reusableStringBuilder.Append("}})"); - testLogDelegate.Invoke(reusableStringBuilder.ToString()); + sb.Append("}})"); + logger.Invoke(sb.ToString()); return Task.FromResult(thing); } public Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken) { - reusableStringBuilder.Clear(); - reusableStringBuilder.Append("testStringMap({{"); + sb.Clear(); + sb.Append("testStringMap({{"); var first = true; foreach (var key in thing.Keys) { @@ -193,19 +256,19 @@ public Task> testStringMapAsync(Dictionary {1}", key, thing[key]); + sb.AppendFormat("{0} => {1}", key, thing[key]); } - reusableStringBuilder.Append("}})"); - testLogDelegate.Invoke(reusableStringBuilder.ToString()); + sb.Append("}})"); + logger.Invoke(sb.ToString()); return Task.FromResult(thing); } public Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) { - reusableStringBuilder.Clear(); - reusableStringBuilder.Append("testSet({{"); + sb.Clear(); + sb.Append("testSet({{"); var first = true; foreach (int elem in thing) { @@ -215,19 +278,19 @@ public Task> testSetAsync(THashSet thing, CancellationToken c } else { - reusableStringBuilder.Append(", "); + sb.Append(", "); } - reusableStringBuilder.AppendFormat("{0}", elem); + sb.AppendFormat("{0}", elem); } - reusableStringBuilder.Append("}})"); - testLogDelegate.Invoke(reusableStringBuilder.ToString()); + sb.Append("}})"); + logger.Invoke(sb.ToString()); return Task.FromResult(thing); } public Task> testListAsync(List thing, CancellationToken cancellationToken) { - reusableStringBuilder.Clear(); - reusableStringBuilder.Append("testList({{"); + sb.Clear(); + sb.Append("testList({{"); var first = true; foreach (var elem in thing) { @@ -237,30 +300,30 @@ public Task> testListAsync(List thing, CancellationToken cancella } else { - reusableStringBuilder.Append(", "); + sb.Append(", "); } - reusableStringBuilder.AppendFormat("{0}", elem); + sb.AppendFormat("{0}", elem); } - reusableStringBuilder.Append("}})"); - testLogDelegate.Invoke(reusableStringBuilder.ToString()); + sb.Append("}})"); + logger.Invoke(sb.ToString()); return Task.FromResult(thing); } public Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testEnum({0})", thing); + logger.Invoke("testEnum({0})", thing); return Task.FromResult(thing); } public Task testTypedefAsync(long thing, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testTypedef({0})", thing); + logger.Invoke("testTypedef({0})", thing); return Task.FromResult(thing); } public Task>> testMapMapAsync(int hello, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testMapMap({0})", hello); + logger.Invoke("testMapMap({0})", hello); var mapmap = new Dictionary>(); var pos = new Dictionary(); @@ -279,45 +342,27 @@ public Task>> testMapMapAsync(int hello, Ca public Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testInsanity()"); - - var hello = new Xtruct - { - String_thing = "Hello2", - Byte_thing = 2, - I32_thing = 2, - I64_thing = 2 - }; - - var goodbye = new Xtruct - { - String_thing = "Goodbye4", - Byte_thing = 4, - I32_thing = 4, - I64_thing = 4 - }; - - var crazy = new Insanity - { - UserMap = new Dictionary {[Numberz.EIGHT] = 8}, - Xtructs = new List {goodbye} - }; - - var looney = new Insanity - { - UserMap = new Dictionary { [Numberz.FIVE] = 5}, - Xtructs = new List() - }; - - looney.Xtructs.Add(hello); + logger.Invoke("testInsanity()"); + + /** from ThriftTest.thrift: + * So you think you've got this all worked, out eh? + * + * Creates a the returned map with these values and prints it out: + * { 1 => { 2 => argument, + * 3 => argument, + * }, + * 2 => { 6 => , }, + * } + * @return map> - a map with the above values + */ var first_map = new Dictionary(); var second_map = new Dictionary(); ; - first_map[Numberz.TWO] = crazy; - first_map[Numberz.THREE] = crazy; + first_map[Numberz.TWO] = argument; + first_map[Numberz.THREE] = argument; - second_map[Numberz.SIX] = looney; + second_map[Numberz.SIX] = new Insanity(); var insane = new Dictionary> { @@ -331,7 +376,7 @@ public Task>> testInsanityAsync(I public Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testMulti()"); + logger.Invoke("testMulti()"); var hello = new Xtruct(); ; hello.String_thing = "Hello2"; @@ -343,7 +388,7 @@ public Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testMultiException({0}, {1})", arg0, arg1); + logger.Invoke("testMultiException({0}, {1})", arg0, arg1); if (arg0 == "Xception") { var x = new Xception @@ -378,20 +423,20 @@ public Task testMultiExceptionAsync(string arg0, string arg1, Cancellati var x = new Xception2 { ErrorCode = 2002, - Struct_thing = new Xtruct {String_thing = "This is an Xception2"} + Struct_thing = new Xtruct { String_thing = "This is an Xception2" } }; throw x; } - var result = new Xtruct {String_thing = arg1}; + var result = new Xtruct { String_thing = arg1 }; return Task.FromResult(result); } public Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) { - testLogDelegate.Invoke("testOneway({0}), sleeping...", secondsToSleep); + logger.Invoke("testOneway({0}), sleeping...", secondsToSleep); Thread.Sleep(secondsToSleep * 1000); - testLogDelegate.Invoke("testOneway finished"); + logger.Invoke("testOneway finished"); return Task.CompletedTask; } @@ -404,80 +449,63 @@ private enum ProcessorFactoryType TPrototypeProcessorFactory, } - public static bool Execute(string[] args) + internal static void PrintOptionsHelp() + { + Console.WriteLine("Server options:"); + Console.WriteLine(" --pipe="); + Console.WriteLine(" --port="); + Console.WriteLine(" --transport= one of buffered,framed (defaults to none)"); + Console.WriteLine(" --protocol= one of compact,json (defaults to binary)"); + Console.WriteLine(" --server-type= one of threaded,threadpool (defaults to simple)"); + Console.WriteLine(" --processor="); + Console.WriteLine(" --ssl"); + Console.WriteLine(); + } + + public static int Execute(List args) { var logger = new LoggerFactory().CreateLogger("Test"); try { - bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false; + var param = new ServerParam(); - var port = 9090; - string pipe = null; - for (var i = 0; i < args.Length; i++) + try { - if (args[i] == "-pipe") // -pipe name - { - pipe = args[++i]; - } - else if (args[i].Contains("--port=")) - { - port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1)); - } - else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") - { - useBufferedSockets = true; - } - else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") - { - useFramed = true; - } - else if (args[i] == "--compact" || args[i] == "--protocol=compact") - { - compact = true; - } - else if (args[i] == "--json" || args[i] == "--protocol=json") - { - json = true; - } - else if (args[i] == "--threaded" || args[i] == "--server-type=threaded") - { - } - else if (args[i] == "--threadpool" || args[i] == "--server-type=threadpool") - { - } - else if (args[i] == "--prototype" || args[i] == "--processor=prototype") - { - } - else if (args[i] == "--ssl") - { - useEncryption = true; - } + param.Parse(args); + } + catch (Exception ex) + { + Console.WriteLine("*** FAILED ***"); + Console.WriteLine("Error while parsing arguments"); + Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); + return 1; } + // Transport TServerTransport trans; - if (pipe != null) + if (param.pipe != null) { - trans = new TNamedPipeServerTransport(pipe); + trans = new TNamedPipeServerTransport(param.pipe); } else { - if (useEncryption) + if (param.useEncryption) { var certPath = "../keys/server.p12"; - trans = new TTlsServerSocketTransport(port, useBufferedSockets, new X509Certificate2(certPath, "thrift"), null, null, SslProtocols.Tls12); + trans = new TTlsServerSocketTransport(param.port, param.useBufferedSockets, new X509Certificate2(certPath, "thrift"), null, null, SslProtocols.Tls12); } else { - trans = new TServerSocketTransport(port, 0, useBufferedSockets); + trans = new TServerSocketTransport(param.port, 0, param.useBufferedSockets); } } ITProtocolFactory proto; - if (compact) + if (param.compact) proto = new TCompactProtocol.Factory(); - else if (json) + else if (param.json) proto = new TJsonProtocol.Factory(); else proto = new TBinaryProtocol.Factory(); @@ -486,31 +514,31 @@ public static bool Execute(string[] args) // Processor var testHandler = new TestHandlerAsync(); - var testProcessor = new ThriftTest.AsyncProcessor(testHandler); + var testProcessor = new ThriftAsync.Test.ThriftTest.AsyncProcessor(testHandler); processorFactory = new SingletonTProcessorFactory(testProcessor); - + TTransportFactory transFactory; - //if (useFramed) - // transFactory = new TFramedTransport.Factory(); - //else - transFactory = new TTransportFactory(); + if (param.useFramed) + throw new NotImplementedException("framed"); // transFactory = new TFramedTransport.Factory(); + else + transFactory = new TTransportFactory(); TBaseServer serverEngine = new AsyncBaseServer(processorFactory, trans, transFactory, transFactory, proto, proto, logger); //Server event handler - var serverEvents = new TradeServerEventHandler(); + var serverEvents = new MyServerEventHandler(); serverEngine.SetEventHandler(serverEvents); // Run it - var where = (pipe != null ? "on pipe " + pipe : "on port " + port); - Console.WriteLine("Starting the AsyncBaseServer " + where + + var where = (! string.IsNullOrEmpty(param.pipe)) ? "on pipe " + param.pipe : "on port " + param.port; + Console.WriteLine("Starting the AsyncBaseServer " + where + " with processor TPrototypeProcessorFactory prototype factory " + - (useBufferedSockets ? " with buffered socket" : "") + - (useFramed ? " with framed transport" : "") + - (useEncryption ? " with encryption" : "") + - (compact ? " with compact protocol" : "") + - (json ? " with json protocol" : "") + + (param.useBufferedSockets ? " with buffered socket" : "") + + (param.useFramed ? " with framed transport" : "") + + (param.useEncryption ? " with encryption" : "") + + (param.compact ? " with compact protocol" : "") + + (param.json ? " with json protocol" : "") + "..."); serverEngine.ServeAsync(CancellationToken.None).GetAwaiter().GetResult(); Console.ReadLine(); @@ -518,10 +546,11 @@ public static bool Execute(string[] args) catch (Exception x) { Console.Error.Write(x); - return false; + return 1; } Console.WriteLine("done."); - return true; + return 0; } } -} \ No newline at end of file + +} diff --git a/test/netcore/ThriftTest/ThirftTest.sln b/test/netcore/ThriftTest/ThriftTest.sln similarity index 87% rename from test/netcore/ThriftTest/ThirftTest.sln rename to test/netcore/ThriftTest/ThriftTest.sln index 2687eab2238..03b4f3d6782 100644 --- a/test/netcore/ThriftTest/ThirftTest.sln +++ b/test/netcore/ThriftTest/ThriftTest.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ThirftTest", "ThirftTest.xproj", "{B0C13DA0-3117-4844-8AE8-B1775E46223D}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ThriftTest", "ThriftTest.xproj", "{B0C13DA0-3117-4844-8AE8-B1775E46223D}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "..\..\..\lib\netcore\src\Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "..\..\..\lib\netcore\Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{839DBA0F-2D58-4266-A30D-3392BD710A59}" ProjectSection(SolutionItems) = preProject diff --git a/test/netcore/ThriftTest/ThirftTest.xproj b/test/netcore/ThriftTest/ThriftTest.xproj similarity index 96% rename from test/netcore/ThriftTest/ThirftTest.xproj rename to test/netcore/ThriftTest/ThriftTest.xproj index 69022c665a5..7746cc88ebd 100644 --- a/test/netcore/ThriftTest/ThirftTest.xproj +++ b/test/netcore/ThriftTest/ThriftTest.xproj @@ -8,7 +8,7 @@ B0C13DA0-3117-4844-8AE8-B1775E46223D - ThirftTest + ThriftTest obj\$(MSBuildProjectName) bin\$(MSBuildProjectName)\ v4.5.2 diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs deleted file mode 100644 index 38a43061fa1..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bonk.cs +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Bonk : TBase - { - private string _message; - private int _type; - - public string Message - { - get - { - return _message; - } - set - { - __isset.message = true; - this._message = value; - } - } - - public int Type - { - get - { - return _type; - } - set - { - __isset.type = true; - this._type = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool message; - public bool type; - } - - public Bonk() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Message = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Type = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Bonk"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Message != null && __isset.message) - { - field.Name = "message"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Message, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.type) - { - field.Name = "type"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Type, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Bonk("); - bool __first = true; - if (Message != null && __isset.message) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Message: "); - sb.Append(Message); - } - if (__isset.type) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Type: "); - sb.Append(Type); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs deleted file mode 100644 index 47c005b760a..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/BoolTest.cs +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class BoolTest : TBase - { - private bool _b; - private string _s; - - public bool B - { - get - { - return _b; - } - set - { - __isset.b = true; - this._b = value; - } - } - - public string S - { - get - { - return _s; - } - set - { - __isset.s = true; - this._s = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool b; - public bool s; - } - - public BoolTest() - { - this._b = true; - this.__isset.b = true; - this._s = "true"; - this.__isset.s = true; - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - B = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - S = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("BoolTest"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.b) - { - field.Name = "b"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(B, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (S != null && __isset.s) - { - field.Name = "s"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(S, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("BoolTest("); - bool __first = true; - if (__isset.b) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("B: "); - sb.Append(B); - } - if (S != null && __isset.s) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("S: "); - sb.Append(S); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs deleted file mode 100644 index 83c13db765f..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Bools.cs +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Bools : TBase - { - private bool _im_true; - private bool _im_false; - - public bool Im_true - { - get - { - return _im_true; - } - set - { - __isset.im_true = true; - this._im_true = value; - } - } - - public bool Im_false - { - get - { - return _im_false; - } - set - { - __isset.im_false = true; - this._im_false = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool im_true; - public bool im_false; - } - - public Bools() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - Im_true = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Bool) - { - Im_false = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Bools"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.im_true) - { - field.Name = "im_true"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Im_true, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.im_false) - { - field.Name = "im_false"; - field.Type = TType.Bool; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Im_false, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Bools("); - bool __first = true; - if (__isset.im_true) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Im_true: "); - sb.Append(Im_true); - } - if (__isset.im_false) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Im_false: "); - sb.Append(Im_false); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs deleted file mode 100644 index e0f26011343..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/CrazyNesting.cs +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class CrazyNesting : TBase - { - private string _string_field; - private THashSet _set_field; - private byte[] _binary_field; - - public string String_field - { - get - { - return _string_field; - } - set - { - __isset.string_field = true; - this._string_field = value; - } - } - - public THashSet Set_field - { - get - { - return _set_field; - } - set - { - __isset.set_field = true; - this._set_field = value; - } - } - - public List, Dictionary>>>>> List_field { get; set; } - - public byte[] Binary_field - { - get - { - return _binary_field; - } - set - { - __isset.binary_field = true; - this._binary_field = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool string_field; - public bool set_field; - public bool binary_field; - } - - public CrazyNesting() - { - } - - public CrazyNesting(List, Dictionary>>>>> list_field) : this() - { - this.List_field = list_field; - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_list_field = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_field = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Set) - { - { - Set_field = new THashSet(); - TSet _set9 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i10 = 0; _i10 < _set9.Count; ++_i10) - { - Insanity _elem11; - _elem11 = new Insanity(); - await _elem11.ReadAsync(iprot, cancellationToken); - Set_field.Add(_elem11); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.List) - { - { - List_field = new List, Dictionary>>>>>(); - TList _list12 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i13 = 0; _i13 < _list12.Count; ++_i13) - { - Dictionary, Dictionary>>>> _elem14; - { - _elem14 = new Dictionary, Dictionary>>>>(); - TMap _map15 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i16 = 0; _i16 < _map15.Count; ++_i16) - { - THashSet _key17; - Dictionary>>> _val18; - { - _key17 = new THashSet(); - TSet _set19 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i20 = 0; _i20 < _set19.Count; ++_i20) - { - int _elem21; - _elem21 = await iprot.ReadI32Async(cancellationToken); - _key17.Add(_elem21); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - { - _val18 = new Dictionary>>>(); - TMap _map22 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i23 = 0; _i23 < _map22.Count; ++_i23) - { - int _key24; - THashSet>> _val25; - _key24 = await iprot.ReadI32Async(cancellationToken); - { - _val25 = new THashSet>>(); - TSet _set26 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i27 = 0; _i27 < _set26.Count; ++_i27) - { - List> _elem28; - { - _elem28 = new List>(); - TList _list29 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i30 = 0; _i30 < _list29.Count; ++_i30) - { - Dictionary _elem31; - { - _elem31 = new Dictionary(); - TMap _map32 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i33 = 0; _i33 < _map32.Count; ++_i33) - { - Insanity _key34; - string _val35; - _key34 = new Insanity(); - await _key34.ReadAsync(iprot, cancellationToken); - _val35 = await iprot.ReadStringAsync(cancellationToken); - _elem31[_key34] = _val35; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - _elem28.Add(_elem31); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _val25.Add(_elem28); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - _val18[_key24] = _val25; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - _elem14[_key17] = _val18; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - List_field.Add(_elem14); - } - await iprot.ReadListEndAsync(cancellationToken); - } - isset_list_field = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Binary_field = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_list_field) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("CrazyNesting"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_field != null && __isset.string_field) - { - field.Name = "string_field"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_field, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Set_field != null && __isset.set_field) - { - field.Name = "set_field"; - field.Type = TType.Set; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.Struct, Set_field.Count), cancellationToken); - foreach (Insanity _iter36 in Set_field) - { - await _iter36.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "list_field"; - field.Type = TType.List; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Map, List_field.Count), cancellationToken); - foreach (Dictionary, Dictionary>>>> _iter37 in List_field) - { - { - await oprot.WriteMapBeginAsync(new TMap(TType.Set, TType.Map, _iter37.Count), cancellationToken); - foreach (THashSet _iter38 in _iter37.Keys) - { - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter38.Count), cancellationToken); - foreach (int _iter39 in _iter38) - { - await oprot.WriteI32Async(_iter39, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter37[_iter38].Count), cancellationToken); - foreach (int _iter40 in _iter37[_iter38].Keys) - { - await oprot.WriteI32Async(_iter40, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.List, _iter37[_iter38][_iter40].Count), cancellationToken); - foreach (List> _iter41 in _iter37[_iter38][_iter40]) - { - { - await oprot.WriteListBeginAsync(new TList(TType.Map, _iter41.Count), cancellationToken); - foreach (Dictionary _iter42 in _iter41) - { - { - await oprot.WriteMapBeginAsync(new TMap(TType.Struct, TType.String, _iter42.Count), cancellationToken); - foreach (Insanity _iter43 in _iter42.Keys) - { - await _iter43.WriteAsync(oprot, cancellationToken); - await oprot.WriteStringAsync(_iter42[_iter43], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - if (Binary_field != null && __isset.binary_field) - { - field.Name = "binary_field"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Binary_field, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("CrazyNesting("); - bool __first = true; - if (String_field != null && __isset.string_field) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("String_field: "); - sb.Append(String_field); - } - if (Set_field != null && __isset.set_field) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Set_field: "); - sb.Append(Set_field); - } - if(!__first) { sb.Append(", "); } - sb.Append("List_field: "); - sb.Append(List_field); - if (Binary_field != null && __isset.binary_field) - { - sb.Append(", Binary_field: "); - sb.Append(Binary_field); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs deleted file mode 100644 index 4825ca4df9e..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/EmptyStruct.cs +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class EmptyStruct : TBase - { - - public EmptyStruct() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("EmptyStruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("EmptyStruct("); - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs deleted file mode 100644 index 2667fc84db7..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/GuessProtocolStruct.cs +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class GuessProtocolStruct : TBase - { - private Dictionary _map_field; - - public Dictionary Map_field - { - get - { - return _map_field; - } - set - { - __isset.map_field = true; - this._map_field = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool map_field; - } - - public GuessProtocolStruct() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 7: - if (field.Type == TType.Map) - { - { - Map_field = new Dictionary(); - TMap _map65 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i66 = 0; _i66 < _map65.Count; ++_i66) - { - string _key67; - string _val68; - _key67 = await iprot.ReadStringAsync(cancellationToken); - _val68 = await iprot.ReadStringAsync(cancellationToken); - Map_field[_key67] = _val68; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("GuessProtocolStruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Map_field != null && __isset.map_field) - { - field.Name = "map_field"; - field.Type = TType.Map; - field.ID = 7; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Map_field.Count), cancellationToken); - foreach (string _iter69 in Map_field.Keys) - { - await oprot.WriteStringAsync(_iter69, cancellationToken); - await oprot.WriteStringAsync(Map_field[_iter69], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("GuessProtocolStruct("); - bool __first = true; - if (Map_field != null && __isset.map_field) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Map_field: "); - sb.Append(Map_field); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs deleted file mode 100644 index 87ad0f99d92..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Insanity.cs +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Insanity : TBase - { - private Dictionary _userMap; - private List _xtructs; - - public Dictionary UserMap - { - get - { - return _userMap; - } - set - { - __isset.userMap = true; - this._userMap = value; - } - } - - public List Xtructs - { - get - { - return _xtructs; - } - set - { - __isset.xtructs = true; - this._xtructs = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool userMap; - public bool xtructs; - } - - public Insanity() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - UserMap = new Dictionary(); - TMap _map0 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i1 = 0; _i1 < _map0.Count; ++_i1) - { - Numberz _key2; - long _val3; - _key2 = (Numberz)await iprot.ReadI32Async(cancellationToken); - _val3 = await iprot.ReadI64Async(cancellationToken); - UserMap[_key2] = _val3; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.List) - { - { - Xtructs = new List(); - TList _list4 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i5 = 0; _i5 < _list4.Count; ++_i5) - { - Xtruct _elem6; - _elem6 = new Xtruct(); - await _elem6.ReadAsync(iprot, cancellationToken); - Xtructs.Add(_elem6); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Insanity"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (UserMap != null && __isset.userMap) - { - field.Name = "userMap"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I64, UserMap.Count), cancellationToken); - foreach (Numberz _iter7 in UserMap.Keys) - { - await oprot.WriteI32Async((int)_iter7, cancellationToken); - await oprot.WriteI64Async(UserMap[_iter7], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Xtructs != null && __isset.xtructs) - { - field.Name = "xtructs"; - field.Type = TType.List; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Xtructs.Count), cancellationToken); - foreach (Xtruct _iter8 in Xtructs) - { - await _iter8.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Insanity("); - bool __first = true; - if (UserMap != null && __isset.userMap) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("UserMap: "); - sb.Append(UserMap); - } - if (Xtructs != null && __isset.xtructs) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Xtructs: "); - sb.Append(Xtructs); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs deleted file mode 100644 index db4b5a0891b..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/LargeDeltas.cs +++ /dev/null @@ -1,550 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class LargeDeltas : TBase - { - private Bools _b1; - private Bools _b10; - private Bools _b100; - private bool _check_true; - private Bools _b1000; - private bool _check_false; - private VersioningTestV2 _vertwo2000; - private THashSet _a_set2500; - private VersioningTestV2 _vertwo3000; - private List _big_numbers; - - public Bools B1 - { - get - { - return _b1; - } - set - { - __isset.b1 = true; - this._b1 = value; - } - } - - public Bools B10 - { - get - { - return _b10; - } - set - { - __isset.b10 = true; - this._b10 = value; - } - } - - public Bools B100 - { - get - { - return _b100; - } - set - { - __isset.b100 = true; - this._b100 = value; - } - } - - public bool Check_true - { - get - { - return _check_true; - } - set - { - __isset.check_true = true; - this._check_true = value; - } - } - - public Bools B1000 - { - get - { - return _b1000; - } - set - { - __isset.b1000 = true; - this._b1000 = value; - } - } - - public bool Check_false - { - get - { - return _check_false; - } - set - { - __isset.check_false = true; - this._check_false = value; - } - } - - public VersioningTestV2 Vertwo2000 - { - get - { - return _vertwo2000; - } - set - { - __isset.vertwo2000 = true; - this._vertwo2000 = value; - } - } - - public THashSet A_set2500 - { - get - { - return _a_set2500; - } - set - { - __isset.a_set2500 = true; - this._a_set2500 = value; - } - } - - public VersioningTestV2 Vertwo3000 - { - get - { - return _vertwo3000; - } - set - { - __isset.vertwo3000 = true; - this._vertwo3000 = value; - } - } - - public List Big_numbers - { - get - { - return _big_numbers; - } - set - { - __isset.big_numbers = true; - this._big_numbers = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool b1; - public bool b10; - public bool b100; - public bool check_true; - public bool b1000; - public bool check_false; - public bool vertwo2000; - public bool a_set2500; - public bool vertwo3000; - public bool big_numbers; - } - - public LargeDeltas() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - B1 = new Bools(); - await B1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 10: - if (field.Type == TType.Struct) - { - B10 = new Bools(); - await B10.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 100: - if (field.Type == TType.Struct) - { - B100 = new Bools(); - await B100.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 500: - if (field.Type == TType.Bool) - { - Check_true = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1000: - if (field.Type == TType.Struct) - { - B1000 = new Bools(); - await B1000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1500: - if (field.Type == TType.Bool) - { - Check_false = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2000: - if (field.Type == TType.Struct) - { - Vertwo2000 = new VersioningTestV2(); - await Vertwo2000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2500: - if (field.Type == TType.Set) - { - { - A_set2500 = new THashSet(); - TSet _set70 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i71 = 0; _i71 < _set70.Count; ++_i71) - { - string _elem72; - _elem72 = await iprot.ReadStringAsync(cancellationToken); - A_set2500.Add(_elem72); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3000: - if (field.Type == TType.Struct) - { - Vertwo3000 = new VersioningTestV2(); - await Vertwo3000.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4000: - if (field.Type == TType.List) - { - { - Big_numbers = new List(); - TList _list73 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i74 = 0; _i74 < _list73.Count; ++_i74) - { - int _elem75; - _elem75 = await iprot.ReadI32Async(cancellationToken); - Big_numbers.Add(_elem75); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("LargeDeltas"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (B1 != null && __isset.b1) - { - field.Name = "b1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B10 != null && __isset.b10) - { - field.Name = "b10"; - field.Type = TType.Struct; - field.ID = 10; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B10.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B100 != null && __isset.b100) - { - field.Name = "b100"; - field.Type = TType.Struct; - field.ID = 100; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B100.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.check_true) - { - field.Name = "check_true"; - field.Type = TType.Bool; - field.ID = 500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Check_true, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (B1000 != null && __isset.b1000) - { - field.Name = "b1000"; - field.Type = TType.Struct; - field.ID = 1000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await B1000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.check_false) - { - field.Name = "check_false"; - field.Type = TType.Bool; - field.ID = 1500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Check_false, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Vertwo2000 != null && __isset.vertwo2000) - { - field.Name = "vertwo2000"; - field.Type = TType.Struct; - field.ID = 2000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Vertwo2000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (A_set2500 != null && __isset.a_set2500) - { - field.Name = "a_set2500"; - field.Type = TType.Set; - field.ID = 2500; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.String, A_set2500.Count), cancellationToken); - foreach (string _iter76 in A_set2500) - { - await oprot.WriteStringAsync(_iter76, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Vertwo3000 != null && __isset.vertwo3000) - { - field.Name = "vertwo3000"; - field.Type = TType.Struct; - field.ID = 3000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Vertwo3000.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Big_numbers != null && __isset.big_numbers) - { - field.Name = "big_numbers"; - field.Type = TType.List; - field.ID = 4000; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Big_numbers.Count), cancellationToken); - foreach (int _iter77 in Big_numbers) - { - await oprot.WriteI32Async(_iter77, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("LargeDeltas("); - bool __first = true; - if (B1 != null && __isset.b1) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("B1: "); - sb.Append(B1== null ? "" : B1.ToString()); - } - if (B10 != null && __isset.b10) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("B10: "); - sb.Append(B10== null ? "" : B10.ToString()); - } - if (B100 != null && __isset.b100) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("B100: "); - sb.Append(B100== null ? "" : B100.ToString()); - } - if (__isset.check_true) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Check_true: "); - sb.Append(Check_true); - } - if (B1000 != null && __isset.b1000) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("B1000: "); - sb.Append(B1000== null ? "" : B1000.ToString()); - } - if (__isset.check_false) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Check_false: "); - sb.Append(Check_false); - } - if (Vertwo2000 != null && __isset.vertwo2000) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Vertwo2000: "); - sb.Append(Vertwo2000== null ? "" : Vertwo2000.ToString()); - } - if (A_set2500 != null && __isset.a_set2500) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("A_set2500: "); - sb.Append(A_set2500); - } - if (Vertwo3000 != null && __isset.vertwo3000) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Vertwo3000: "); - sb.Append(Vertwo3000== null ? "" : Vertwo3000.ToString()); - } - if (Big_numbers != null && __isset.big_numbers) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Big_numbers: "); - sb.Append(Big_numbers); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs deleted file mode 100644 index d04e404339a..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListBonks.cs +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class ListBonks : TBase - { - private List _bonk; - - public List Bonk - { - get - { - return _bonk; - } - set - { - __isset.bonk = true; - this._bonk = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool bonk; - } - - public ListBonks() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Bonk = new List(); - TList _list128 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i129 = 0; _i129 < _list128.Count; ++_i129) - { - Bonk _elem130; - _elem130 = new Bonk(); - await _elem130.ReadAsync(iprot, cancellationToken); - Bonk.Add(_elem130); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListBonks"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Bonk != null && __isset.bonk) - { - field.Name = "bonk"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, Bonk.Count), cancellationToken); - foreach (Bonk _iter131 in Bonk) - { - await _iter131.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ListBonks("); - bool __first = true; - if (Bonk != null && __isset.bonk) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Bonk: "); - sb.Append(Bonk); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs deleted file mode 100644 index 258da1a074b..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV1.cs +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class ListTypeVersioningV1 : TBase - { - private List _myints; - private string _hello; - - public List Myints - { - get - { - return _myints; - } - set - { - __isset.myints = true; - this._myints = value; - } - } - - public string Hello - { - get - { - return _hello; - } - set - { - __isset.hello = true; - this._hello = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool myints; - public bool hello; - } - - public ListTypeVersioningV1() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Myints = new List(); - TList _list57 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i58 = 0; _i58 < _list57.Count; ++_i58) - { - int _elem59; - _elem59 = await iprot.ReadI32Async(cancellationToken); - Myints.Add(_elem59); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Hello = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListTypeVersioningV1"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Myints != null && __isset.myints) - { - field.Name = "myints"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Myints.Count), cancellationToken); - foreach (int _iter60 in Myints) - { - await oprot.WriteI32Async(_iter60, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Hello != null && __isset.hello) - { - field.Name = "hello"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ListTypeVersioningV1("); - bool __first = true; - if (Myints != null && __isset.myints) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Myints: "); - sb.Append(Myints); - } - if (Hello != null && __isset.hello) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs deleted file mode 100644 index e05e6a090f4..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/ListTypeVersioningV2.cs +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class ListTypeVersioningV2 : TBase - { - private List _strings; - private string _hello; - - public List Strings - { - get - { - return _strings; - } - set - { - __isset.strings = true; - this._strings = value; - } - } - - public string Hello - { - get - { - return _hello; - } - set - { - __isset.hello = true; - this._hello = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool strings; - public bool hello; - } - - public ListTypeVersioningV2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Strings = new List(); - TList _list61 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i62 = 0; _i62 < _list61.Count; ++_i62) - { - string _elem63; - _elem63 = await iprot.ReadStringAsync(cancellationToken); - Strings.Add(_elem63); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Hello = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("ListTypeVersioningV2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Strings != null && __isset.strings) - { - field.Name = "strings"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.String, Strings.Count), cancellationToken); - foreach (string _iter64 in Strings) - { - await oprot.WriteStringAsync(_iter64, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Hello != null && __isset.hello) - { - field.Name = "hello"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("ListTypeVersioningV2("); - bool __first = true; - if (Strings != null && __isset.strings) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Strings: "); - sb.Append(Strings); - } - if (Hello != null && __isset.hello) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs deleted file mode 100644 index 4c4f30e9b1f..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsBonk.cs +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class NestedListsBonk : TBase - { - private List>> _bonk; - - public List>> Bonk - { - get - { - return _bonk; - } - set - { - __isset.bonk = true; - this._bonk = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool bonk; - } - - public NestedListsBonk() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Bonk = new List>>(); - TList _list132 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i133 = 0; _i133 < _list132.Count; ++_i133) - { - List> _elem134; - { - _elem134 = new List>(); - TList _list135 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i136 = 0; _i136 < _list135.Count; ++_i136) - { - List _elem137; - { - _elem137 = new List(); - TList _list138 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i139 = 0; _i139 < _list138.Count; ++_i139) - { - Bonk _elem140; - _elem140 = new Bonk(); - await _elem140.ReadAsync(iprot, cancellationToken); - _elem137.Add(_elem140); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _elem134.Add(_elem137); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Bonk.Add(_elem134); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsBonk"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Bonk != null && __isset.bonk) - { - field.Name = "bonk"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Bonk.Count), cancellationToken); - foreach (List> _iter141 in Bonk) - { - { - await oprot.WriteListBeginAsync(new TList(TType.List, _iter141.Count), cancellationToken); - foreach (List _iter142 in _iter141) - { - { - await oprot.WriteListBeginAsync(new TList(TType.Struct, _iter142.Count), cancellationToken); - foreach (Bonk _iter143 in _iter142) - { - await _iter143.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NestedListsBonk("); - bool __first = true; - if (Bonk != null && __isset.bonk) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Bonk: "); - sb.Append(Bonk); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs deleted file mode 100644 index fe83204fdc0..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x2.cs +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class NestedListsI32x2 : TBase - { - private List> _integerlist; - - public List> Integerlist - { - get - { - return _integerlist; - } - set - { - __isset.integerlist = true; - this._integerlist = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool integerlist; - } - - public NestedListsI32x2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Integerlist = new List>(); - TList _list78 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i79 = 0; _i79 < _list78.Count; ++_i79) - { - List _elem80; - { - _elem80 = new List(); - TList _list81 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i82 = 0; _i82 < _list81.Count; ++_i82) - { - int _elem83; - _elem83 = await iprot.ReadI32Async(cancellationToken); - _elem80.Add(_elem83); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Integerlist.Add(_elem80); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsI32x2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Integerlist != null && __isset.integerlist) - { - field.Name = "integerlist"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); - foreach (List _iter84 in Integerlist) - { - { - await oprot.WriteListBeginAsync(new TList(TType.I32, _iter84.Count), cancellationToken); - foreach (int _iter85 in _iter84) - { - await oprot.WriteI32Async(_iter85, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NestedListsI32x2("); - bool __first = true; - if (Integerlist != null && __isset.integerlist) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Integerlist: "); - sb.Append(Integerlist); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs deleted file mode 100644 index b2988804d82..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedListsI32x3.cs +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class NestedListsI32x3 : TBase - { - private List>> _integerlist; - - public List>> Integerlist - { - get - { - return _integerlist; - } - set - { - __isset.integerlist = true; - this._integerlist = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool integerlist; - } - - public NestedListsI32x3() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Integerlist = new List>>(); - TList _list86 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i87 = 0; _i87 < _list86.Count; ++_i87) - { - List> _elem88; - { - _elem88 = new List>(); - TList _list89 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i90 = 0; _i90 < _list89.Count; ++_i90) - { - List _elem91; - { - _elem91 = new List(); - TList _list92 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i93 = 0; _i93 < _list92.Count; ++_i93) - { - int _elem94; - _elem94 = await iprot.ReadI32Async(cancellationToken); - _elem91.Add(_elem94); - } - await iprot.ReadListEndAsync(cancellationToken); - } - _elem88.Add(_elem91); - } - await iprot.ReadListEndAsync(cancellationToken); - } - Integerlist.Add(_elem88); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedListsI32x3"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Integerlist != null && __isset.integerlist) - { - field.Name = "integerlist"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.List, Integerlist.Count), cancellationToken); - foreach (List> _iter95 in Integerlist) - { - { - await oprot.WriteListBeginAsync(new TList(TType.List, _iter95.Count), cancellationToken); - foreach (List _iter96 in _iter95) - { - { - await oprot.WriteListBeginAsync(new TList(TType.I32, _iter96.Count), cancellationToken); - foreach (int _iter97 in _iter96) - { - await oprot.WriteI32Async(_iter97, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NestedListsI32x3("); - bool __first = true; - if (Integerlist != null && __isset.integerlist) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Integerlist: "); - sb.Append(Integerlist); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs deleted file mode 100644 index 28da88f2bb8..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/NestedMixedx2.cs +++ /dev/null @@ -1,348 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class NestedMixedx2 : TBase - { - private List> _int_set_list; - private Dictionary> _map_int_strset; - private List>> _map_int_strset_list; - - public List> Int_set_list - { - get - { - return _int_set_list; - } - set - { - __isset.int_set_list = true; - this._int_set_list = value; - } - } - - public Dictionary> Map_int_strset - { - get - { - return _map_int_strset; - } - set - { - __isset.map_int_strset = true; - this._map_int_strset = value; - } - } - - public List>> Map_int_strset_list - { - get - { - return _map_int_strset_list; - } - set - { - __isset.map_int_strset_list = true; - this._map_int_strset_list = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool int_set_list; - public bool map_int_strset; - public bool map_int_strset_list; - } - - public NestedMixedx2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Int_set_list = new List>(); - TList _list98 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i99 = 0; _i99 < _list98.Count; ++_i99) - { - THashSet _elem100; - { - _elem100 = new THashSet(); - TSet _set101 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i102 = 0; _i102 < _set101.Count; ++_i102) - { - int _elem103; - _elem103 = await iprot.ReadI32Async(cancellationToken); - _elem100.Add(_elem103); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - Int_set_list.Add(_elem100); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Map) - { - { - Map_int_strset = new Dictionary>(); - TMap _map104 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i105 = 0; _i105 < _map104.Count; ++_i105) - { - int _key106; - THashSet _val107; - _key106 = await iprot.ReadI32Async(cancellationToken); - { - _val107 = new THashSet(); - TSet _set108 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i109 = 0; _i109 < _set108.Count; ++_i109) - { - string _elem110; - _elem110 = await iprot.ReadStringAsync(cancellationToken); - _val107.Add(_elem110); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - Map_int_strset[_key106] = _val107; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.List) - { - { - Map_int_strset_list = new List>>(); - TList _list111 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i112 = 0; _i112 < _list111.Count; ++_i112) - { - Dictionary> _elem113; - { - _elem113 = new Dictionary>(); - TMap _map114 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i115 = 0; _i115 < _map114.Count; ++_i115) - { - int _key116; - THashSet _val117; - _key116 = await iprot.ReadI32Async(cancellationToken); - { - _val117 = new THashSet(); - TSet _set118 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i119 = 0; _i119 < _set118.Count; ++_i119) - { - string _elem120; - _elem120 = await iprot.ReadStringAsync(cancellationToken); - _val117.Add(_elem120); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - _elem113[_key116] = _val117; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Map_int_strset_list.Add(_elem113); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("NestedMixedx2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Int_set_list != null && __isset.int_set_list) - { - field.Name = "int_set_list"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Set, Int_set_list.Count), cancellationToken); - foreach (THashSet _iter121 in Int_set_list) - { - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, _iter121.Count), cancellationToken); - foreach (int _iter122 in _iter121) - { - await oprot.WriteI32Async(_iter122, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Map_int_strset != null && __isset.map_int_strset) - { - field.Name = "map_int_strset"; - field.Type = TType.Map; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, Map_int_strset.Count), cancellationToken); - foreach (int _iter123 in Map_int_strset.Keys) - { - await oprot.WriteI32Async(_iter123, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.String, Map_int_strset[_iter123].Count), cancellationToken); - foreach (string _iter124 in Map_int_strset[_iter123]) - { - await oprot.WriteStringAsync(_iter124, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Map_int_strset_list != null && __isset.map_int_strset_list) - { - field.Name = "map_int_strset_list"; - field.Type = TType.List; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.Map, Map_int_strset_list.Count), cancellationToken); - foreach (Dictionary> _iter125 in Map_int_strset_list) - { - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Set, _iter125.Count), cancellationToken); - foreach (int _iter126 in _iter125.Keys) - { - await oprot.WriteI32Async(_iter126, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.String, _iter125[_iter126].Count), cancellationToken); - foreach (string _iter127 in _iter125[_iter126]) - { - await oprot.WriteStringAsync(_iter127, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("NestedMixedx2("); - bool __first = true; - if (Int_set_list != null && __isset.int_set_list) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Int_set_list: "); - sb.Append(Int_set_list); - } - if (Map_int_strset != null && __isset.map_int_strset) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Map_int_strset: "); - sb.Append(Map_int_strset); - } - if (Map_int_strset_list != null && __isset.map_int_strset_list) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Map_int_strset_list: "); - sb.Append(Map_int_strset_list); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs deleted file mode 100644 index a8fcc901fc6..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Numberz.cs +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ - -namespace thrift.test -{ - /// - /// Docstring! - /// - public enum Numberz - { - ONE = 1, - TWO = 2, - THREE = 3, - FIVE = 5, - SIX = 6, - EIGHT = 8, - } -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs deleted file mode 100644 index cbcca3d9b09..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/OneField.cs +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class OneField : TBase - { - private EmptyStruct _field; - - public EmptyStruct Field - { - get - { - return _field; - } - set - { - __isset.field = true; - this._field = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool field; - } - - public OneField() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Field = new EmptyStruct(); - await Field.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("OneField"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Field != null && __isset.field) - { - field.Name = "field"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Field.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("OneField("); - bool __first = true; - if (Field != null && __isset.field) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Field: "); - sb.Append(Field== null ? "" : Field.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs deleted file mode 100644 index 4740018a2a9..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/SecondService.cs +++ /dev/null @@ -1,581 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - public partial class SecondService - { - public interface IAsync - { - Task blahBlahAsync(CancellationToken cancellationToken); - - /// - /// Prints 'testString("%s")' with thing as '%s' - /// @param string thing - the string to print - /// @return string - returns the string 'thing' - /// - /// - Task secondtestStringAsync(string thing, CancellationToken cancellationToken); - - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) { - } - public async Task blahBlahAsync(CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Call, SeqId), cancellationToken); - - var args = new blahBlahArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new blahBlahResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task secondtestStringAsync(string thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Call, SeqId), cancellationToken); - - var args = new secondtestStringArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new secondtestStringResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "secondtestString failed: unknown result"); - } - - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["blahBlah"] = blahBlah_ProcessAsync; - processMap_["secondtestString"] = secondtestString_ProcessAsync; - } - - protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - protected Dictionary processMap_ = new Dictionary(); - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'"); - await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task blahBlah_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new blahBlahArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new blahBlahResult(); - try - { - await _iAsync.blahBlahAsync(cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("blahBlah", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task secondtestString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new secondtestStringArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new secondtestStringResult(); - try - { - result.Success = await _iAsync.secondtestStringAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("secondtestString", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - } - - - public partial class blahBlahArgs : TBase - { - - public blahBlahArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("blahBlah_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("blahBlah_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class blahBlahResult : TBase - { - - public blahBlahResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("blahBlah_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("blahBlah_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class secondtestStringArgs : TBase - { - private string _thing; - - public string Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public secondtestStringArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("secondtestString_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("secondtestString_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class secondtestStringResult : TBase - { - private string _success; - - public string Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public secondtestStringResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("secondtestString_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("secondtestString_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - } -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs deleted file mode 100644 index ea7ede32c86..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructA.cs +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class StructA : TBase - { - - public string S { get; set; } - - public StructA() - { - } - - public StructA(string s) : this() - { - this.S = s; - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_s = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - S = await iprot.ReadStringAsync(cancellationToken); - isset_s = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_s) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("StructA"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - field.Name = "s"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(S, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("StructA("); - sb.Append(", S: "); - sb.Append(S); - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs deleted file mode 100644 index f398cca0fe3..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/StructB.cs +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class StructB : TBase - { - private StructA _aa; - - public StructA Aa - { - get - { - return _aa; - } - set - { - __isset.aa = true; - this._aa = value; - } - } - - public StructA Ab { get; set; } - - - public Isset __isset; - public struct Isset - { - public bool aa; - } - - public StructB() - { - } - - public StructB(StructA ab) : this() - { - this.Ab = ab; - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - bool isset_ab = false; - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Aa = new StructA(); - await Aa.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Ab = new StructA(); - await Ab.ReadAsync(iprot, cancellationToken); - isset_ab = true; - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - if (!isset_ab) - { - throw new TProtocolException(TProtocolException.INVALID_DATA); - } - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("StructB"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Aa != null && __isset.aa) - { - field.Name = "aa"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Aa.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - field.Name = "ab"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ab.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("StructB("); - bool __first = true; - if (Aa != null && __isset.aa) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Aa: "); - sb.Append(Aa== null ? "" : Aa.ToString()); - } - if(!__first) { sb.Append(", "); } - sb.Append("Ab: "); - sb.Append(Ab== null ? "" : Ab.ToString()); - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs deleted file mode 100644 index 84811fe8a63..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.Constants.cs +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - - -namespace thrift.test -{ - public static class ThriftTestConstants - { - public static Numberz myNumberz = Numberz.ONE; - } -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs deleted file mode 100644 index 655868d3a87..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/ThriftTest.cs +++ /dev/null @@ -1,7046 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - public partial class ThriftTest - { - public interface IAsync - { - /// - /// Prints "testVoid()" and returns nothing. - /// - Task testVoidAsync(CancellationToken cancellationToken); - - /// - /// Prints 'testString("%s")' with thing as '%s' - /// @param string thing - the string to print - /// @return string - returns the string 'thing' - /// - /// - Task testStringAsync(string thing, CancellationToken cancellationToken); - - /// - /// Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' - /// @param bool thing - the bool data to print - /// @return bool - returns the bool 'thing' - /// - /// - Task testBoolAsync(bool thing, CancellationToken cancellationToken); - - /// - /// Prints 'testByte("%d")' with thing as '%d' - /// The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility. - /// @param byte thing - the i8/byte to print - /// @return i8 - returns the i8/byte 'thing' - /// - /// - Task testByteAsync(sbyte thing, CancellationToken cancellationToken); - - /// - /// Prints 'testI32("%d")' with thing as '%d' - /// @param i32 thing - the i32 to print - /// @return i32 - returns the i32 'thing' - /// - /// - Task testI32Async(int thing, CancellationToken cancellationToken); - - /// - /// Prints 'testI64("%d")' with thing as '%d' - /// @param i64 thing - the i64 to print - /// @return i64 - returns the i64 'thing' - /// - /// - Task testI64Async(long thing, CancellationToken cancellationToken); - - /// - /// Prints 'testDouble("%f")' with thing as '%f' - /// @param double thing - the double to print - /// @return double - returns the double 'thing' - /// - /// - Task testDoubleAsync(double thing, CancellationToken cancellationToken); - - /// - /// Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data - /// @param binary thing - the binary data to print - /// @return binary - returns the binary 'thing' - /// - /// - Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken); - - /// - /// Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values - /// @param Xtruct thing - the Xtruct to print - /// @return Xtruct - returns the Xtruct 'thing' - /// - /// - Task testStructAsync(Xtruct thing, CancellationToken cancellationToken); - - /// - /// Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct - /// @param Xtruct2 thing - the Xtruct2 to print - /// @return Xtruct2 - returns the Xtruct2 'thing' - /// - /// - Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken); - - /// - /// Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs - /// separated by commas and new lines - /// @param map thing - the map to print - /// @return map - returns the map 'thing' - /// - /// - Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken); - - /// - /// Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs - /// separated by commas and new lines - /// @param map thing - the map to print - /// @return map - returns the map 'thing' - /// - /// - Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken); - - /// - /// Prints 'testSet("{%s}")' where thing has been formatted into a string of values - /// separated by commas and new lines - /// @param set thing - the set to print - /// @return set - returns the set 'thing' - /// - /// - Task> testSetAsync(THashSet thing, CancellationToken cancellationToken); - - /// - /// Prints 'testList("{%s}")' where thing has been formatted into a string of values - /// separated by commas and new lines - /// @param list thing - the list to print - /// @return list - returns the list 'thing' - /// - /// - Task> testListAsync(List thing, CancellationToken cancellationToken); - - /// - /// Prints 'testEnum("%d")' where thing has been formatted into it's numeric value - /// @param Numberz thing - the Numberz to print - /// @return Numberz - returns the Numberz 'thing' - /// - /// - Task testEnumAsync(Numberz thing, CancellationToken cancellationToken); - - /// - /// Prints 'testTypedef("%d")' with thing as '%d' - /// @param UserId thing - the UserId to print - /// @return UserId - returns the UserId 'thing' - /// - /// - Task testTypedefAsync(long thing, CancellationToken cancellationToken); - - /// - /// Prints 'testMapMap("%d")' with hello as '%d' - /// @param i32 hello - the i32 to print - /// @return map> - returns a dictionary with these values: - /// {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, } - /// - /// - Task>> testMapMapAsync(int hello, CancellationToken cancellationToken); - - /// - /// So you think you've got this all worked, out eh? - /// - /// Creates a the returned map with these values and prints it out: - /// { 1 => { 2 => argument, - /// 3 => argument, - /// }, - /// 2 => { 6 => , }, - /// } - /// @return map> - a map with the above values - /// - /// - Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken); - - /// - /// Prints 'testMulti()' - /// @param i8 arg0 - - /// @param i32 arg1 - - /// @param i64 arg2 - - /// @param map arg3 - - /// @param Numberz arg4 - - /// @param UserId arg5 - - /// @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1 - /// and i64_thing = arg2 - /// - /// - /// - /// - /// - /// - /// - Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, CancellationToken cancellationToken); - - /// - /// Print 'testException(%s)' with arg as '%s' - /// @param string arg - a string indication what type of exception to throw - /// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg - /// elsen if arg == "TException" throw TException - /// else do not throw anything - /// - /// - Task testExceptionAsync(string arg, CancellationToken cancellationToken); - - /// - /// Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s' - /// @param string arg - a string indication what type of exception to throw - /// if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception" - /// elsen if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2" - /// else do not throw anything - /// @return Xtruct - an Xtruct with string_thing = arg1 - /// - /// - /// - Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken); - - /// - /// Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d' - /// sleep 'secondsToSleep' - /// Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d' - /// @param i32 secondsToSleep - the number of seconds to sleep - /// - /// - Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken); - - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) { - } - public async Task testVoidAsync(CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Call, SeqId), cancellationToken); - - var args = new testVoidArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testVoidResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task testStringAsync(string thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Call, SeqId), cancellationToken); - - var args = new testStringArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStringResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testString failed: unknown result"); - } - - public async Task testBoolAsync(bool thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Call, SeqId), cancellationToken); - - var args = new testBoolArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testBoolResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testBool failed: unknown result"); - } - - public async Task testByteAsync(sbyte thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Call, SeqId), cancellationToken); - - var args = new testByteArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testByteResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testByte failed: unknown result"); - } - - public async Task testI32Async(int thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Call, SeqId), cancellationToken); - - var args = new testI32Args(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testI32Result(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testI32 failed: unknown result"); - } - - public async Task testI64Async(long thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Call, SeqId), cancellationToken); - - var args = new testI64Args(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testI64Result(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testI64 failed: unknown result"); - } - - public async Task testDoubleAsync(double thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Call, SeqId), cancellationToken); - - var args = new testDoubleArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testDoubleResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testDouble failed: unknown result"); - } - - public async Task testBinaryAsync(byte[] thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Call, SeqId), cancellationToken); - - var args = new testBinaryArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testBinaryResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testBinary failed: unknown result"); - } - - public async Task testStructAsync(Xtruct thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Call, SeqId), cancellationToken); - - var args = new testStructArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStructResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testStruct failed: unknown result"); - } - - public async Task testNestAsync(Xtruct2 thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Call, SeqId), cancellationToken); - - var args = new testNestArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testNestResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testNest failed: unknown result"); - } - - public async Task> testMapAsync(Dictionary thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Call, SeqId), cancellationToken); - - var args = new testMapArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMap failed: unknown result"); - } - - public async Task> testStringMapAsync(Dictionary thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Call, SeqId), cancellationToken); - - var args = new testStringMapArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testStringMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testStringMap failed: unknown result"); - } - - public async Task> testSetAsync(THashSet thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Call, SeqId), cancellationToken); - - var args = new testSetArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testSetResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testSet failed: unknown result"); - } - - public async Task> testListAsync(List thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Call, SeqId), cancellationToken); - - var args = new testListArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testListResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testList failed: unknown result"); - } - - public async Task testEnumAsync(Numberz thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Call, SeqId), cancellationToken); - - var args = new testEnumArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testEnumResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testEnum failed: unknown result"); - } - - public async Task testTypedefAsync(long thing, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Call, SeqId), cancellationToken); - - var args = new testTypedefArgs(); - args.Thing = thing; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testTypedefResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testTypedef failed: unknown result"); - } - - public async Task>> testMapMapAsync(int hello, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Call, SeqId), cancellationToken); - - var args = new testMapMapArgs(); - args.Hello = hello; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMapMapResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMapMap failed: unknown result"); - } - - public async Task>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Call, SeqId), cancellationToken); - - var args = new testInsanityArgs(); - args.Argument = argument; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testInsanityResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testInsanity failed: unknown result"); - } - - public async Task testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary arg3, Numberz arg4, long arg5, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Call, SeqId), cancellationToken); - - var args = new testMultiArgs(); - args.Arg0 = arg0; - args.Arg1 = arg1; - args.Arg2 = arg2; - args.Arg3 = arg3; - args.Arg4 = arg4; - args.Arg5 = arg5; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMultiResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMulti failed: unknown result"); - } - - public async Task testExceptionAsync(string arg, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Call, SeqId), cancellationToken); - - var args = new testExceptionArgs(); - args.Arg = arg; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testExceptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.err1) - { - throw result.Err1; - } - return; - } - - public async Task testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Call, SeqId), cancellationToken); - - var args = new testMultiExceptionArgs(); - args.Arg0 = arg0; - args.Arg1 = arg1; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new testMultiExceptionResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.err1) - { - throw result.Err1; - } - if (result.__isset.err2) - { - throw result.Err2; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testMultiException failed: unknown result"); - } - - public async Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken) - { - await OutputProtocol.WriteMessageBeginAsync(new TMessage("testOneway", TMessageType.Oneway, SeqId), cancellationToken); - - var args = new testOnewayArgs(); - args.SecondsToSleep = secondsToSleep; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["testVoid"] = testVoid_ProcessAsync; - processMap_["testString"] = testString_ProcessAsync; - processMap_["testBool"] = testBool_ProcessAsync; - processMap_["testByte"] = testByte_ProcessAsync; - processMap_["testI32"] = testI32_ProcessAsync; - processMap_["testI64"] = testI64_ProcessAsync; - processMap_["testDouble"] = testDouble_ProcessAsync; - processMap_["testBinary"] = testBinary_ProcessAsync; - processMap_["testStruct"] = testStruct_ProcessAsync; - processMap_["testNest"] = testNest_ProcessAsync; - processMap_["testMap"] = testMap_ProcessAsync; - processMap_["testStringMap"] = testStringMap_ProcessAsync; - processMap_["testSet"] = testSet_ProcessAsync; - processMap_["testList"] = testList_ProcessAsync; - processMap_["testEnum"] = testEnum_ProcessAsync; - processMap_["testTypedef"] = testTypedef_ProcessAsync; - processMap_["testMapMap"] = testMapMap_ProcessAsync; - processMap_["testInsanity"] = testInsanity_ProcessAsync; - processMap_["testMulti"] = testMulti_ProcessAsync; - processMap_["testException"] = testException_ProcessAsync; - processMap_["testMultiException"] = testMultiException_ProcessAsync; - processMap_["testOneway"] = testOneway_ProcessAsync; - } - - protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - protected Dictionary processMap_ = new Dictionary(); - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, "Invalid method name: '" + msg.Name + "'"); - await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task testVoid_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testVoidArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testVoidResult(); - try - { - await _iAsync.testVoidAsync(cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testVoid", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testString_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testStringArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStringResult(); - try - { - result.Success = await _iAsync.testStringAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testString", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testBool_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testBoolArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testBoolResult(); - try - { - result.Success = await _iAsync.testBoolAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testBool", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testByte_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testByteArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testByteResult(); - try - { - result.Success = await _iAsync.testByteAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testByte", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testI32_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testI32Args(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testI32Result(); - try - { - result.Success = await _iAsync.testI32Async(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testI32", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testI64_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testI64Args(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testI64Result(); - try - { - result.Success = await _iAsync.testI64Async(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testI64", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testDouble_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testDoubleArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testDoubleResult(); - try - { - result.Success = await _iAsync.testDoubleAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testDouble", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testBinary_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testBinaryArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testBinaryResult(); - try - { - result.Success = await _iAsync.testBinaryAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testBinary", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testStructArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStructResult(); - try - { - result.Success = await _iAsync.testStructAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testStruct", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testNest_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testNestArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testNestResult(); - try - { - result.Success = await _iAsync.testNestAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testNest", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMapResult(); - try - { - result.Success = await _iAsync.testMapAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testMap", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testStringMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testStringMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testStringMapResult(); - try - { - result.Success = await _iAsync.testStringMapAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testStringMap", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testSet_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testSetArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testSetResult(); - try - { - result.Success = await _iAsync.testSetAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testSet", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testList_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testListArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testListResult(); - try - { - result.Success = await _iAsync.testListAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testList", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testEnum_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testEnumArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testEnumResult(); - try - { - result.Success = await _iAsync.testEnumAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testEnum", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testTypedef_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testTypedefArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testTypedefResult(); - try - { - result.Success = await _iAsync.testTypedefAsync(args.Thing, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testTypedef", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMapMap_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testMapMapArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMapMapResult(); - try - { - result.Success = await _iAsync.testMapMapAsync(args.Hello, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testMapMap", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testInsanity_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testInsanityArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testInsanityResult(); - try - { - result.Success = await _iAsync.testInsanityAsync(args.Argument, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testInsanity", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMulti_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testMultiArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMultiResult(); - try - { - result.Success = await _iAsync.testMultiAsync(args.Arg0, args.Arg1, args.Arg2, args.Arg3, args.Arg4, args.Arg5, cancellationToken); - await oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testMulti", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testExceptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testExceptionResult(); - try - { - try - { - await _iAsync.testExceptionAsync(args.Arg, cancellationToken); - } - catch (Xception err1) - { - result.Err1 = err1; - } - await oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testException", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testMultiException_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testMultiExceptionArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new testMultiExceptionResult(); - try - { - try - { - result.Success = await _iAsync.testMultiExceptionAsync(args.Arg0, args.Arg1, cancellationToken); - } - catch (Xception err1) - { - result.Err1 = err1; - } - catch (Xception2 err2) - { - result.Err2 = err2; - } - await oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError," Internal error."); - await oprot.WriteMessageBeginAsync(new TMessage("testMultiException", TMessageType.Exception, seqid), cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task testOneway_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - var args = new testOnewayArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - try - { - await _iAsync.testOnewayAsync(args.SecondsToSleep, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - } - } - - } - - - public partial class testVoidArgs : TBase - { - - public testVoidArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testVoid_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testVoid_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testVoidResult : TBase - { - - public testVoidResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testVoid_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testVoid_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStringArgs : TBase - { - private string _thing; - - public string Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testStringArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testString_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testString_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStringResult : TBase - { - private string _success; - - public string Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testStringResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testString_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testString_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testBoolArgs : TBase - { - private bool _thing; - - public bool Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testBoolArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Bool) - { - Thing = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBool_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Bool; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testBool_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testBoolResult : TBase - { - private bool _success; - - public bool Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testBoolResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Bool) - { - Success = await iprot.ReadBoolAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBool_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Bool; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBoolAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testBool_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testByteArgs : TBase - { - private sbyte _thing; - - public sbyte Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testByteArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testByte_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testByte_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testByteResult : TBase - { - private sbyte _success; - - public sbyte Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testByteResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Byte) - { - Success = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testByte_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Byte; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testByte_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testI32Args : TBase - { - private int _thing; - - public int Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testI32Args() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI32_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testI32_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testI32Result : TBase - { - private int _success; - - public int Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testI32Result() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI32_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testI32_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testI64Args : TBase - { - private long _thing; - - public long Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testI64Args() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I64) - { - Thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI64_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I64; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testI64_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testI64Result : TBase - { - private long _success; - - public long Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testI64Result() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testI64_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testI64_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testDoubleArgs : TBase - { - private double _thing; - - public double Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testDoubleArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Double) - { - Thing = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testDouble_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.Double; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testDouble_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testDoubleResult : TBase - { - private double _success; - - public double Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testDoubleResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Double) - { - Success = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testDouble_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.Double; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testDouble_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testBinaryArgs : TBase - { - private byte[] _thing; - - public byte[] Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testBinaryArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Thing = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBinary_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testBinary_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testBinaryResult : TBase - { - private byte[] _success; - - public byte[] Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testBinaryResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.String) - { - Success = await iprot.ReadBinaryAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testBinary_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.String; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteBinaryAsync(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testBinary_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStructArgs : TBase - { - private Xtruct _thing; - - public Xtruct Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testStructArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Thing = new Xtruct(); - await Thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStruct_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testStruct_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing== null ? "" : Thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStructResult : TBase - { - private Xtruct _success; - - public Xtruct Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testStructResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStruct_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testStruct_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success== null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testNestArgs : TBase - { - private Xtruct2 _thing; - - public Xtruct2 Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testNestArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Thing = new Xtruct2(); - await Thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testNest_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testNest_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing== null ? "" : Thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testNestResult : TBase - { - private Xtruct2 _success; - - public Xtruct2 Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testNestResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct2(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testNest_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testNest_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success== null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMapArgs : TBase - { - private Dictionary _thing; - - public Dictionary Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testMapArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Thing = new Dictionary(); - TMap _map144 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i145 = 0; _i145 < _map144.Count; ++_i145) - { - int _key146; - int _val147; - _key146 = await iprot.ReadI32Async(cancellationToken); - _val147 = await iprot.ReadI32Async(cancellationToken); - Thing[_key146] = _val147; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Thing.Count), cancellationToken); - foreach (int _iter148 in Thing.Keys) - { - await oprot.WriteI32Async(_iter148, cancellationToken); - await oprot.WriteI32Async(Thing[_iter148], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMap_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMapResult : TBase - { - private Dictionary _success; - - public Dictionary Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testMapResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map149 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i150 = 0; _i150 < _map149.Count; ++_i150) - { - int _key151; - int _val152; - _key151 = await iprot.ReadI32Async(cancellationToken); - _val152 = await iprot.ReadI32Async(cancellationToken); - Success[_key151] = _val152; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success.Count), cancellationToken); - foreach (int _iter153 in Success.Keys) - { - await oprot.WriteI32Async(_iter153, cancellationToken); - await oprot.WriteI32Async(Success[_iter153], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStringMapArgs : TBase - { - private Dictionary _thing; - - public Dictionary Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testStringMapArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Map) - { - { - Thing = new Dictionary(); - TMap _map154 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i155 = 0; _i155 < _map154.Count; ++_i155) - { - string _key156; - string _val157; - _key156 = await iprot.ReadStringAsync(cancellationToken); - _val157 = await iprot.ReadStringAsync(cancellationToken); - Thing[_key156] = _val157; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStringMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Map; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Thing.Count), cancellationToken); - foreach (string _iter158 in Thing.Keys) - { - await oprot.WriteStringAsync(_iter158, cancellationToken); - await oprot.WriteStringAsync(Thing[_iter158], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testStringMap_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testStringMapResult : TBase - { - private Dictionary _success; - - public Dictionary Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testStringMapResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary(); - TMap _map159 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i160 = 0; _i160 < _map159.Count; ++_i160) - { - string _key161; - string _val162; - _key161 = await iprot.ReadStringAsync(cancellationToken); - _val162 = await iprot.ReadStringAsync(cancellationToken); - Success[_key161] = _val162; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testStringMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Success.Count), cancellationToken); - foreach (string _iter163 in Success.Keys) - { - await oprot.WriteStringAsync(_iter163, cancellationToken); - await oprot.WriteStringAsync(Success[_iter163], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testStringMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testSetArgs : TBase - { - private THashSet _thing; - - public THashSet Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testSetArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Set) - { - { - Thing = new THashSet(); - TSet _set164 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i165 = 0; _i165 < _set164.Count; ++_i165) - { - int _elem166; - _elem166 = await iprot.ReadI32Async(cancellationToken); - Thing.Add(_elem166); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testSet_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.Set; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Thing.Count), cancellationToken); - foreach (int _iter167 in Thing) - { - await oprot.WriteI32Async(_iter167, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testSet_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testSetResult : TBase - { - private THashSet _success; - - public THashSet Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testSetResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Set) - { - { - Success = new THashSet(); - TSet _set168 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i169 = 0; _i169 < _set168.Count; ++_i169) - { - int _elem170; - _elem170 = await iprot.ReadI32Async(cancellationToken); - Success.Add(_elem170); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testSet_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Set; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Success.Count), cancellationToken); - foreach (int _iter171 in Success) - { - await oprot.WriteI32Async(_iter171, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testSet_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testListArgs : TBase - { - private List _thing; - - public List Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testListArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.List) - { - { - Thing = new List(); - TList _list172 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i173 = 0; _i173 < _list172.Count; ++_i173) - { - int _elem174; - _elem174 = await iprot.ReadI32Async(cancellationToken); - Thing.Add(_elem174); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testList_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Thing != null && __isset.thing) - { - field.Name = "thing"; - field.Type = TType.List; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Thing.Count), cancellationToken); - foreach (int _iter175 in Thing) - { - await oprot.WriteI32Async(_iter175, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testList_args("); - bool __first = true; - if (Thing != null && __isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testListResult : TBase - { - private List _success; - - public List Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testListResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.List) - { - { - Success = new List(); - TList _list176 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i177 = 0; _i177 < _list176.Count; ++_i177) - { - int _elem178; - _elem178 = await iprot.ReadI32Async(cancellationToken); - Success.Add(_elem178); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testList_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.List; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Success.Count), cancellationToken); - foreach (int _iter179 in Success) - { - await oprot.WriteI32Async(_iter179, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testList_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testEnumArgs : TBase - { - private Numberz _thing; - - /// - /// - /// - /// - public Numberz Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testEnumArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Thing = (Numberz)await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testEnum_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int)Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testEnum_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testEnumResult : TBase - { - private Numberz _success; - - /// - /// - /// - /// - public Numberz Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testEnumResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = (Numberz)await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testEnum_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int)Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testEnum_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testTypedefArgs : TBase - { - private long _thing; - - public long Thing - { - get - { - return _thing; - } - set - { - __isset.thing = true; - this._thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool thing; - } - - public testTypedefArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I64) - { - Thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testTypedef_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.thing) - { - field.Name = "thing"; - field.Type = TType.I64; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testTypedef_args("); - bool __first = true; - if (__isset.thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Thing: "); - sb.Append(Thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testTypedefResult : TBase - { - private long _success; - - public long Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testTypedefResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I64) - { - Success = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testTypedef_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I64; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testTypedef_result("); - bool __first = true; - if (__isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMapMapArgs : TBase - { - private int _hello; - - public int Hello - { - get - { - return _hello; - } - set - { - __isset.hello = true; - this._hello = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool hello; - } - - public testMapMapArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Hello = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMapMap_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.hello) - { - field.Name = "hello"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Hello, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMapMap_args("); - bool __first = true; - if (__isset.hello) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Hello: "); - sb.Append(Hello); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMapMapResult : TBase - { - private Dictionary> _success; - - public Dictionary> Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testMapMapResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map180 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i181 = 0; _i181 < _map180.Count; ++_i181) - { - int _key182; - Dictionary _val183; - _key182 = await iprot.ReadI32Async(cancellationToken); - { - _val183 = new Dictionary(); - TMap _map184 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i185 = 0; _i185 < _map184.Count; ++_i185) - { - int _key186; - int _val187; - _key186 = await iprot.ReadI32Async(cancellationToken); - _val187 = await iprot.ReadI32Async(cancellationToken); - _val183[_key186] = _val187; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Success[_key182] = _val183; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMapMap_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Map, Success.Count), cancellationToken); - foreach (int _iter188 in Success.Keys) - { - await oprot.WriteI32Async(_iter188, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Success[_iter188].Count), cancellationToken); - foreach (int _iter189 in Success[_iter188].Keys) - { - await oprot.WriteI32Async(_iter189, cancellationToken); - await oprot.WriteI32Async(Success[_iter188][_iter189], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMapMap_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testInsanityArgs : TBase - { - private Insanity _argument; - - public Insanity Argument - { - get - { - return _argument; - } - set - { - __isset.argument = true; - this._argument = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool argument; - } - - public testInsanityArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Argument = new Insanity(); - await Argument.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testInsanity_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Argument != null && __isset.argument) - { - field.Name = "argument"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Argument.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testInsanity_args("); - bool __first = true; - if (Argument != null && __isset.argument) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Argument: "); - sb.Append(Argument== null ? "" : Argument.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testInsanityResult : TBase - { - private Dictionary> _success; - - public Dictionary> Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testInsanityResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Map) - { - { - Success = new Dictionary>(); - TMap _map190 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i191 = 0; _i191 < _map190.Count; ++_i191) - { - long _key192; - Dictionary _val193; - _key192 = await iprot.ReadI64Async(cancellationToken); - { - _val193 = new Dictionary(); - TMap _map194 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i195 = 0; _i195 < _map194.Count; ++_i195) - { - Numberz _key196; - Insanity _val197; - _key196 = (Numberz)await iprot.ReadI32Async(cancellationToken); - _val197 = new Insanity(); - await _val197.ReadAsync(iprot, cancellationToken); - _val193[_key196] = _val197; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - Success[_key192] = _val193; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testInsanity_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Map; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I64, TType.Map, Success.Count), cancellationToken); - foreach (long _iter198 in Success.Keys) - { - await oprot.WriteI64Async(_iter198, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Struct, Success[_iter198].Count), cancellationToken); - foreach (Numberz _iter199 in Success[_iter198].Keys) - { - await oprot.WriteI32Async((int)_iter199, cancellationToken); - await Success[_iter198][_iter199].WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testInsanity_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMultiArgs : TBase - { - private sbyte _arg0; - private int _arg1; - private long _arg2; - private Dictionary _arg3; - private Numberz _arg4; - private long _arg5; - - public sbyte Arg0 - { - get - { - return _arg0; - } - set - { - __isset.arg0 = true; - this._arg0 = value; - } - } - - public int Arg1 - { - get - { - return _arg1; - } - set - { - __isset.arg1 = true; - this._arg1 = value; - } - } - - public long Arg2 - { - get - { - return _arg2; - } - set - { - __isset.arg2 = true; - this._arg2 = value; - } - } - - public Dictionary Arg3 - { - get - { - return _arg3; - } - set - { - __isset.arg3 = true; - this._arg3 = value; - } - } - - /// - /// - /// - /// - public Numberz Arg4 - { - get - { - return _arg4; - } - set - { - __isset.arg4 = true; - this._arg4 = value; - } - } - - public long Arg5 - { - get - { - return _arg5; - } - set - { - __isset.arg5 = true; - this._arg5 = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool arg0; - public bool arg1; - public bool arg2; - public bool arg3; - public bool arg4; - public bool arg5; - } - - public testMultiArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Arg0 = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Arg1 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I64) - { - Arg2 = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Map) - { - { - Arg3 = new Dictionary(); - TMap _map200 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i201 = 0; _i201 < _map200.Count; ++_i201) - { - short _key202; - string _val203; - _key202 = await iprot.ReadI16Async(cancellationToken); - _val203 = await iprot.ReadStringAsync(cancellationToken); - Arg3[_key202] = _val203; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.I32) - { - Arg4 = (Numberz)await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.I64) - { - Arg5 = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMulti_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.arg0) - { - field.Name = "arg0"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Arg0, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg1) - { - field.Name = "arg1"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Arg1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg2) - { - field.Name = "arg2"; - field.Type = TType.I64; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Arg2, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Arg3 != null && __isset.arg3) - { - field.Name = "arg3"; - field.Type = TType.Map; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I16, TType.String, Arg3.Count), cancellationToken); - foreach (short _iter204 in Arg3.Keys) - { - await oprot.WriteI16Async(_iter204, cancellationToken); - await oprot.WriteStringAsync(Arg3[_iter204], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg4) - { - field.Name = "arg4"; - field.Type = TType.I32; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int)Arg4, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.arg5) - { - field.Name = "arg5"; - field.Type = TType.I64; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Arg5, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMulti_args("); - bool __first = true; - if (__isset.arg0) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg0: "); - sb.Append(Arg0); - } - if (__isset.arg1) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg1: "); - sb.Append(Arg1); - } - if (__isset.arg2) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg2: "); - sb.Append(Arg2); - } - if (Arg3 != null && __isset.arg3) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg3: "); - sb.Append(Arg3); - } - if (__isset.arg4) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg4: "); - sb.Append(Arg4); - } - if (__isset.arg5) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg5: "); - sb.Append(Arg5); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMultiResult : TBase - { - private Xtruct _success; - - public Xtruct Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - } - - public testMultiResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMulti_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMulti_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success== null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testExceptionArgs : TBase - { - private string _arg; - - public string Arg - { - get - { - return _arg; - } - set - { - __isset.arg = true; - this._arg = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool arg; - } - - public testExceptionArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Arg = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testException_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Arg != null && __isset.arg) - { - field.Name = "arg"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testException_args("); - bool __first = true; - if (Arg != null && __isset.arg) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg: "); - sb.Append(Arg); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testExceptionResult : TBase - { - private Xception _err1; - - public Xception Err1 - { - get - { - return _err1; - } - set - { - __isset.err1 = true; - this._err1 = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool err1; - } - - public testExceptionResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Struct) - { - Err1 = new Xception(); - await Err1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testException_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.err1) - { - if (Err1 != null) - { - field.Name = "Err1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testException_result("); - bool __first = true; - if (Err1 != null && __isset.err1) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Err1: "); - sb.Append(Err1== null ? "" : Err1.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMultiExceptionArgs : TBase - { - private string _arg0; - private string _arg1; - - public string Arg0 - { - get - { - return _arg0; - } - set - { - __isset.arg0 = true; - this._arg0 = value; - } - } - - public string Arg1 - { - get - { - return _arg1; - } - set - { - __isset.arg1 = true; - this._arg1 = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool arg0; - public bool arg1; - } - - public testMultiExceptionArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - Arg0 = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Arg1 = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMultiException_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (Arg0 != null && __isset.arg0) - { - field.Name = "arg0"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg0, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Arg1 != null && __isset.arg1) - { - field.Name = "arg1"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Arg1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMultiException_args("); - bool __first = true; - if (Arg0 != null && __isset.arg0) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg0: "); - sb.Append(Arg0); - } - if (Arg1 != null && __isset.arg1) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Arg1: "); - sb.Append(Arg1); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testMultiExceptionResult : TBase - { - private Xtruct _success; - private Xception _err1; - private Xception2 _err2; - - public Xtruct Success - { - get - { - return _success; - } - set - { - __isset.success = true; - this._success = value; - } - } - - public Xception Err1 - { - get - { - return _err1; - } - set - { - __isset.err1 = true; - this._err1 = value; - } - } - - public Xception2 Err2 - { - get - { - return _err2; - } - set - { - __isset.err2 = true; - this._err2 = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool success; - public bool err1; - public bool err2; - } - - public testMultiExceptionResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new Xtruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Err1 = new Xception(); - await Err1.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Err2 = new Xception2(); - await Err2.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testMultiException_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if(this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if(this.__isset.err1) - { - if (Err1 != null) - { - field.Name = "Err1"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err1.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - else if(this.__isset.err2) - { - if (Err2 != null) - { - field.Name = "Err2"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Err2.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testMultiException_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Success: "); - sb.Append(Success== null ? "" : Success.ToString()); - } - if (Err1 != null && __isset.err1) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Err1: "); - sb.Append(Err1== null ? "" : Err1.ToString()); - } - if (Err2 != null && __isset.err2) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Err2: "); - sb.Append(Err2== null ? "" : Err2.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - - - public partial class testOnewayArgs : TBase - { - private int _secondsToSleep; - - public int SecondsToSleep - { - get - { - return _secondsToSleep; - } - set - { - __isset.secondsToSleep = true; - this._secondsToSleep = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool secondsToSleep; - } - - public testOnewayArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - SecondsToSleep = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("testOneway_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.secondsToSleep) - { - field.Name = "secondsToSleep"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(SecondsToSleep, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("testOneway_args("); - bool __first = true; - if (__isset.secondsToSleep) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("SecondsToSleep: "); - sb.Append(SecondsToSleep); - } - sb.Append(")"); - return sb.ToString(); - } - } - - } -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs deleted file mode 100644 index 8b6108405b9..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV1.cs +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class VersioningTestV1 : TBase - { - private int _begin_in_both; - private string _old_string; - private int _end_in_both; - - public int Begin_in_both - { - get - { - return _begin_in_both; - } - set - { - __isset.begin_in_both = true; - this._begin_in_both = value; - } - } - - public string Old_string - { - get - { - return _old_string; - } - set - { - __isset.old_string = true; - this._old_string = value; - } - } - - public int End_in_both - { - get - { - return _end_in_both; - } - set - { - __isset.end_in_both = true; - this._end_in_both = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool begin_in_both; - public bool old_string; - public bool end_in_both; - } - - public VersioningTestV1() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Begin_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.String) - { - Old_string = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 12: - if (field.Type == TType.I32) - { - End_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("VersioningTestV1"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.begin_in_both) - { - field.Name = "begin_in_both"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Begin_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Old_string != null && __isset.old_string) - { - field.Name = "old_string"; - field.Type = TType.String; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Old_string, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.end_in_both) - { - field.Name = "end_in_both"; - field.Type = TType.I32; - field.ID = 12; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(End_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("VersioningTestV1("); - bool __first = true; - if (__isset.begin_in_both) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Begin_in_both: "); - sb.Append(Begin_in_both); - } - if (Old_string != null && __isset.old_string) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Old_string: "); - sb.Append(Old_string); - } - if (__isset.end_in_both) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("End_in_both: "); - sb.Append(End_in_both); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs deleted file mode 100644 index 994ced5f0cc..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/VersioningTestV2.cs +++ /dev/null @@ -1,647 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class VersioningTestV2 : TBase - { - private int _begin_in_both; - private int _newint; - private sbyte _newbyte; - private short _newshort; - private long _newlong; - private double _newdouble; - private Bonk _newstruct; - private List _newlist; - private THashSet _newset; - private Dictionary _newmap; - private string _newstring; - private int _end_in_both; - - public int Begin_in_both - { - get - { - return _begin_in_both; - } - set - { - __isset.begin_in_both = true; - this._begin_in_both = value; - } - } - - public int Newint - { - get - { - return _newint; - } - set - { - __isset.newint = true; - this._newint = value; - } - } - - public sbyte Newbyte - { - get - { - return _newbyte; - } - set - { - __isset.newbyte = true; - this._newbyte = value; - } - } - - public short Newshort - { - get - { - return _newshort; - } - set - { - __isset.newshort = true; - this._newshort = value; - } - } - - public long Newlong - { - get - { - return _newlong; - } - set - { - __isset.newlong = true; - this._newlong = value; - } - } - - public double Newdouble - { - get - { - return _newdouble; - } - set - { - __isset.newdouble = true; - this._newdouble = value; - } - } - - public Bonk Newstruct - { - get - { - return _newstruct; - } - set - { - __isset.newstruct = true; - this._newstruct = value; - } - } - - public List Newlist - { - get - { - return _newlist; - } - set - { - __isset.newlist = true; - this._newlist = value; - } - } - - public THashSet Newset - { - get - { - return _newset; - } - set - { - __isset.newset = true; - this._newset = value; - } - } - - public Dictionary Newmap - { - get - { - return _newmap; - } - set - { - __isset.newmap = true; - this._newmap = value; - } - } - - public string Newstring - { - get - { - return _newstring; - } - set - { - __isset.newstring = true; - this._newstring = value; - } - } - - public int End_in_both - { - get - { - return _end_in_both; - } - set - { - __isset.end_in_both = true; - this._end_in_both = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool begin_in_both; - public bool newint; - public bool newbyte; - public bool newshort; - public bool newlong; - public bool newdouble; - public bool newstruct; - public bool newlist; - public bool newset; - public bool newmap; - public bool newstring; - public bool end_in_both; - } - - public VersioningTestV2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Begin_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Newint = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.Byte) - { - Newbyte = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I16) - { - Newshort = await iprot.ReadI16Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 5: - if (field.Type == TType.I64) - { - Newlong = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 6: - if (field.Type == TType.Double) - { - Newdouble = await iprot.ReadDoubleAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 7: - if (field.Type == TType.Struct) - { - Newstruct = new Bonk(); - await Newstruct.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 8: - if (field.Type == TType.List) - { - { - Newlist = new List(); - TList _list44 = await iprot.ReadListBeginAsync(cancellationToken); - for(int _i45 = 0; _i45 < _list44.Count; ++_i45) - { - int _elem46; - _elem46 = await iprot.ReadI32Async(cancellationToken); - Newlist.Add(_elem46); - } - await iprot.ReadListEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.Set) - { - { - Newset = new THashSet(); - TSet _set47 = await iprot.ReadSetBeginAsync(cancellationToken); - for(int _i48 = 0; _i48 < _set47.Count; ++_i48) - { - int _elem49; - _elem49 = await iprot.ReadI32Async(cancellationToken); - Newset.Add(_elem49); - } - await iprot.ReadSetEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 10: - if (field.Type == TType.Map) - { - { - Newmap = new Dictionary(); - TMap _map50 = await iprot.ReadMapBeginAsync(cancellationToken); - for(int _i51 = 0; _i51 < _map50.Count; ++_i51) - { - int _key52; - int _val53; - _key52 = await iprot.ReadI32Async(cancellationToken); - _val53 = await iprot.ReadI32Async(cancellationToken); - Newmap[_key52] = _val53; - } - await iprot.ReadMapEndAsync(cancellationToken); - } - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.String) - { - Newstring = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 12: - if (field.Type == TType.I32) - { - End_in_both = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("VersioningTestV2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.begin_in_both) - { - field.Name = "begin_in_both"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Begin_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newint) - { - field.Name = "newint"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Newint, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newbyte) - { - field.Name = "newbyte"; - field.Type = TType.Byte; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Newbyte, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newshort) - { - field.Name = "newshort"; - field.Type = TType.I16; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI16Async(Newshort, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newlong) - { - field.Name = "newlong"; - field.Type = TType.I64; - field.ID = 5; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(Newlong, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.newdouble) - { - field.Name = "newdouble"; - field.Type = TType.Double; - field.ID = 6; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteDoubleAsync(Newdouble, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newstruct != null && __isset.newstruct) - { - field.Name = "newstruct"; - field.Type = TType.Struct; - field.ID = 7; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Newstruct.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newlist != null && __isset.newlist) - { - field.Name = "newlist"; - field.Type = TType.List; - field.ID = 8; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteListBeginAsync(new TList(TType.I32, Newlist.Count), cancellationToken); - foreach (int _iter54 in Newlist) - { - await oprot.WriteI32Async(_iter54, cancellationToken); - } - await oprot.WriteListEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newset != null && __isset.newset) - { - field.Name = "newset"; - field.Type = TType.Set; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteSetBeginAsync(new TSet(TType.I32, Newset.Count), cancellationToken); - foreach (int _iter55 in Newset) - { - await oprot.WriteI32Async(_iter55, cancellationToken); - } - await oprot.WriteSetEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newmap != null && __isset.newmap) - { - field.Name = "newmap"; - field.Type = TType.Map; - field.ID = 10; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - { - await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.I32, Newmap.Count), cancellationToken); - foreach (int _iter56 in Newmap.Keys) - { - await oprot.WriteI32Async(_iter56, cancellationToken); - await oprot.WriteI32Async(Newmap[_iter56], cancellationToken); - } - await oprot.WriteMapEndAsync(cancellationToken); - } - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Newstring != null && __isset.newstring) - { - field.Name = "newstring"; - field.Type = TType.String; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Newstring, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.end_in_both) - { - field.Name = "end_in_both"; - field.Type = TType.I32; - field.ID = 12; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(End_in_both, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("VersioningTestV2("); - bool __first = true; - if (__isset.begin_in_both) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Begin_in_both: "); - sb.Append(Begin_in_both); - } - if (__isset.newint) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newint: "); - sb.Append(Newint); - } - if (__isset.newbyte) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newbyte: "); - sb.Append(Newbyte); - } - if (__isset.newshort) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newshort: "); - sb.Append(Newshort); - } - if (__isset.newlong) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newlong: "); - sb.Append(Newlong); - } - if (__isset.newdouble) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newdouble: "); - sb.Append(Newdouble); - } - if (Newstruct != null && __isset.newstruct) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newstruct: "); - sb.Append(Newstruct== null ? "" : Newstruct.ToString()); - } - if (Newlist != null && __isset.newlist) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newlist: "); - sb.Append(Newlist); - } - if (Newset != null && __isset.newset) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newset: "); - sb.Append(Newset); - } - if (Newmap != null && __isset.newmap) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newmap: "); - sb.Append(Newmap); - } - if (Newstring != null && __isset.newstring) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Newstring: "); - sb.Append(Newstring); - } - if (__isset.end_in_both) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("End_in_both: "); - sb.Append(End_in_both); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs deleted file mode 100644 index 25bad84ae4b..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception.cs +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Xception : TException, TBase - { - private int _errorCode; - private string _message; - - public int ErrorCode - { - get - { - return _errorCode; - } - set - { - __isset.errorCode = true; - this._errorCode = value; - } - } - - public string Message - { - get - { - return _message; - } - set - { - __isset.message = true; - this._message = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool errorCode; - public bool message; - } - - public Xception() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ErrorCode = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Message = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xception"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.errorCode) - { - field.Name = "errorCode"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ErrorCode, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Message != null && __isset.message) - { - field.Name = "message"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Message, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xception("); - bool __first = true; - if (__isset.errorCode) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("ErrorCode: "); - sb.Append(ErrorCode); - } - if (Message != null && __isset.message) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Message: "); - sb.Append(Message); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs deleted file mode 100644 index 075f5cd0cd6..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xception2.cs +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Xception2 : TException, TBase - { - private int _errorCode; - private Xtruct _struct_thing; - - public int ErrorCode - { - get - { - return _errorCode; - } - set - { - __isset.errorCode = true; - this._errorCode = value; - } - } - - public Xtruct Struct_thing - { - get - { - return _struct_thing; - } - set - { - __isset.struct_thing = true; - this._struct_thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool errorCode; - public bool struct_thing; - } - - public Xception2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - ErrorCode = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Struct_thing = new Xtruct(); - await Struct_thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xception2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.errorCode) - { - field.Name = "errorCode"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(ErrorCode, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Struct_thing != null && __isset.struct_thing) - { - field.Name = "struct_thing"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Struct_thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xception2("); - bool __first = true; - if (__isset.errorCode) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("ErrorCode: "); - sb.Append(ErrorCode); - } - if (Struct_thing != null && __isset.struct_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Struct_thing: "); - sb.Append(Struct_thing== null ? "" : Struct_thing.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs deleted file mode 100644 index 947430b1ce1..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct.cs +++ /dev/null @@ -1,264 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Xtruct : TBase - { - private string _string_thing; - private sbyte _byte_thing; - private int _i32_thing; - private long _i64_thing; - - public string String_thing - { - get - { - return _string_thing; - } - set - { - __isset.string_thing = true; - this._string_thing = value; - } - } - - public sbyte Byte_thing - { - get - { - return _byte_thing; - } - set - { - __isset.byte_thing = true; - this._byte_thing = value; - } - } - - public int I32_thing - { - get - { - return _i32_thing; - } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - public long I64_thing - { - get - { - return _i64_thing; - } - set - { - __isset.i64_thing = true; - this._i64_thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool string_thing; - public bool byte_thing; - public bool i32_thing; - public bool i64_thing; - } - - public Xtruct() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.Byte) - { - Byte_thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.I64) - { - I64_thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_thing != null && __isset.string_thing) - { - field.Name = "string_thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.byte_thing) - { - field.Name = "byte_thing"; - field.Type = TType.Byte; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Byte_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i64_thing) - { - field.Name = "i64_thing"; - field.Type = TType.I64; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(I64_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct("); - bool __first = true; - if (String_thing != null && __isset.string_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("String_thing: "); - sb.Append(String_thing); - } - if (__isset.byte_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Byte_thing: "); - sb.Append(Byte_thing); - } - if (__isset.i32_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - if (__isset.i64_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("I64_thing: "); - sb.Append(I64_thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs deleted file mode 100644 index 6c9afe29339..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct2.cs +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Xtruct2 : TBase - { - private sbyte _byte_thing; - private Xtruct _struct_thing; - private int _i32_thing; - - public sbyte Byte_thing - { - get - { - return _byte_thing; - } - set - { - __isset.byte_thing = true; - this._byte_thing = value; - } - } - - public Xtruct Struct_thing - { - get - { - return _struct_thing; - } - set - { - __isset.struct_thing = true; - this._struct_thing = value; - } - } - - public int I32_thing - { - get - { - return _i32_thing; - } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool byte_thing; - public bool struct_thing; - public bool i32_thing; - } - - public Xtruct2() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.Byte) - { - Byte_thing = await iprot.ReadByteAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - Struct_thing = new Xtruct(); - await Struct_thing.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct2"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.byte_thing) - { - field.Name = "byte_thing"; - field.Type = TType.Byte; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteByteAsync(Byte_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Struct_thing != null && __isset.struct_thing) - { - field.Name = "struct_thing"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Struct_thing.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct2("); - bool __first = true; - if (__isset.byte_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Byte_thing: "); - sb.Append(Byte_thing); - } - if (Struct_thing != null && __isset.struct_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Struct_thing: "); - sb.Append(Struct_thing== null ? "" : Struct_thing.ToString()); - } - if (__isset.i32_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs b/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs deleted file mode 100644 index f76168dfaaf..00000000000 --- a/test/netcore/ThriftTest/gen-netcore/thrift/test/Xtruct3.cs +++ /dev/null @@ -1,264 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (@PACKAGE_VERSION@) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; - -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace thrift.test -{ - - public partial class Xtruct3 : TBase - { - private string _string_thing; - private int _changed; - private int _i32_thing; - private long _i64_thing; - - public string String_thing - { - get - { - return _string_thing; - } - set - { - __isset.string_thing = true; - this._string_thing = value; - } - } - - public int Changed - { - get - { - return _changed; - } - set - { - __isset.changed = true; - this._changed = value; - } - } - - public int I32_thing - { - get - { - return _i32_thing; - } - set - { - __isset.i32_thing = true; - this._i32_thing = value; - } - } - - public long I64_thing - { - get - { - return _i64_thing; - } - set - { - __isset.i64_thing = true; - this._i64_thing = value; - } - } - - - public Isset __isset; - public struct Isset - { - public bool string_thing; - public bool changed; - public bool i32_thing; - public bool i64_thing; - } - - public Xtruct3() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.String) - { - String_thing = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.I32) - { - Changed = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 9: - if (field.Type == TType.I32) - { - I32_thing = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 11: - if (field.Type == TType.I64) - { - I64_thing = await iprot.ReadI64Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Xtruct3"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (String_thing != null && __isset.string_thing) - { - field.Name = "string_thing"; - field.Type = TType.String; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(String_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.changed) - { - field.Name = "changed"; - field.Type = TType.I32; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Changed, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i32_thing) - { - field.Name = "i32_thing"; - field.Type = TType.I32; - field.ID = 9; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(I32_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.i64_thing) - { - field.Name = "i64_thing"; - field.Type = TType.I64; - field.ID = 11; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI64Async(I64_thing, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Xtruct3("); - bool __first = true; - if (String_thing != null && __isset.string_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("String_thing: "); - sb.Append(String_thing); - } - if (__isset.changed) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("Changed: "); - sb.Append(Changed); - } - if (__isset.i32_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("I32_thing: "); - sb.Append(I32_thing); - } - if (__isset.i64_thing) - { - if(!__first) { sb.Append(", "); } - __first = false; - sb.Append("I64_thing: "); - sb.Append(I64_thing); - } - sb.Append(")"); - return sb.ToString(); - } - } - -} diff --git a/test/netcore/ThriftTest/project.json b/test/netcore/ThriftTest/project.json index 1f552361e30..56d27777398 100644 --- a/test/netcore/ThriftTest/project.json +++ b/test/netcore/ThriftTest/project.json @@ -1,4 +1,4 @@ -{ +{ "version": "1.0.0-*", "buildOptions": { "emitEntryPoint": true @@ -11,6 +11,8 @@ }, "dependencies": { + "System.Runtime.Serialization.Primitives": "4.1.1", + "System.ServiceModel.Primitives": "4.0.0" }, "frameworks": { diff --git a/test/netcore/build.cmd b/test/netcore/build.cmd new file mode 100644 index 00000000000..88ff20aeed9 --- /dev/null +++ b/test/netcore/build.cmd @@ -0,0 +1,45 @@ +@echo off +rem /* +rem * Licensed to the Apache Software Foundation (ASF) under one +rem * or more contributor license agreements. See the NOTICE file +rem * distributed with this work for additional information +rem * regarding copyright ownership. The ASF licenses this file +rem * to you under the Apache License, Version 2.0 (the +rem * "License"); you may not use this file except in compliance +rem * with the License. You may obtain a copy of the License at +rem * +rem * http://www.apache.org/licenses/LICENSE-2.0 +rem * +rem * Unless required by applicable law or agreed to in writing, +rem * software distributed under the License is distributed on an +rem * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +rem * KIND, either express or implied. See the License for the +rem * specific language governing permissions and limitations +rem * under the License. +rem */ +setlocal + +cd ThriftTest +thrift -gen netcore:wcf -r ..\..\ThriftTest.thrift +cd .. + +rem * Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline +rem * For details see https://github.com/dotnet/cli/issues/3199 and related tickets +rem * The problem does NOT affect Visual Studio builds. + +rem * workaround for "dotnet restore" issue +xcopy ..\..\lib\netcore\Thrift .\Thrift /YSEI >NUL + +dotnet --info +dotnet restore + +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 + +rem * workaround for "dotnet restore" issue +del .\Thrift\* /Q /S >NUL +rd .\Thrift /Q /S >NUL + + +:eof diff --git a/test/netcore/build.sh b/test/netcore/build.sh new file mode 100644 index 00000000000..3acd78a208a --- /dev/null +++ b/test/netcore/build.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +#exit if any command fails +#set -e + +cd ThriftTest +../../../compiler/cpp/thrift -gen netcore:wcf -r ../../ThriftTest.thrift +cd .. + + +# Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline +# For details see https://github.com/dotnet/cli/issues/3199 and related tickets +# The problem does NOT affect Visual Studio builds. + +# workaround for "dotnet restore" issue +cp -u -p -r ..\..\lib\netcore\Thrift .\Thrift + +dotnet --info +dotnet restore + +# dotnet test ./test/TEST_PROJECT_NAME -c Release -f netcoreapp1.0 + +# Instead, run directly with mono for the full .net version +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 + +#revision=${TRAVIS_JOB_ID:=1} +#revision=$(printf "%04d" $revision) + +#dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision + +# workaround for "dotnet restore" issue +rm -r .\Thrift + diff --git a/test/netcore/global.json b/test/netcore/global.json index c1f3637ee87..53f181109b3 100644 --- a/test/netcore/global.json +++ b/test/netcore/global.json @@ -1,3 +1,3 @@ { - "projects": [ "../../lib/netcore/src" ] + "projects": [ "../../lib/netcore" ] } \ No newline at end of file diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am index 5865c54aa80..efa314ae5cf 100755 --- a/tutorial/Makefile.am +++ b/tutorial/Makefile.am @@ -58,6 +58,10 @@ if WITH_HAXE SUBDIRS += haxe endif +if WITH_DOTNETCORE +SUBDIRS += netcore +endif + if WITH_GO SUBDIRS += go endif diff --git a/tutorial/netcore/Client/Program.cs b/tutorial/netcore/Client/Program.cs index ff4474dd50e..5485e950313 100644 --- a/tutorial/netcore/Client/Program.cs +++ b/tutorial/netcore/Client/Program.cs @@ -27,9 +27,10 @@ using Microsoft.Extensions.Logging; using Thrift; using Thrift.Protocols; -using Thrift.Samples; using Thrift.Transports; using Thrift.Transports.Client; +using tutorial; +using shared; namespace Client { @@ -195,15 +196,15 @@ private static async Task RunClientAsync(TProtocol protocol, // Async version Logger.LogInformation("PingAsync()"); - await client.PingAsync(cancellationToken); + await client.pingAsync(cancellationToken); Logger.LogInformation("AddAsync(1,1)"); - var sum = await client.AddAsync(1, 1, cancellationToken); + var sum = await client.addAsync(1, 1, cancellationToken); Logger.LogInformation($"AddAsync(1,1)={sum}"); var work = new Work { - Op = Operation.Divide, + Op = Operation.DIVIDE, Num1 = 1, Num2 = 0 }; @@ -211,7 +212,7 @@ private static async Task RunClientAsync(TProtocol protocol, try { Logger.LogInformation("CalculateAsync(1)"); - await client.CalculateAsync(1, work, cancellationToken); + await client.calculateAsync(1, work, cancellationToken); Logger.LogInformation("Whoa we can divide by 0"); } catch (InvalidOperation io) @@ -219,14 +220,14 @@ private static async Task RunClientAsync(TProtocol protocol, Logger.LogInformation("Invalid operation: " + io); } - work.Op = Operation.Substract; + work.Op = Operation.SUBTRACT; work.Num1 = 15; work.Num2 = 10; try { Logger.LogInformation("CalculateAsync(1)"); - var diff = await client.CalculateAsync(1, work, cancellationToken); + var diff = await client.calculateAsync(1, work, cancellationToken); Logger.LogInformation($"15-10={diff}"); } catch (InvalidOperation io) @@ -235,11 +236,11 @@ private static async Task RunClientAsync(TProtocol protocol, } Logger.LogInformation("GetStructAsync(1)"); - var log = await client.GetStructAsync(1, cancellationToken); + var log = await client.getStructAsync(1, cancellationToken); Logger.LogInformation($"Check log: {log.Value}"); Logger.LogInformation("ZipAsync() with delay 100mc on server side"); - await client.ZipAsync(cancellationToken); + await client.zipAsync(cancellationToken); } catch (Exception ex) { diff --git a/tutorial/netcore/Client/Properties/AssemblyInfo.cs b/tutorial/netcore/Client/Properties/AssemblyInfo.cs index 935f130638e..568382e66dc 100644 --- a/tutorial/netcore/Client/Properties/AssemblyInfo.cs +++ b/tutorial/netcore/Client/Properties/AssemblyInfo.cs @@ -24,8 +24,9 @@ // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Client")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] [assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/tutorial/netcore/Client/project.json b/tutorial/netcore/Client/project.json index 8b0884bda92..c850e5d5528 100644 --- a/tutorial/netcore/Client/project.json +++ b/tutorial/netcore/Client/project.json @@ -10,7 +10,9 @@ "Microsoft.NETCore.App": { "version": "1.0.0" }, - "Thrift": "1.0.0-*" }, + "Thrift": "1.0.0-*", + //"Thrift": "1.0.0-*" + }, "runtimes": { "win10-x64": {}, diff --git a/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs b/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs index a22f945e6a9..9126b173e7c 100644 --- a/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs +++ b/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs @@ -24,8 +24,9 @@ // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Interfaces")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] [assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs deleted file mode 100644 index ab84e328c08..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/Calculator.cs +++ /dev/null @@ -1,1230 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Thrift.Samples -{ - public partial class Calculator - { - /// - /// Ahh, now onto the cool part, defining a service. Services just need a name - /// and can optionally inherit from another service using the extends keyword. - /// - [ServiceContract(Namespace = "")] - public interface IAsync : SharedService.IAsync - { - /// - /// A method definition looks like C code. It has a return type, arguments, - /// and optionally a list of exceptions that it may throw. Note that argument - /// lists and exception lists are specified using the exact same syntax as - /// field lists in struct or exception definitions. - /// - [OperationContract] - Task PingAsync(CancellationToken cancellationToken); - - [OperationContract] - Task @AddAsync(int num1, int num2, CancellationToken cancellationToken); - - [OperationContract] - [FaultContract(typeof(InvalidOperationFault))] - Task CalculateAsync(int logid, Work w, CancellationToken cancellationToken); - - /// - /// This method has a oneway modifier. That means the client only makes - /// a request and does not listen for any response at all. Oneway methods - /// must be void. - /// - [OperationContract] - Task ZipAsync(CancellationToken cancellationToken); - } - - - /// - /// Ahh, now onto the cool part, defining a service. Services just need a name - /// and can optionally inherit from another service using the extends keyword. - /// - public class Client : SharedService.Client, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task PingAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Call, SeqId), - cancellationToken); - - var args = new PingArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new PingResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - return; - } - - public async Task @AddAsync(int num1, int num2, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Call, SeqId), - cancellationToken); - - var args = new AddArgs(); - args.Num1 = num1; - args.Num2 = num2; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new AddResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "Add failed: unknown result"); - } - - public async Task CalculateAsync(int logid, Work w, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Call, SeqId), - cancellationToken); - - var args = new CalculateArgs(); - args.Logid = logid; - args.W = w; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new CalculateResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - if (result.__isset.ouch) - { - throw result.Ouch; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "Calculate failed: unknown result"); - } - - public async Task ZipAsync(CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("Zip", TMessageType.Oneway, SeqId), - cancellationToken); - - var args = new ZipArgs(); - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - } - } - - public class AsyncProcessor : SharedService.AsyncProcessor, ITAsyncProcessor - { - private IAsync _iAsync; - - public AsyncProcessor(IAsync iAsync) : base(iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["Ping"] = Ping_ProcessAsync; - processMap_["Add"] = Add_ProcessAsync; - processMap_["Calculate"] = Calculate_ProcessAsync; - processMap_["Zip"] = Zip_ProcessAsync; - } - - - public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public new async Task ProcessAsync(TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task Ping_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new PingArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new PingResult(); - try - { - await _iAsync.PingAsync(cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("Ping", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task Add_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new AddArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new AddResult(); - try - { - result.Success = await _iAsync.@AddAsync(args.Num1, args.Num2, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Reply, seqid), cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("Add", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task Calculate_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new CalculateArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new CalculateResult(); - try - { - try - { - result.Success = await _iAsync.CalculateAsync(args.Logid, args.W, cancellationToken); - } - catch (InvalidOperation ouch) - { - result.Ouch = ouch; - } - await - oprot.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("Calculate", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - public async Task Zip_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new ZipArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - try - { - await _iAsync.ZipAsync(cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - } - } - } - - - [DataContract(Namespace = "")] - public partial class PingArgs : TBase - { - public PingArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Ping_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Ping_args("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class PingResult : TBase - { - public PingResult() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Ping_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Ping_result("); - sb.Append(")"); - return sb.ToString(); - } - } - - - [DataContract(Namespace = "")] - public partial class AddArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _num1; - private int _num2; - - public AddArgs() - { - } - - [DataMember(Order = 0)] - public int Num1 - { - get { return _num1; } - set - { - __isset.num1 = true; - this._num1 = value; - } - } - - [DataMember(Order = 0)] - public int Num2 - { - get { return _num2; } - set - { - __isset.num2 = true; - this._num2 = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Num1 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Num2 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Add_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.num1) - { - field.Name = "num1"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Num1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.num2) - { - field.Name = "num2"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Num2, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Add_args("); - bool __first = true; - if (__isset.num1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Num1: "); - sb.Append(Num1); - } - if (__isset.num2) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Num2: "); - sb.Append(Num2); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool num1; - [DataMember] public bool num2; - } - - #region XmlSerializer support - - public bool ShouldSerializeNum1() - { - return __isset.num1; - } - - public bool ShouldSerializeNum2() - { - return __isset.num2; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class AddResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _success; - - public AddResult() - { - } - - [DataMember(Order = 0)] - public int Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Add_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("Add_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - - - [DataContract(Namespace = "")] - public partial class CalculateArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _logid; - private Work _w; - - public CalculateArgs() - { - } - - [DataMember(Order = 0)] - public int Logid - { - get { return _logid; } - set - { - __isset.logid = true; - this._logid = value; - } - } - - [DataMember(Order = 0)] - public Work W - { - get { return _w; } - set - { - __isset.w = true; - this._w = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Logid = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.Struct) - { - W = new Work(); - await W.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Calculate_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.logid) - { - field.Name = "logid"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Logid, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (W != null && __isset.w) - { - field.Name = "w"; - field.Type = TType.Struct; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await W.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Calculate_args("); - bool __first = true; - if (__isset.logid) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Logid: "); - sb.Append(Logid); - } - if (W != null && __isset.w) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("W: "); - sb.Append(W == null ? "" : W.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool logid; - [DataMember] public bool w; - } - - #region XmlSerializer support - - public bool ShouldSerializeLogid() - { - return __isset.logid; - } - - public bool ShouldSerializeW() - { - return __isset.w; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class CalculateResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private InvalidOperation _ouch; - private int _success; - - public CalculateResult() - { - } - - [DataMember(Order = 0)] - public int Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - [DataMember(Order = 0)] - public InvalidOperation Ouch - { - get { return _ouch; } - set - { - __isset.ouch = true; - this._ouch = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.I32) - { - Success = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 1: - if (field.Type == TType.Struct) - { - Ouch = new InvalidOperation(); - await Ouch.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Calculate_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - field.Name = "Success"; - field.Type = TType.I32; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Success, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - else if (this.__isset.ouch) - { - if (Ouch != null) - { - field.Name = "Ouch"; - field.Type = TType.Struct; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Ouch.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Calculate_result("); - bool __first = true; - if (__isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success); - } - if (Ouch != null && __isset.ouch) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Ouch: "); - sb.Append(Ouch == null ? "" : Ouch.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - [DataMember] public bool ouch; - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - public bool ShouldSerializeOuch() - { - return __isset.ouch; - } - - #endregion XmlSerializer support - } - - - [DataContract(Namespace = "")] - public partial class ZipArgs : TBase - { - public ZipArgs() - { - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Zip_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Zip_args("); - sb.Append(")"); - return sb.ToString(); - } - } - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs b/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs deleted file mode 100644 index d1936b47229..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/InvalidOperation.cs +++ /dev/null @@ -1,234 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Thrift.Samples -{ - /// - /// Structs can also be exceptions, if they are nasty. - /// - public partial class InvalidOperation : TException, TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _WhatOp; - private string _Why; - - public InvalidOperation() - { - } - - [DataMember(Order = 0)] - public int WhatOp - { - get { return _WhatOp; } - set - { - __isset.WhatOp = true; - this._WhatOp = value; - } - } - - [DataMember(Order = 0)] - public string Why - { - get { return _Why; } - set - { - __isset.Why = true; - this._Why = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - WhatOp = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Why = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("InvalidOperation"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.WhatOp) - { - field.Name = "WhatOp"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(WhatOp, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Why != null && __isset.Why) - { - field.Name = "Why"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Why, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("InvalidOperation("); - bool __first = true; - if (__isset.WhatOp) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("WhatOp: "); - sb.Append(WhatOp); - } - if (Why != null && __isset.Why) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Why: "); - sb.Append(Why); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool WhatOp; - [DataMember] public bool Why; - } - - #region XmlSerializer support - - public bool ShouldSerializeWhatOp() - { - return __isset.WhatOp; - } - - public bool ShouldSerializeWhy() - { - return __isset.Why; - } - - #endregion XmlSerializer support - } - - - [DataContract] - public partial class InvalidOperationFault - { - private int _WhatOp; - private string _Why; - - [DataMember(Order = 0)] - public int WhatOp - { - get { return _WhatOp; } - set { this._WhatOp = value; } - } - - [DataMember(Order = 0)] - public string Why - { - get { return _Why; } - set { this._Why = value; } - } - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs deleted file mode 100644 index b4f3098bce0..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/Operation.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace Thrift.Samples -{ - /// - /// You can define enums, which are just 32 bit integers. Values are optional - /// and start at 1 if not supplied, C style again. - /// - public enum Operation - { - Add = 1, - Substract = 2, - Multiply = 3, - Divide = 4, - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs b/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs deleted file mode 100644 index e35564a5839..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/SharedService.cs +++ /dev/null @@ -1,439 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Thrift.Samples -{ - public partial class SharedService - { - [ServiceContract(Namespace = "")] - public interface IAsync - { - [OperationContract] - Task GetStructAsync(int key, CancellationToken cancellationToken); - } - - - public class Client : TBaseClient, IDisposable, IAsync - { - public Client(TProtocol protocol) : this(protocol, protocol) - { - } - - public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol) - { - } - - public async Task GetStructAsync(int key, CancellationToken cancellationToken) - { - await - OutputProtocol.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Call, SeqId), - cancellationToken); - - var args = new GetStructArgs(); - args.Key = key; - - await args.WriteAsync(OutputProtocol, cancellationToken); - await OutputProtocol.WriteMessageEndAsync(cancellationToken); - await OutputProtocol.Transport.FlushAsync(cancellationToken); - - var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); - if (msg.Type == TMessageType.Exception) - { - var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - throw x; - } - - var result = new GetStructResult(); - await result.ReadAsync(InputProtocol, cancellationToken); - await InputProtocol.ReadMessageEndAsync(cancellationToken); - if (result.__isset.success) - { - return result.Success; - } - throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, - "GetStruct failed: unknown result"); - } - } - - public class AsyncProcessor : ITAsyncProcessor - { - private IAsync _iAsync; - protected Dictionary processMap_ = new Dictionary(); - - public AsyncProcessor(IAsync iAsync) - { - if (iAsync == null) throw new ArgumentNullException(nameof(iAsync)); - - _iAsync = iAsync; - processMap_["GetStruct"] = GetStruct_ProcessAsync; - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot) - { - return await ProcessAsync(iprot, oprot, CancellationToken.None); - } - - public async Task ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) - { - try - { - var msg = await iprot.ReadMessageBeginAsync(cancellationToken); - - ProcessFunction fn; - processMap_.TryGetValue(msg.Name, out fn); - - if (fn == null) - { - await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod, - "Invalid method name: '" + msg.Name + "'"); - await - oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - return true; - } - - await fn(msg.SeqID, iprot, oprot, cancellationToken); - } - catch (IOException) - { - return false; - } - - return true; - } - - public async Task GetStruct_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, - CancellationToken cancellationToken) - { - var args = new GetStructArgs(); - await args.ReadAsync(iprot, cancellationToken); - await iprot.ReadMessageEndAsync(cancellationToken); - var result = new GetStructResult(); - try - { - result.Success = await _iAsync.GetStructAsync(args.Key, cancellationToken); - await - oprot.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Reply, seqid), - cancellationToken); - await result.WriteAsync(oprot, cancellationToken); - } - catch (TTransportException) - { - throw; - } - catch (Exception ex) - { - Console.Error.WriteLine("Error occurred in processor:"); - Console.Error.WriteLine(ex.ToString()); - var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, - " Internal error."); - await - oprot.WriteMessageBeginAsync(new TMessage("GetStruct", TMessageType.Exception, seqid), - cancellationToken); - await x.WriteAsync(oprot, cancellationToken); - } - await oprot.WriteMessageEndAsync(cancellationToken); - await oprot.Transport.FlushAsync(cancellationToken); - } - - protected delegate Task ProcessFunction( - int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken); - } - - - [DataContract(Namespace = "")] - public partial class GetStructArgs : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _key; - - public GetStructArgs() - { - } - - [DataMember(Order = 0)] - public int Key - { - get { return _key; } - set - { - __isset.key = true; - this._key = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Key = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("GetStruct_args"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.key) - { - field.Name = "key"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeKey() - { - return __isset.key; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("GetStruct_args("); - bool __first = true; - if (__isset.key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Key: "); - sb.Append(Key); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool key; - } - } - - - [DataContract(Namespace = "")] - public partial class GetStructResult : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private SharedStruct _success; - - public GetStructResult() - { - } - - [DataMember(Order = 0)] - public SharedStruct Success - { - get { return _success; } - set - { - __isset.success = true; - this._success = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 0: - if (field.Type == TType.Struct) - { - Success = new SharedStruct(); - await Success.ReadAsync(iprot, cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("GetStruct_result"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - - if (this.__isset.success) - { - if (Success != null) - { - field.Name = "Success"; - field.Type = TType.Struct; - field.ID = 0; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await Success.WriteAsync(oprot, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - #region XmlSerializer support - - public bool ShouldSerializeSuccess() - { - return __isset.success; - } - - #endregion XmlSerializer support - - public override string ToString() - { - var sb = new StringBuilder("GetStruct_result("); - bool __first = true; - if (Success != null && __isset.success) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Success: "); - sb.Append(Success == null ? "" : Success.ToString()); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool success; - } - } - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs b/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs deleted file mode 100644 index 84901be6663..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/SharedStruct.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Thrift.Samples -{ - [DataContract(Namespace = "")] - public partial class SharedStruct : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private int _Key; - private string _Value; - - public SharedStruct() - { - } - - [DataMember(Order = 0)] - public int Key - { - get { return _Key; } - set - { - __isset.Key = true; - this._Key = value; - } - } - - [DataMember(Order = 0)] - public string Value - { - get { return _Value; } - set - { - __isset.@Value = true; - this._Value = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Key = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.String) - { - Value = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("SharedStruct"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.Key) - { - field.Name = "Key"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Key, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Value != null && __isset.@Value) - { - field.Name = "Value"; - field.Type = TType.String; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Value, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("SharedStruct("); - bool __first = true; - if (__isset.Key) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Key: "); - sb.Append(Key); - } - if (Value != null && __isset.@Value) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Value: "); - sb.Append(Value); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool Key; - [DataMember] public bool @Value; - } - - #region XmlSerializer support - - public bool ShouldSerializeKey() - { - return __isset.Key; - } - - public bool ShouldSerializeValue() - { - return __isset.@Value; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs b/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs deleted file mode 100644 index 48ff84297e8..00000000000 --- a/tutorial/netcore/Interfaces/Thrift/Samples/Work.cs +++ /dev/null @@ -1,317 +0,0 @@ -// Licensed to the Apache Software Foundation(ASF) under one -// or more contributor license agreements.See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership.The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Thrift; -using Thrift.Collections; -using System.ServiceModel; -using System.Runtime.Serialization; -using Thrift.Protocols; -using Thrift.Protocols.Entities; -using Thrift.Protocols.Utilities; -using Thrift.Transports; -using Thrift.Transports.Client; -using Thrift.Transports.Server; - - -namespace Thrift.Samples -{ - /// - /// Structs are the basic complex data structures. They are comprised of fields - /// which each have an integer identifier, a type, a symbolic name, and an - /// optional default value. - /// Fields can be declared "optional", which ensures they will not be included - /// in the serialized output if they aren't set. Note that this requires some - /// manual management in some languages. - /// - [DataContract(Namespace = "")] - public partial class Work : TBase - { - [DataMember(Order = 1)] public Isset __isset; - - private string _Comment; - private int _Num1; - private int _Num2; - private Operation _Op; - - public Work() - { - this._Num1 = 0; - this.__isset.Num1 = true; - } - - [DataMember(Order = 0)] - public int Num1 - { - get { return _Num1; } - set - { - __isset.Num1 = true; - this._Num1 = value; - } - } - - [DataMember(Order = 0)] - public int Num2 - { - get { return _Num2; } - set - { - __isset.Num2 = true; - this._Num2 = value; - } - } - - /// - /// - /// - [DataMember(Order = 0)] - public Operation Op - { - get { return _Op; } - set - { - __isset.Op = true; - this._Op = value; - } - } - - [DataMember(Order = 0)] - public string Comment - { - get { return _Comment; } - set - { - __isset.Comment = true; - this._Comment = value; - } - } - - public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) - { - iprot.IncrementRecursionDepth(); - try - { - TField field; - await iprot.ReadStructBeginAsync(cancellationToken); - while (true) - { - field = await iprot.ReadFieldBeginAsync(cancellationToken); - if (field.Type == TType.Stop) - { - break; - } - - switch (field.ID) - { - case 1: - if (field.Type == TType.I32) - { - Num1 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 2: - if (field.Type == TType.I32) - { - Num2 = await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 3: - if (field.Type == TType.I32) - { - Op = (Operation) await iprot.ReadI32Async(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - case 4: - if (field.Type == TType.String) - { - Comment = await iprot.ReadStringAsync(cancellationToken); - } - else - { - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - } - break; - default: - await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); - break; - } - - await iprot.ReadFieldEndAsync(cancellationToken); - } - - await iprot.ReadStructEndAsync(cancellationToken); - } - finally - { - iprot.DecrementRecursionDepth(); - } - } - - public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) - { - oprot.IncrementRecursionDepth(); - try - { - var struc = new TStruct("Work"); - await oprot.WriteStructBeginAsync(struc, cancellationToken); - var field = new TField(); - if (__isset.Num1) - { - field.Name = "Num1"; - field.Type = TType.I32; - field.ID = 1; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Num1, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.Num2) - { - field.Name = "Num2"; - field.Type = TType.I32; - field.ID = 2; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async(Num2, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (__isset.Op) - { - field.Name = "Op"; - field.Type = TType.I32; - field.ID = 3; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteI32Async((int) Op, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - if (Comment != null && __isset.Comment) - { - field.Name = "Comment"; - field.Type = TType.String; - field.ID = 4; - await oprot.WriteFieldBeginAsync(field, cancellationToken); - await oprot.WriteStringAsync(Comment, cancellationToken); - await oprot.WriteFieldEndAsync(cancellationToken); - } - await oprot.WriteFieldStopAsync(cancellationToken); - await oprot.WriteStructEndAsync(cancellationToken); - } - finally - { - oprot.DecrementRecursionDepth(); - } - } - - public override string ToString() - { - var sb = new StringBuilder("Work("); - bool __first = true; - if (__isset.Num1) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Num1: "); - sb.Append(Num1); - } - if (__isset.Num2) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Num2: "); - sb.Append(Num2); - } - if (__isset.Op) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Op: "); - sb.Append(Op); - } - if (Comment != null && __isset.Comment) - { - if (!__first) - { - sb.Append(", "); - } - __first = false; - sb.Append("Comment: "); - sb.Append(Comment); - } - sb.Append(")"); - return sb.ToString(); - } - - [DataContract] - public struct Isset - { - [DataMember] public bool Num1; - [DataMember] public bool Num2; - [DataMember] public bool Op; - [DataMember] public bool Comment; - } - - #region XmlSerializer support - - public bool ShouldSerializeNum1() - { - return __isset.Num1; - } - - public bool ShouldSerializeNum2() - { - return __isset.Num2; - } - - public bool ShouldSerializeOp() - { - return __isset.Op; - } - - public bool ShouldSerializeComment() - { - return __isset.Comment; - } - - #endregion XmlSerializer support - } -} \ No newline at end of file diff --git a/tutorial/netcore/Interfaces/project.json b/tutorial/netcore/Interfaces/project.json index 28cf4c19a74..b5f7c989acc 100644 --- a/tutorial/netcore/Interfaces/project.json +++ b/tutorial/netcore/Interfaces/project.json @@ -4,7 +4,8 @@ "dependencies": { "NETStandard.Library": "1.6.0", "System.ServiceModel.Primitives": "4.0.0", - "Thrift": "1.0.0-*" + "Thrift": "1.0.0-*", + //"Thrift": "1.0.0-*" }, "frameworks": { diff --git a/tutorial/netcore/Interfaces/shared.thrift b/tutorial/netcore/Interfaces/shared.thrift deleted file mode 100644 index 35f34b3fede..00000000000 --- a/tutorial/netcore/Interfaces/shared.thrift +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * This Thrift file can be included by other Thrift files that want to share - * these definitions. - */ - -namespace csharp Thrift.Samples - -struct SharedStruct { - 1: i32 Key - 2: string Value -} - -service SharedService { - SharedStruct GetStruct(1: i32 key) -} diff --git a/tutorial/netcore/Interfaces/tutorial.thrift b/tutorial/netcore/Interfaces/tutorial.thrift deleted file mode 100644 index a9816f0f968..00000000000 --- a/tutorial/netcore/Interfaces/tutorial.thrift +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -# Thrift Tutorial -# Mark Slee (mcslee@facebook.com) -# -# This file aims to teach you how to use Thrift, in a .thrift file. Neato. The -# first thing to notice is that .thrift files support standard shell comments. -# This lets you make your thrift file executable and include your Thrift build -# step on the top line. And you can place comments like this anywhere you like. -# -# Before running this file, you will need to have installed the thrift compiler -# into /usr/local/bin. - -/** - * The first thing to know about are types. The available types in Thrift are: - * - * bool Boolean, one byte - * i8 (byte) Signed 8-bit integer - * i16 Signed 16-bit integer - * i32 Signed 32-bit integer - * i64 Signed 64-bit integer - * double 64-bit floating point value - * string String - * binary Blob (byte array) - * map Map from one type to another - * list Ordered list of one type - * set Set of unique elements of one type - * - * Did you also notice that Thrift supports C style comments? - */ - -// Just in case you were wondering... yes. We support simple C comments too. - -/** - * Thrift files can reference other Thrift files to include common struct - * and service definitions. These are found using the current path, or by - * searching relative to any paths specified with the -I compiler flag. - * - * Included objects are accessed using the name of the .thrift file as a - * prefix. i.e. shared.SharedObject - */ -include "shared.thrift" - -namespace csharp Thrift.Samples - -/** - * You can define enums, which are just 32 bit integers. Values are optional - * and start at 1 if not supplied, C style again. - */ -enum Operation { - Add = 1, - Substract = 2, - Multiply = 3, - Divide = 4 -} - -/** - * Structs are the basic complex data structures. They are comprised of fields - * which each have an integer identifier, a type, a symbolic name, and an - * optional default value. - * - * Fields can be declared "optional", which ensures they will not be included - * in the serialized output if they aren't set. Note that this requires some - * manual management in some languages. - */ -struct Work { - 1: i32 Num1 = 0, - 2: i32 Num2, - 3: Operation Op, - 4: optional string Comment, -} - -/** - * Structs can also be exceptions, if they are nasty. - */ -exception InvalidOperation { - 1: i32 WhatOp, - 2: string Why -} - -/** - * Ahh, now onto the cool part, defining a service. Services just need a name - * and can optionally inherit from another service using the extends keyword. - */ -service Calculator extends shared.SharedService { - - /** - * A method definition looks like C code. It has a return type, arguments, - * and optionally a list of exceptions that it may throw. Note that argument - * lists and exception lists are specified using the exact same syntax as - * field lists in struct or exception definitions. - */ - - void Ping(), - - i32 Add(1:i32 num1, 2:i32 num2), - - i32 Calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch), - - /** - * This method has a oneway modifier. That means the client only makes - * a request and does not listen for any response at all. Oneway methods - * must be void. - */ - oneway void Zip() - -} - -/** - * That just about covers the basics. Take a look in the test/ folder for more - * detailed examples. After you run this file, your generated code shows up - * in folders with names gen-. The generated code isn't too scary - * to look at. It even has pretty indentation. - */ diff --git a/tutorial/netcore/Makefile.am b/tutorial/netcore/Makefile.am new file mode 100644 index 00000000000..a3abaeeb572 --- /dev/null +++ b/tutorial/netcore/Makefile.am @@ -0,0 +1,82 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = . + +THRIFT = $(top_builddir)/compiler/cpp/thrift + +GENDIR = Interfaces/gen-netcore + +# Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline. +# The problem does NOT affect Visual Studio builds, only cmdline. +# - For details see https://github.com/dotnet/cli/issues/3199 and related tickets. +# - Workaround is to temporarily copy the Thrift project into the solution +COPYCMD = cp -u -p -r + + +THRIFTCODE = \ + Interfaces/Properties/AssemblyInfo.cs \ + Client/Properties/AssemblyInfo.cs \ + Client/Program.cs \ + Server/Properties/AssemblyInfo.cs \ + Server/Program.cs + +all-local: \ + Client.exe + +Client.exe: $(THRIFTCODE) + $(MKDIR_P) $(GENDIR) + $(THRIFT) -gen netcore:wcf -r -out $(GENDIR) $(top_srcdir)/tutorial/tutorial.thrift + $(MKDIR_P) ./Thrift + $(COPYCMD) $(top_srcdir)/lib/netcore/Thrift/* ./Thrift + $(DOTNETCORE) --info + $(DOTNETCORE) restore + $(DOTNETCORE) build **/*/project.json -r win10-x64 + $(DOTNETCORE) build **/*/project.json -r osx.10.11-x64 + $(DOTNETCORE) build **/*/project.json -r ubuntu.16.04-x64 + +clean-local: + $(RM) Client.exe + $(RM) Server.exe + $(RM) Interfaces.dll + $(RM) -r $(GENDIR) + $(RM) -r Client/bin + $(RM) -r Client/obj + $(RM) -r Server/bin + $(RM) -r Server/obj + $(RM) -r Interfaces/bin + $(RM) -r Interfaces/obj + $(RM) -r Thrift + +EXTRA_DIST = \ + $(THRIFTCODE) \ + global.json \ + Tutorial.sln \ + Interfaces/project.json \ + Interfaces/Interfaces.xproj \ + Server/project.json \ + Server/Server.xproj \ + Server/ThriftTest.pfx \ + Client/project.json \ + Client/Client.xproj \ + Client/ThriftTest.pfx \ + build.cmd \ + build.sh \ + README.md + diff --git a/tutorial/netcore/README.md b/tutorial/netcore/README.md index ca4240dad4c..18aac02a37f 100644 --- a/tutorial/netcore/README.md +++ b/tutorial/netcore/README.md @@ -80,10 +80,10 @@ Remarks: # How to test communication between NetCore and Python -* Generate code with the latest **thrift.exe** util (reuse *.thrift files from Samples folder) +* Generate code with the latest **thrift.exe** util * Ensure that **thrift.exe** util generated folder **gen-py** with generated code for Python * Create **client.py** and **server.py** from the code examples below and save them to the folder with previosly generated folder **gen-py** -* Run netcore samples (client and server) and python samples (client ans server) +* Run netcore samples (client and server) and python samples (client and server) Remarks: diff --git a/tutorial/netcore/Server/Program.cs b/tutorial/netcore/Server/Program.cs index b71e268e5ea..604192402ca 100644 --- a/tutorial/netcore/Server/Program.cs +++ b/tutorial/netcore/Server/Program.cs @@ -30,10 +30,11 @@ using Microsoft.Extensions.Logging; using Thrift; using Thrift.Protocols; -using Thrift.Samples; using Thrift.Server; using Thrift.Transports; using Thrift.Transports.Server; +using tutorial; +using shared; namespace Server { @@ -311,46 +312,45 @@ public CalculatorAsyncHandler() _log = new Dictionary(); } - public async Task GetStructAsync(int key, + public async Task getStructAsync(int key, CancellationToken cancellationToken) { Logger.LogInformation("GetStructAsync({0})", key); return await Task.FromResult(_log[key]); } - public async Task PingAsync(CancellationToken cancellationToken) + public async Task pingAsync(CancellationToken cancellationToken) { Logger.LogInformation("PingAsync()"); await Task.CompletedTask; } - public async Task AddAsync(int num1, int num2, CancellationToken cancellationToken) + public async Task addAsync(int num1, int num2, CancellationToken cancellationToken) { Logger.LogInformation($"AddAsync({num1},{num2})"); return await Task.FromResult(num1 + num2); } - public async Task CalculateAsync(int logid, Work w, - CancellationToken cancellationToken) + public async Task calculateAsync(int logid, Work w, CancellationToken cancellationToken) { Logger.LogInformation($"CalculateAsync({logid}, [{w.Op},{w.Num1},{w.Num2}])"); var val = 0; switch (w.Op) { - case Operation.Add: + case Operation.ADD: val = w.Num1 + w.Num2; break; - case Operation.Substract: + case Operation.SUBTRACT: val = w.Num1 - w.Num2; break; - case Operation.Multiply: + case Operation.MULTIPLY: val = w.Num1*w.Num2; break; - case Operation.Divide: + case Operation.DIVIDE: if (w.Num2 == 0) { var io = new InvalidOperation @@ -387,7 +387,7 @@ public async Task CalculateAsync(int logid, Work w, return await Task.FromResult(val); } - public async Task ZipAsync(CancellationToken cancellationToken) + public async Task zipAsync(CancellationToken cancellationToken) { Logger.LogInformation("ZipAsync() with delay 100mc"); await Task.Delay(100, CancellationToken.None); diff --git a/tutorial/netcore/Server/Properties/AssemblyInfo.cs b/tutorial/netcore/Server/Properties/AssemblyInfo.cs index 9062a4c2a6c..a0442350bd9 100644 --- a/tutorial/netcore/Server/Properties/AssemblyInfo.cs +++ b/tutorial/netcore/Server/Properties/AssemblyInfo.cs @@ -24,8 +24,9 @@ // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Server")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] [assembly: AssemblyTrademark("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/tutorial/netcore/Server/project.json b/tutorial/netcore/Server/project.json index 8fc6607ee26..7948c27f2b3 100644 --- a/tutorial/netcore/Server/project.json +++ b/tutorial/netcore/Server/project.json @@ -10,11 +10,11 @@ "Microsoft.NETCore.App": { "version": "1.0.0" }, - "Thrift": "1.0.0-*", "Microsoft.AspNetCore.Http": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", - "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0" }, + "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", + "Thrift": "1.0.0-*" }, "runtimes": { "win10-x64": {}, "osx.10.11-x64": {}, diff --git a/tutorial/netcore/Tutorial.sln b/tutorial/netcore/Tutorial.sln index d300841a1a4..0368f21ae76 100644 --- a/tutorial/netcore/Tutorial.sln +++ b/tutorial/netcore/Tutorial.sln @@ -9,6 +9,13 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Interfaces", "Interfaces\In EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Client", "Client\Client.xproj", "{DE78A01B-F7C6-49D1-97DA-669D2ED37641}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Thrift", "..\..\lib\netcore\Thrift\Thrift.xproj", "{6850CF46-5467-4C65-BD78-871581C539FC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{49B45AE5-C6CB-4E11-AA74-6A5472FFAF8F}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +34,10 @@ Global {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE78A01B-F7C6-49D1-97DA-669D2ED37641}.Release|Any CPU.Build.0 = Release|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6850CF46-5467-4C65-BD78-871581C539FC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tutorial/netcore/build.cmd b/tutorial/netcore/build.cmd new file mode 100644 index 00000000000..2d20cbedc35 --- /dev/null +++ b/tutorial/netcore/build.cmd @@ -0,0 +1,45 @@ +@echo off +rem /* +rem * Licensed to the Apache Software Foundation (ASF) under one +rem * or more contributor license agreements. See the NOTICE file +rem * distributed with this work for additional information +rem * regarding copyright ownership. The ASF licenses this file +rem * to you under the Apache License, Version 2.0 (the +rem * "License"); you may not use this file except in compliance +rem * with the License. You may obtain a copy of the License at +rem * +rem * http://www.apache.org/licenses/LICENSE-2.0 +rem * +rem * Unless required by applicable law or agreed to in writing, +rem * software distributed under the License is distributed on an +rem * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +rem * KIND, either express or implied. See the License for the +rem * specific language governing permissions and limitations +rem * under the License. +rem */ +setlocal + +cd Interfaces +thrift -gen netcore:wcf -r ..\..\tutorial.thrift +cd .. + +rem * Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline +rem * For details see https://github.com/dotnet/cli/issues/3199 and related tickets +rem * The problem does NOT affect Visual Studio builds. + +rem * workaround for "dotnet restore" issue +xcopy ..\..\lib\netcore\Thrift .\Thrift /YSEI >NUL + +dotnet --info +dotnet restore + +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 + +rem * workaround for "dotnet restore" issue +del .\Thrift\* /Q /S >NUL +rd .\Thrift /Q /S >NUL + + +:eof diff --git a/tutorial/netcore/build.sh b/tutorial/netcore/build.sh new file mode 100644 index 00000000000..38794551be4 --- /dev/null +++ b/tutorial/netcore/build.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +#exit if any command fails +#set -e + +cd Interfaces +../../../compiler/cpp/thrift -gen netcore:wcf -r ../../tutorial.thrift +cd .. + + +# Due to a known issue with "dotnet restore" the Thrift.dll dependency cannot be resolved from cmdline +# For details see https://github.com/dotnet/cli/issues/3199 and related tickets +# The problem does NOT affect Visual Studio builds. + +# workaround for "dotnet restore" issue +cp -u -p -r ..\..\lib\netcore\Thrift .\Thrift + +dotnet --info +dotnet restore + +dotnet build **/*/project.json -r win10-x64 +dotnet build **/*/project.json -r osx.10.11-x64 +dotnet build **/*/project.json -r ubuntu.16.04-x64 +# workaround for "dotnet restore" issue +rm -r .\Thrift diff --git a/tutorial/netcore/global.json b/tutorial/netcore/global.json new file mode 100644 index 00000000000..53f181109b3 --- /dev/null +++ b/tutorial/netcore/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "../../lib/netcore" ] +} \ No newline at end of file diff --git a/tutorial/shared.thrift b/tutorial/shared.thrift index 386000b17dc..3cc1bb34e5c 100644 --- a/tutorial/shared.thrift +++ b/tutorial/shared.thrift @@ -29,6 +29,7 @@ namespace java shared namespace perl shared namespace php shared namespace haxe shared +namespace netcore shared struct SharedStruct { 1: i32 key diff --git a/tutorial/tutorial.thrift b/tutorial/tutorial.thrift index c4a96f02c81..f8c5320d9aa 100644 --- a/tutorial/tutorial.thrift +++ b/tutorial/tutorial.thrift @@ -69,6 +69,7 @@ namespace java tutorial namespace php tutorial namespace perl tutorial namespace haxe tutorial +namespace netcore tutorial /** * Thrift lets you do typedefs to get pretty names for your types. Standard