diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln
index c58785742..94c2fa4a5 100644
--- a/OpenTelemetry.sln
+++ b/OpenTelemetry.sln
@@ -1,177 +1,168 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28407.52
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry", "src\OpenTelemetry\OpenTelemetry.csproj", "{AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests", "test\OpenTelemetry.Tests\OpenTelemetry.Tests.csproj", "{CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B7408D66-487A-40E1-BDB7-BC17BD28F721}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- CHANGELOG.md = CHANGELOG.md
- CONTRIBUTING.md = CONTRIBUTING.md
- NuGet.config = NuGet.config
- README.md = README.md
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}"
- ProjectSection(SolutionItems) = preProject
- build\Common.prod.props = build\Common.prod.props
- build\Common.test.props = build\Common.test.props
- build\debug.snk = build\debug.snk
- build\OpenTelemetry.prod.loose.ruleset = build\OpenTelemetry.prod.loose.ruleset
- build\OpenTelemetry.prod.ruleset = build\OpenTelemetry.prod.ruleset
- build\OpenTelemetry.test.ruleset = build\OpenTelemetry.test.ruleset
- build\stylecop.json = build\stylecop.json
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Zipkin", "src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj", "{7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vsts", ".vsts", "{61188153-47FB-4567-AC9B-79B2435853EB}"
- ProjectSection(SolutionItems) = preProject
- .vsts\ci-build.yml = .vsts\ci-build.yml
- .vsts\ci-myget-update.yml = .vsts\ci-myget-update.yml
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.ApplicationInsights", "src\OpenTelemetry.Exporter.ApplicationInsights\OpenTelemetry.Exporter.ApplicationInsights.csproj", "{4493F5D9-874E-4FBF-B2F3-37890BD910E0}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Stackdriver", "src\OpenTelemetry.Exporter.Stackdriver\OpenTelemetry.Exporter.Stackdriver.csproj", "{DE1B4783-C01F-4672-A6EB-695F1717105B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Abstractions", "src\OpenTelemetry.Abstractions\OpenTelemetry.Abstractions.csproj", "{99F8A331-05E9-45A5-89BA-4C54E825E5B2}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.Dependencies", "src\OpenTelemetry.Collector.Dependencies\OpenTelemetry.Collector.Dependencies.csproj", "{D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.Dependencies.Tests", "test\OpenTelemetry.Collector.Dependencies.Tests\OpenTelemetry.Collector.Dependencies.Tests.csproj", "{56E2647A-B814-4BAC-B854-BEA0051B5F2E}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.AspNetCore", "src\OpenTelemetry.Collector.AspNetCore\OpenTelemetry.Collector.AspNetCore.csproj", "{752D2182-A351-41D8-99EE-DD363D7D5B43}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.AspNetCore.Tests", "test\OpenTelemetry.Collector.AspNetCore.Tests\OpenTelemetry.Collector.AspNetCore.Tests.csproj", "{2A47F6A8-63E5-4237-8046-94CAF321E797}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testdata", "testdata", "{77C7929A-2EED-4AA6-8705-B5C443C8AA0F}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.2.0", "test\TestApp.AspNetCore.2.0\TestApp.AspNetCore.2.0.csproj", "{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Ocagent", "src\OpenTelemetry.Exporter.Ocagent\OpenTelemetry.Exporter.Ocagent.csproj", "{56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Stackdriver.Tests", "test\OpenTelemetry.Exporter.Stackdriver.Tests\OpenTelemetry.Exporter.Stackdriver.Tests.csproj", "{6875032B-DFDC-4CDE-A283-37CA7F99926A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.ApplicationInsights.Tests", "test\OpenTelemetry.Exporter.ApplicationInsights.Tests\OpenTelemetry.Exporter.ApplicationInsights.Tests.csproj", "{1FA1F509-7722-48E3-9A35-16CBB6774957}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.StackExchangeRedis", "src\OpenTelemetry.Collector.StackExchangeRedis\OpenTelemetry.Collector.StackExchangeRedis.csproj", "{6B681D72-D68A-44CC-8C75-53B9A322E6EC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.StackExchangeRedis.Tests", "test\OpenTelemetry.Collector.StackExchangeRedis.Tests\OpenTelemetry.Collector.StackExchangeRedis.Tests.csproj", "{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E359BB2B-9AEC-497D-B321-7DF2450C3B8E}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exporters", "samples\Exporters\Exporters.csproj", "{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.Jaeger", "src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj", "{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{328E9300-9DA5-11E9-B531-E75873C46FCA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thrift", "lib\Thrift\Thrift.csproj", "{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Release|Any CPU.Build.0 = Release|Any CPU
- {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Release|Any CPU.Build.0 = Release|Any CPU
- {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.Build.0 = Release|Any CPU
- {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.Build.0 = Release|Any CPU
- {DE1B4783-C01F-4672-A6EB-695F1717105B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DE1B4783-C01F-4672-A6EB-695F1717105B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DE1B4783-C01F-4672-A6EB-695F1717105B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DE1B4783-C01F-4672-A6EB-695F1717105B}.Release|Any CPU.Build.0 = Release|Any CPU
- {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Release|Any CPU.Build.0 = Release|Any CPU
- {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Release|Any CPU.Build.0 = Release|Any CPU
- {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Release|Any CPU.Build.0 = Release|Any CPU
- {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Release|Any CPU.Build.0 = Release|Any CPU
- {752D2182-A351-41D8-99EE-DD363D7D5B43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {752D2182-A351-41D8-99EE-DD363D7D5B43}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {752D2182-A351-41D8-99EE-DD363D7D5B43}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {752D2182-A351-41D8-99EE-DD363D7D5B43}.Release|Any CPU.Build.0 = Release|Any CPU
- {2A47F6A8-63E5-4237-8046-94CAF321E797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2A47F6A8-63E5-4237-8046-94CAF321E797}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.Build.0 = Release|Any CPU
- {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.Build.0 = Release|Any CPU
- {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Release|Any CPU.Build.0 = Release|Any CPU
- {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Release|Any CPU.Build.0 = Release|Any CPU
- {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1FA1F509-7722-48E3-9A35-16CBB6774957}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1FA1F509-7722-48E3-9A35-16CBB6774957}.Release|Any CPU.Build.0 = Release|Any CPU
- {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.Build.0 = Release|Any CPU
- {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.Build.0 = Release|Any CPU
- {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.Build.0 = Release|Any CPU
- {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.Build.0 = Release|Any CPU
- {2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {7CB2F02E-03FA-4FFF-89A5-C51F107623FD} = {61188153-47FB-4567-AC9B-79B2435853EB}
- {F2F81E76-6A0E-466B-B673-EBBF1A9ED075} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
- {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E}
- {2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF} = {328E9300-9DA5-11E9-B531-E75873C46FCA}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28407.52
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry", "src\OpenTelemetry\OpenTelemetry.csproj", "{AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests", "test\OpenTelemetry.Tests\OpenTelemetry.Tests.csproj", "{CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B7408D66-487A-40E1-BDB7-BC17BD28F721}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ CHANGELOG.md = CHANGELOG.md
+ CONTRIBUTING.md = CONTRIBUTING.md
+ NuGet.config = NuGet.config
+ README.md = README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}"
+ ProjectSection(SolutionItems) = preProject
+ build\Common.prod.props = build\Common.prod.props
+ build\Common.test.props = build\Common.test.props
+ build\debug.snk = build\debug.snk
+ build\OpenTelemetry.prod.loose.ruleset = build\OpenTelemetry.prod.loose.ruleset
+ build\OpenTelemetry.prod.ruleset = build\OpenTelemetry.prod.ruleset
+ build\OpenTelemetry.test.ruleset = build\OpenTelemetry.test.ruleset
+ build\stylecop.json = build\stylecop.json
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Zipkin", "src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj", "{7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vsts", ".vsts", "{61188153-47FB-4567-AC9B-79B2435853EB}"
+ ProjectSection(SolutionItems) = preProject
+ .vsts\ci-build.yml = .vsts\ci-build.yml
+ .vsts\ci-myget-update.yml = .vsts\ci-myget-update.yml
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.ApplicationInsights", "src\OpenTelemetry.Exporter.ApplicationInsights\OpenTelemetry.Exporter.ApplicationInsights.csproj", "{4493F5D9-874E-4FBF-B2F3-37890BD910E0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Stackdriver", "src\OpenTelemetry.Exporter.Stackdriver\OpenTelemetry.Exporter.Stackdriver.csproj", "{DE1B4783-C01F-4672-A6EB-695F1717105B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Abstractions", "src\OpenTelemetry.Abstractions\OpenTelemetry.Abstractions.csproj", "{99F8A331-05E9-45A5-89BA-4C54E825E5B2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Prometheus", "src\OpenTelemetry.Exporter.Prometheus\OpenTelemetry.Exporter.Prometheus.csproj", "{AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.Dependencies", "src\OpenTelemetry.Collector.Dependencies\OpenTelemetry.Collector.Dependencies.csproj", "{D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.Dependencies.Tests", "test\OpenTelemetry.Collector.Dependencies.Tests\OpenTelemetry.Collector.Dependencies.Tests.csproj", "{56E2647A-B814-4BAC-B854-BEA0051B5F2E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.AspNetCore", "src\OpenTelemetry.Collector.AspNetCore\OpenTelemetry.Collector.AspNetCore.csproj", "{752D2182-A351-41D8-99EE-DD363D7D5B43}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.AspNetCore.Tests", "test\OpenTelemetry.Collector.AspNetCore.Tests\OpenTelemetry.Collector.AspNetCore.Tests.csproj", "{2A47F6A8-63E5-4237-8046-94CAF321E797}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testdata", "testdata", "{77C7929A-2EED-4AA6-8705-B5C443C8AA0F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.2.0", "test\TestApp.AspNetCore.2.0\TestApp.AspNetCore.2.0.csproj", "{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Ocagent", "src\OpenTelemetry.Exporter.Ocagent\OpenTelemetry.Exporter.Ocagent.csproj", "{56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Stackdriver.Tests", "test\OpenTelemetry.Exporter.Stackdriver.Tests\OpenTelemetry.Exporter.Stackdriver.Tests.csproj", "{6875032B-DFDC-4CDE-A283-37CA7F99926A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.ApplicationInsights.Tests", "test\OpenTelemetry.Exporter.ApplicationInsights.Tests\OpenTelemetry.Exporter.ApplicationInsights.Tests.csproj", "{1FA1F509-7722-48E3-9A35-16CBB6774957}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.StackExchangeRedis", "src\OpenTelemetry.Collector.StackExchangeRedis\OpenTelemetry.Collector.StackExchangeRedis.csproj", "{6B681D72-D68A-44CC-8C75-53B9A322E6EC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Collector.StackExchangeRedis.Tests", "test\OpenTelemetry.Collector.StackExchangeRedis.Tests\OpenTelemetry.Collector.StackExchangeRedis.Tests.csproj", "{CA98AF29-0852-4ADD-A66B-7E96266EE7B7}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E359BB2B-9AEC-497D-B321-7DF2450C3B8E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exporters", "samples\Exporters\Exporters.csproj", "{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Jaeger", "src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj", "{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AE3E3DF5-4083-4C6E-A840-8271B0ACDE7E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CC62B3C1-5875-4986-A7F6-C4B26E42B0A1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4493F5D9-874E-4FBF-B2F3-37890BD910E0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DE1B4783-C01F-4672-A6EB-695F1717105B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DE1B4783-C01F-4672-A6EB-695F1717105B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DE1B4783-C01F-4672-A6EB-695F1717105B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DE1B4783-C01F-4672-A6EB-695F1717105B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {99F8A331-05E9-45A5-89BA-4C54E825E5B2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD9B2B54-EC9C-448E-BD3C-EDCC3F7AD022}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D3FFBC59-2486-4F8F-BFF1-FA95C84929E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {56E2647A-B814-4BAC-B854-BEA0051B5F2E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {752D2182-A351-41D8-99EE-DD363D7D5B43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {752D2182-A351-41D8-99EE-DD363D7D5B43}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {752D2182-A351-41D8-99EE-DD363D7D5B43}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {752D2182-A351-41D8-99EE-DD363D7D5B43}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A47F6A8-63E5-4237-8046-94CAF321E797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A47F6A8-63E5-4237-8046-94CAF321E797}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.Build.0 = Release|Any CPU
+ {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {56B0ED25-8A14-4AA2-B59D-FAAFCBACDD4A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6875032B-DFDC-4CDE-A283-37CA7F99926A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1FA1F509-7722-48E3-9A35-16CBB6774957}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1FA1F509-7722-48E3-9A35-16CBB6774957}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1FA1F509-7722-48E3-9A35-16CBB6774957}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6B681D72-D68A-44CC-8C75-53B9A322E6EC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CA98AF29-0852-4ADD-A66B-7E96266EE7B7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {7CB2F02E-03FA-4FFF-89A5-C51F107623FD} = {61188153-47FB-4567-AC9B-79B2435853EB}
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
+ {6EC9DEC9-086F-4F29-BF3F-5FC7253829D5} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
+ EndGlobalSection
+EndGlobal
diff --git a/lib/Directory.Build.props b/lib/Directory.Build.props
deleted file mode 100644
index e3fa46613..000000000
--- a/lib/Directory.Build.props
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
- True
-
-
\ No newline at end of file
diff --git a/lib/Directory.Build.targets b/lib/Directory.Build.targets
deleted file mode 100644
index 347a97078..000000000
--- a/lib/Directory.Build.targets
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
-
\ No newline at end of file
diff --git a/lib/Thrift/Collections/TCollections.cs b/lib/Thrift/Collections/TCollections.cs
deleted file mode 100644
index 147bfc7d3..000000000
--- a/lib/Thrift/Collections/TCollections.cs
+++ /dev/null
@@ -1,101 +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.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/Thrift/Collections/THashSet.cs b/lib/Thrift/Collections/THashSet.cs
deleted file mode 100644
index 011f0a0d6..000000000
--- a/lib/Thrift/Collections/THashSet.cs
+++ /dev/null
@@ -1,67 +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.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/Thrift/ITAsyncProcessor.cs b/lib/Thrift/ITAsyncProcessor.cs
deleted file mode 100644
index db8e40aef..000000000
--- a/lib/Thrift/ITAsyncProcessor.cs
+++ /dev/null
@@ -1,29 +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.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/Thrift/ITProcessorFactory.cs b/lib/Thrift/ITProcessorFactory.cs
deleted file mode 100644
index 5133e5c48..000000000
--- a/lib/Thrift/ITProcessorFactory.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.
-
-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/Thrift/Protocols/Entities/TField.cs b/lib/Thrift/Protocols/Entities/TField.cs
deleted file mode 100644
index d311535e7..000000000
--- a/lib/Thrift/Protocols/Entities/TField.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.
-
-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/Thrift/Protocols/Entities/TList.cs b/lib/Thrift/Protocols/Entities/TList.cs
deleted file mode 100644
index ce232207c..000000000
--- a/lib/Thrift/Protocols/Entities/TList.cs
+++ /dev/null
@@ -1,33 +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.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/Thrift/Protocols/Entities/TMap.cs b/lib/Thrift/Protocols/Entities/TMap.cs
deleted file mode 100644
index 9195593db..000000000
--- a/lib/Thrift/Protocols/Entities/TMap.cs
+++ /dev/null
@@ -1,36 +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.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/Thrift/Protocols/Entities/TMessage.cs b/lib/Thrift/Protocols/Entities/TMessage.cs
deleted file mode 100644
index 17f49298f..000000000
--- a/lib/Thrift/Protocols/Entities/TMessage.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.
-
-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/Thrift/Protocols/Entities/TMessageType.cs b/lib/Thrift/Protocols/Entities/TMessageType.cs
deleted file mode 100644
index d7b9a2275..000000000
--- a/lib/Thrift/Protocols/Entities/TMessageType.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 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/Thrift/Protocols/Entities/TSet.cs b/lib/Thrift/Protocols/Entities/TSet.cs
deleted file mode 100644
index a583b54a6..000000000
--- a/lib/Thrift/Protocols/Entities/TSet.cs
+++ /dev/null
@@ -1,38 +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.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/Thrift/Protocols/Entities/TStruct.cs b/lib/Thrift/Protocols/Entities/TStruct.cs
deleted file mode 100644
index a28dcc3d0..000000000
--- a/lib/Thrift/Protocols/Entities/TStruct.cs
+++ /dev/null
@@ -1,30 +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.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/Thrift/Protocols/Entities/TType.cs b/lib/Thrift/Protocols/Entities/TType.cs
deleted file mode 100644
index ebe781c95..000000000
--- a/lib/Thrift/Protocols/Entities/TType.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.
-
-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/Thrift/Protocols/ITProtocolFactory.cs b/lib/Thrift/Protocols/ITProtocolFactory.cs
deleted file mode 100644
index ecc5cc494..000000000
--- a/lib/Thrift/Protocols/ITProtocolFactory.cs
+++ /dev/null
@@ -1,27 +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 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/Thrift/Protocols/TAbstractBase.cs b/lib/Thrift/Protocols/TAbstractBase.cs
deleted file mode 100644
index 4e18681bf..000000000
--- a/lib/Thrift/Protocols/TAbstractBase.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.
-
-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/Thrift/Protocols/TBase.cs b/lib/Thrift/Protocols/TBase.cs
deleted file mode 100644
index 014e1aee8..000000000
--- a/lib/Thrift/Protocols/TBase.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.
-
-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/Thrift/Protocols/TBinaryProtocol.cs b/lib/Thrift/Protocols/TBinaryProtocol.cs
deleted file mode 100644
index deec85c42..000000000
--- a/lib/Thrift/Protocols/TBinaryProtocol.cs
+++ /dev/null
@@ -1,613 +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.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 @struct, 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[] bytes, CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return;
- }
-
- await WriteI32Async(bytes.Length, cancellationToken);
- await Trans.WriteAsync(bytes, 0, bytes.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/Thrift/Protocols/TCompactProtocol.cs b/lib/Thrift/Protocols/TCompactProtocol.cs
deleted file mode 100644
index cecdf03cc..000000000
--- a/lib/Thrift/Protocols/TCompactProtocol.cs
+++ /dev/null
@@ -1,922 +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.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 @struct, 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[] bytes, CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return;
- }
-
- 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 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/Thrift/Protocols/TJSONProtocol.cs b/lib/Thrift/Protocols/TJSONProtocol.cs
deleted file mode 100644
index 6d33f029e..000000000
--- a/lib/Thrift/Protocols/TJSONProtocol.cs
+++ /dev/null
@@ -1,981 +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.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-using Thrift.Protocols.Utilities;
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
- ///
- /// 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;
-
- // 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)
- {
- Context = new JSONBaseContext(this);
- Reader = new LookaheadReader(this);
- }
-
- ///
- /// 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[] bytes, CancellationToken cancellationToken)
- {
- var ch = await Reader.ReadAsync(cancellationToken);
- if (ch != bytes[0])
- {
- throw new TProtocolException(TProtocolException.INVALID_DATA, $"Unexpected character: {(char) ch}");
- }
- }
-
- ///
- /// Write the bytes in array buf as a JSON characters, escaping as needed
- ///
- private async Task WriteJsonStringAsync(byte[] bytes, CancellationToken cancellationToken)
- {
- await Context.WriteAsync(cancellationToken);
- await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-
- var len = bytes.Length;
- for (var i = 0; i < len; i++)
- {
- if ((bytes[i] & 0x00FF) >= 0x30)
- {
- if (bytes[i] == TJSONProtocolConstants.Backslash[0])
- {
- await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
- await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
- }
- else
- {
- await Trans.WriteAsync(bytes.ToArray(), i, 1, cancellationToken);
- }
- }
- else
- {
- _tempBuffer[0] = TJSONProtocolConstants.JsonCharTable[bytes[i]];
- if (_tempBuffer[0] == 1)
- {
- await Trans.WriteAsync(bytes, i, 1, cancellationToken);
- }
- else if (_tempBuffer[0] > 1)
- {
- await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
- await Trans.WriteAsync(_tempBuffer, 0, 1, cancellationToken);
- }
- else
- {
- await Trans.WriteAsync(TJSONProtocolConstants.EscSequences, cancellationToken);
- _tempBuffer[0] = TJSONProtocolHelper.ToHexChar((byte) (bytes[i] >> 4));
- _tempBuffer[1] = TJSONProtocolHelper.ToHexChar(bytes[i]);
- await Trans.WriteAsync(_tempBuffer, 0, 2, cancellationToken);
- }
- }
- }
- await Trans.WriteAsync(TJSONProtocolConstants.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(TJSONProtocolConstants.Quote, cancellationToken);
- }
-
- var bytes = Utf8Encoding.GetBytes(str);
- await Trans.WriteAsync(bytes, cancellationToken);
-
- if (escapeNum)
- {
- await Trans.WriteAsync(TJSONProtocolConstants.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(TJSONProtocolConstants.Quote, cancellationToken);
- }
-
- await Trans.WriteAsync(Utf8Encoding.GetBytes(str), cancellationToken);
-
- if (escapeNum)
- {
- await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
- }
- }
-
- ///
- /// Write out contents of byte array b as a JSON string with base-64 encoded
- /// data
- ///
- private async Task WriteJsonBase64Async(byte[] bytes, CancellationToken cancellationToken)
- {
- await Context.WriteAsync(cancellationToken);
- await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-
- var len = bytes.Length;
- var off = 0;
-
- while (len >= 3)
- {
- // Encode 3 bytes at a time
- TBase64Helper.Encode(bytes, off, 3, _tempBuffer, 0);
- await Trans.WriteAsync(_tempBuffer, 0, 4, cancellationToken);
- off += 3;
- len -= 3;
- }
-
- if (len > 0)
- {
- // Encode remainder
- TBase64Helper.Encode(bytes, off, len, _tempBuffer, 0);
- await Trans.WriteAsync(_tempBuffer, 0, len + 1, cancellationToken);
- }
-
- await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
- }
-
- private async Task WriteJsonObjectStartAsync(CancellationToken cancellationToken)
- {
- await Context.WriteAsync(cancellationToken);
- await Trans.WriteAsync(TJSONProtocolConstants.LeftBrace, cancellationToken);
- PushContext(new JSONPairContext(this));
- }
-
- private async Task WriteJsonObjectEndAsync(CancellationToken cancellationToken)
- {
- PopContext();
- await Trans.WriteAsync(TJSONProtocolConstants.RightBrace, cancellationToken);
- }
-
- private async Task WriteJsonArrayStartAsync(CancellationToken cancellationToken)
- {
- await Context.WriteAsync(cancellationToken);
- await Trans.WriteAsync(TJSONProtocolConstants.LeftBracket, cancellationToken);
- PushContext(new JSONListContext(this));
- }
-
- private async Task WriteJsonArrayEndAsync(CancellationToken cancellationToken)
- {
- PopContext();
- await Trans.WriteAsync(TJSONProtocolConstants.RightBracket, 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 @struct, 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(TJSONProtocolHelper.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(TJSONProtocolHelper.GetTypeNameForTypeId(map.KeyType), cancellationToken);
- await WriteJsonStringAsync(TJSONProtocolHelper.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(TJSONProtocolHelper.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(TJSONProtocolHelper.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[] bytes, CancellationToken cancellationToken)
- {
- await WriteJsonBase64Async(bytes, 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(TJSONProtocolConstants.Quote, cancellationToken);
-
- while (true)
- {
- var ch = await Reader.ReadAsync(cancellationToken);
- if (ch == TJSONProtocolConstants.Quote[0])
- {
- break;
- }
-
- // escaped?
- if (ch != TJSONProtocolConstants.EscSequences[0])
- {
- await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken);
- continue;
- }
-
- // distinguish between \uXXXX and \?
- ch = await Reader.ReadAsync(cancellationToken);
- if (ch != TJSONProtocolConstants.EscSequences[1]) // control chars like \n
- {
- var off = Array.IndexOf(TJSONProtocolConstants.EscapeChars, (char) ch);
- if (off == -1)
- {
- throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected control char");
- }
- ch = TJSONProtocolConstants.EscapeCharValues[off];
- await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken);
- continue;
- }
-
- // it's \uXXXX
- await Trans.ReadAllAsync(_tempBuffer, 0, 4, cancellationToken);
-
- var wch = (short) ((TJSONProtocolHelper.ToHexVal(_tempBuffer[0]) << 12) +
- (TJSONProtocolHelper.ToHexVal(_tempBuffer[1]) << 8) +
- (TJSONProtocolHelper.ToHexVal(_tempBuffer[2]) << 4) +
- TJSONProtocolHelper.ToHexVal(_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();
- }
- }
-
- ///
- /// 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)
- {
- //TODO: workaround for primitive types with TJsonProtocol, think - how to rewrite into more easy form without exceptions
- try
- {
- var ch = await Reader.PeekAsync(cancellationToken);
- if (!TJSONProtocolHelper.IsJsonNumeric(ch))
- {
- break;
- }
- var c = (char)await Reader.ReadAsync(cancellationToken);
- strbld.Append(c);
- }
- catch (TTransportException)
- {
- break;
- }
- }
- 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(TJSONProtocolConstants.Quote, cancellationToken);
- }
-
- var str = await ReadJsonNumericCharsAsync(cancellationToken);
- if (Context.EscapeNumbers())
- {
- await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.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) == TJSONProtocolConstants.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(TJSONProtocolConstants.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
- TBase64Helper.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
- TBase64Helper.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(TJSONProtocolConstants.LeftBrace, cancellationToken);
- PushContext(new JSONPairContext(this));
- }
-
- private async Task ReadJsonObjectEndAsync(CancellationToken cancellationToken)
- {
- await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.RightBrace, cancellationToken);
- PopContext();
- }
-
- private async Task ReadJsonArrayStartAsync(CancellationToken cancellationToken)
- {
- await Context.ReadAsync(cancellationToken);
- await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.LeftBracket, cancellationToken);
- PushContext(new JSONListContext(this));
- }
-
- private async Task ReadJsonArrayEndAsync(CancellationToken cancellationToken)
- {
- await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.RightBracket, 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 == TJSONProtocolConstants.RightBrace[0])
- {
- field.Type = TType.Stop;
- }
- else
- {
- field.ID = (short) await ReadJsonIntegerAsync(cancellationToken);
- await ReadJsonObjectStartAsync(cancellationToken);
- field.Type = TJSONProtocolHelper.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 = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
- map.ValueType = TJSONProtocolHelper.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 = TJSONProtocolHelper.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 = TJSONProtocolHelper.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(TJSONProtocolConstants.Comma, cancellationToken);
- }
- }
-
- public override async Task ReadAsync(CancellationToken cancellationToken)
- {
- if (_first)
- {
- _first = false;
- }
- else
- {
- await Proto.ReadJsonSyntaxCharAsync(TJSONProtocolConstants.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).
- ///
- // ReSharper disable once InconsistentNaming
- 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 ? TJSONProtocolConstants.Colon : TJSONProtocolConstants.Comma, cancellationToken);
- _colon = !_colon;
- }
- }
-
- public override async Task ReadAsync(CancellationToken cancellationToken)
- {
- if (_first)
- {
- _first = false;
- _colon = true;
- }
- else
- {
- await Proto.ReadJsonSyntaxCharAsync(_colon ? TJSONProtocolConstants.Colon : TJSONProtocolConstants.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
- {
- // find more easy way to avoid exception on reading primitive types
- 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)
- {
- // find more easy way to avoid exception on reading primitive types
- await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken);
- }
- _hasData = true;
- return _data[0];
- }
- }
- }
-}
diff --git a/lib/Thrift/Protocols/TMultiplexedProtocol.cs b/lib/Thrift/Protocols/TMultiplexedProtocol.cs
deleted file mode 100644
index 367e4e644..000000000
--- a/lib/Thrift/Protocols/TMultiplexedProtocol.cs
+++ /dev/null
@@ -1,91 +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.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;
- }
-
- 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;
- }
- }
- }
-}
diff --git a/lib/Thrift/Protocols/TProtocol.cs b/lib/Thrift/Protocols/TProtocol.cs
deleted file mode 100644
index 91e009d63..000000000
--- a/lib/Thrift/Protocols/TProtocol.cs
+++ /dev/null
@@ -1,376 +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.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
- {
- public 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;
-
- 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 @struct)
- {
- await WriteStructBeginAsync(@struct, CancellationToken.None);
- }
-
- public abstract Task WriteStructBeginAsync(TStruct @struct, 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[] bytes)
- {
- await WriteBinaryAsync(bytes, CancellationToken.None);
- }
-
- public abstract Task WriteBinaryAsync(byte[] bytes, 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/Thrift/Protocols/TProtocolDecorator.cs b/lib/Thrift/Protocols/TProtocolDecorator.cs
deleted file mode 100644
index 3222754a8..000000000
--- a/lib/Thrift/Protocols/TProtocolDecorator.cs
+++ /dev/null
@@ -1,247 +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.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)
- {
- _wrappedProtocol = protocol ?? throw new ArgumentNullException(nameof(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 @struct, CancellationToken cancellationToken)
- {
- await _wrappedProtocol.WriteStructBeginAsync(@struct, 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[] bytes, CancellationToken cancellationToken)
- {
- await _wrappedProtocol.WriteBinaryAsync(bytes, 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/Thrift/Protocols/TProtocolException.cs b/lib/Thrift/Protocols/TProtocolException.cs
deleted file mode 100644
index 8c67c3bfd..000000000
--- a/lib/Thrift/Protocols/TProtocolException.cs
+++ /dev/null
@@ -1,59 +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.
-
-// ReSharper disable InconsistentNaming
-namespace Thrift.Protocols
-{
- public class TProtocolException : TException
- {
- // do not rename public constants - 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/Thrift/Protocols/Utilities/TBase64Helper.cs b/lib/Thrift/Protocols/Utilities/TBase64Helper.cs
deleted file mode 100644
index 7eff5e181..000000000
--- a/lib/Thrift/Protocols/Utilities/TBase64Helper.cs
+++ /dev/null
@@ -1,101 +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;
-
-namespace Thrift.Protocols.Utilities
-{
- // ReSharper disable once InconsistentNaming
- internal static class TBase64Helper
- {
- //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/Thrift/Protocols/Utilities/TBase64Utils.cs b/lib/Thrift/Protocols/Utilities/TBase64Utils.cs
deleted file mode 100644
index 15fd45cbe..000000000
--- a/lib/Thrift/Protocols/Utilities/TBase64Utils.cs
+++ /dev/null
@@ -1,101 +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;
-
-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/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs b/lib/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs
deleted file mode 100644
index 93eff7855..000000000
--- a/lib/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs
+++ /dev/null
@@ -1,61 +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.Protocols.Utilities
-{
- // ReSharper disable once InconsistentNaming
- public static class TJSONProtocolConstants
- {
- //TODO Check for performance for reusing ImmutableArray from System.Collections.Immutable (https://blogs.msdn.microsoft.com/dotnet/2013/06/24/please-welcome-immutablearrayt/)
- // can be possible to get better performance and also better GC
-
- public static readonly byte[] Comma = {(byte) ','};
- public static readonly byte[] Colon = {(byte) ':'};
- public static readonly byte[] LeftBrace = {(byte) '{'};
- public static readonly byte[] RightBrace = {(byte) '}'};
- public static readonly byte[] LeftBracket = {(byte) '['};
- public static readonly byte[] RightBracket = {(byte) ']'};
- public static readonly byte[] Quote = {(byte) '"'};
- public static readonly byte[] Backslash = {(byte) '\\'};
-
- public static 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
- };
-
- public static readonly char[] EscapeChars = "\"\\/bfnrt".ToCharArray();
- public static readonly byte[] EscapeCharValues = {(byte) '"', (byte) '\\', (byte) '/', (byte) '\b', (byte) '\f', (byte) '\n', (byte) '\r', (byte) '\t'};
- public static readonly byte[] EscSequences = {(byte) '\\', (byte) 'u', (byte) '0', (byte) '0'};
-
- public static class TypeNames
- {
- public static readonly byte[] NameBool = { (byte)'t', (byte)'f' };
- public static readonly byte[] NameByte = { (byte)'i', (byte)'8' };
- public static readonly byte[] NameI16 = { (byte)'i', (byte)'1', (byte)'6' };
- public static readonly byte[] NameI32 = { (byte)'i', (byte)'3', (byte)'2' };
- public static readonly byte[] NameI64 = { (byte)'i', (byte)'6', (byte)'4' };
- public static readonly byte[] NameDouble = { (byte)'d', (byte)'b', (byte)'l' };
- public static readonly byte[] NameStruct = { (byte)'r', (byte)'e', (byte)'c' };
- public static readonly byte[] NameString = { (byte)'s', (byte)'t', (byte)'r' };
- public static readonly byte[] NameMap = { (byte)'m', (byte)'a', (byte)'p' };
- public static readonly byte[] NameList = { (byte)'l', (byte)'s', (byte)'t' };
- public static readonly byte[] NameSet = { (byte)'s', (byte)'e', (byte)'t' };
- }
- }
-}
\ No newline at end of file
diff --git a/lib/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs b/lib/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs
deleted file mode 100644
index adc26a9af..000000000
--- a/lib/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs
+++ /dev/null
@@ -1,176 +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 Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols.Utilities
-{
- // ReSharper disable once InconsistentNaming
- public static class TJSONProtocolHelper
- {
- public static byte[] GetTypeNameForTypeId(TType typeId)
- {
- switch (typeId)
- {
- case TType.Bool:
- return TJSONProtocolConstants.TypeNames.NameBool;
- case TType.Byte:
- return TJSONProtocolConstants.TypeNames.NameByte;
- case TType.I16:
- return TJSONProtocolConstants.TypeNames.NameI16;
- case TType.I32:
- return TJSONProtocolConstants.TypeNames.NameI32;
- case TType.I64:
- return TJSONProtocolConstants.TypeNames.NameI64;
- case TType.Double:
- return TJSONProtocolConstants.TypeNames.NameDouble;
- case TType.String:
- return TJSONProtocolConstants.TypeNames.NameString;
- case TType.Struct:
- return TJSONProtocolConstants.TypeNames.NameStruct;
- case TType.Map:
- return TJSONProtocolConstants.TypeNames.NameMap;
- case TType.Set:
- return TJSONProtocolConstants.TypeNames.NameSet;
- case TType.List:
- return TJSONProtocolConstants.TypeNames.NameList;
- default:
- throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized exType");
- }
- }
-
- public 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;
- }
-
- ///
- /// Return true if the given byte could be a valid part of a JSON number.
- ///
- public 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;
- default:
- return false;
- }
- }
-
- ///
- /// Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its
- /// corresponding hex value
- ///
- public static byte ToHexVal(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
- ///
- public static byte ToHexChar(byte val)
- {
- val &= 0x0F;
- if (val < 10)
- {
- return (byte)((char)val + '0');
- }
- val -= 10;
- return (byte)((char)val + 'a');
- }
- }
-}
\ No newline at end of file
diff --git a/lib/Thrift/Protocols/Utilities/TProtocolUtil.cs b/lib/Thrift/Protocols/Utilities/TProtocolUtil.cs
deleted file mode 100644
index 50b038566..000000000
--- a/lib/Thrift/Protocols/Utilities/TProtocolUtil.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.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols.Utilities
-{
- // ReSharper disable once InconsistentNaming
- public static class TProtocolUtil
- {
- public static async Task SkipAsync(TProtocol protocol, TType type, CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- await Task.FromCanceled(cancellationToken);
- }
-
- protocol.IncrementRecursionDepth();
- try
- {
- switch (type)
- {
- case TType.Bool:
- await protocol.ReadBoolAsync(cancellationToken);
- break;
- case TType.Byte:
- await protocol.ReadByteAsync(cancellationToken);
- break;
- case TType.I16:
- await protocol.ReadI16Async(cancellationToken);
- break;
- case TType.I32:
- await protocol.ReadI32Async(cancellationToken);
- break;
- case TType.I64:
- await protocol.ReadI64Async(cancellationToken);
- break;
- case TType.Double:
- await protocol.ReadDoubleAsync(cancellationToken);
- break;
- case TType.String:
- // Don't try to decode the string, just skip it.
- await protocol.ReadBinaryAsync(cancellationToken);
- break;
- case TType.Struct:
- await protocol.ReadStructBeginAsync(cancellationToken);
- while (true)
- {
- var field = await protocol.ReadFieldBeginAsync(cancellationToken);
- if (field.Type == TType.Stop)
- {
- break;
- }
- await SkipAsync(protocol, field.Type, cancellationToken);
- await protocol.ReadFieldEndAsync(cancellationToken);
- }
- await protocol.ReadStructEndAsync(cancellationToken);
- break;
- case TType.Map:
- var map = await protocol.ReadMapBeginAsync(cancellationToken);
- for (var i = 0; i < map.Count; i++)
- {
- await SkipAsync(protocol, map.KeyType, cancellationToken);
- await SkipAsync(protocol, map.ValueType, cancellationToken);
- }
- await protocol.ReadMapEndAsync(cancellationToken);
- break;
- case TType.Set:
- var set = await protocol.ReadSetBeginAsync(cancellationToken);
- for (var i = 0; i < set.Count; i++)
- {
- await SkipAsync(protocol, set.ElementType, cancellationToken);
- }
- await protocol.ReadSetEndAsync(cancellationToken);
- break;
- case TType.List:
- var list = await protocol.ReadListBeginAsync(cancellationToken);
- for (var i = 0; i < list.Count; i++)
- {
- await SkipAsync(protocol, list.ElementType, cancellationToken);
- }
- await protocol.ReadListEndAsync(cancellationToken);
- break;
- default:
- throw new TProtocolException(TProtocolException.INVALID_DATA, "Unknown data type " + type.ToString("d"));
- }
- }
- finally
- {
- protocol.DecrementRecursionDepth();
- }
- }
- }
-}
diff --git a/lib/Thrift/README.md b/lib/Thrift/README.md
deleted file mode 100644
index 936d553f2..000000000
--- a/lib/Thrift/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Thrift Protocol .Net Implementation
-
-This is the .net implementation of the Apache Thrift protocol. This code was directly forked from the [Jaeger Tracing C# Client Repository](https://github.com/jaegertracing/jaeger-client-csharp).
-
-Path: src/Thrift
-
-commitID: 0794ea71cb6e58f7bf0f0ef2c0c8ceceb1d8b6d9
diff --git a/lib/Thrift/Server/TBaseServer.cs b/lib/Thrift/Server/TBaseServer.cs
deleted file mode 100644
index 87c183592..000000000
--- a/lib/Thrift/Server/TBaseServer.cs
+++ /dev/null
@@ -1,75 +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.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-using Thrift.Transports;
-
-namespace Thrift.Server
-{
- // ReSharper disable once InconsistentNaming
- public abstract class TBaseServer
- {
- 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)
- {
- ItProcessorFactory = itProcessorFactory ?? throw new ArgumentNullException(nameof(itProcessorFactory));
- ServerTransport = serverTransport;
- InputTransportFactory = inputTransportFactory ?? throw new ArgumentNullException(nameof(inputTransportFactory));
- OutputTransportFactory = outputTransportFactory ?? throw new ArgumentNullException(nameof(outputTransportFactory));
- InputProtocolFactory = inputProtocolFactory ?? throw new ArgumentNullException(nameof(inputProtocolFactory));
- OutputProtocolFactory = outputProtocolFactory ?? throw new ArgumentNullException(nameof(outputProtocolFactory));
- }
-
- 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/Thrift/Server/TServerEventHandler.cs b/lib/Thrift/Server/TServerEventHandler.cs
deleted file mode 100644
index 733bb4bef..000000000
--- a/lib/Thrift/Server/TServerEventHandler.cs
+++ /dev/null
@@ -1,54 +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.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