├── courgette.log ├── docker-compose.override.yml ├── docs ├── assets │ ├── 1.png │ ├── 2.png │ └── 3.png ├── time_profile_zh.pdf ├── Apache IoTDB C#客户端介绍 (6).pdf ├── bytebuffer_zh.md ├── C#原生接口.md ├── session_pool_zh.md └── API.md ├── .gitmodules ├── src ├── Apache.IoTDB.Data │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── IoTDBResult.cs │ ├── Apache.IoTDB.Data.csproj │ ├── IoTDBFactory.cs │ ├── IoTDBException.cs │ ├── DataReaderExtensions.cs │ └── IoTDBTransaction.cs └── Apache.IoTDB │ ├── Rpc │ └── Generated │ │ ├── TSConnectionType.cs │ │ ├── TConsensusGroupType.cs │ │ ├── TSProtocolVersion.cs │ │ ├── TRegionMigrateFailedType.cs │ │ ├── common.Extensions.cs │ │ ├── TSeriesPartitionSlot.cs │ │ ├── TSCloseSessionReq.cs │ │ ├── TTimePartitionSlot.cs │ │ ├── TConsensusGroupId.cs │ │ ├── TEndPoint.cs │ │ ├── TNodeResource.cs │ │ ├── TSCancelOperationReq.cs │ │ ├── TSGetOperationStatusReq.cs │ │ ├── TSConnectionInfoResp.cs │ │ ├── TSchemaNode.cs │ │ ├── TSSetTimeZoneReq.cs │ │ ├── TSyncTransportMetaInfo.cs │ │ ├── TFile.cs │ │ ├── TSDropSchemaTemplateReq.cs │ │ ├── TSGetTimeZoneResp.cs │ │ ├── TDataNodeConfiguration.cs │ │ ├── TSExecuteBatchStatementReq.cs │ │ ├── TFilesResp.cs │ │ ├── TSetTTLReq.cs │ │ ├── TSPruneSchemaTemplateReq.cs │ │ ├── TRegionReplicaSet.cs │ │ └── TFlushReq.cs │ ├── Apache.IoTDB.csproj │ ├── Client.cs │ ├── Template │ ├── TemplateNode.cs │ ├── InternalNode.cs │ ├── MeasurementNode.cs │ └── Template.cs │ ├── Utils.cs │ ├── IoTDBConstants.cs │ ├── DataStructure │ ├── GetSubArray.cs │ ├── ArrayExtensions.cs │ ├── BitMap.cs │ └── ByteBuffer.cs │ └── ConcurrentClientQueue.cs ├── samples └── Apache.IoTDB.Samples │ ├── Properties │ └── launchSettings.json │ ├── Program.cs │ ├── Dockerfile │ ├── Apache.IoTDB.Samples.csproj │ └── SessionPoolTest.Template.cs ├── tests ├── Apache.IoTDB.Tests │ ├── Tests.cs │ └── Apache.IoTDB.Tests.csproj └── Apache.IoTDB.Integration.Tests │ ├── Tests.cs │ └── Apache.IoTDB.Integration.Tests.csproj ├── launchSettings.json ├── .dockerignore ├── docker-compose.dcproj ├── .github └── workflows │ ├── dotnet.yml │ └── e2e.yml ├── .gitignore ├── docker-compose.yml ├── README_ZH.md ├── README.md └── PUBLISH.md /courgette.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | -------------------------------------------------------------------------------- /docs/assets/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eedalong/Apache-IoTDB-Client-CSharp/HEAD/docs/assets/1.png -------------------------------------------------------------------------------- /docs/assets/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eedalong/Apache-IoTDB-Client-CSharp/HEAD/docs/assets/2.png -------------------------------------------------------------------------------- /docs/assets/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eedalong/Apache-IoTDB-Client-CSharp/HEAD/docs/assets/3.png -------------------------------------------------------------------------------- /docs/time_profile_zh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eedalong/Apache-IoTDB-Client-CSharp/HEAD/docs/time_profile_zh.pdf -------------------------------------------------------------------------------- /docs/Apache IoTDB C#客户端介绍 (6).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eedalong/Apache-IoTDB-Client-CSharp/HEAD/docs/Apache IoTDB C#客户端介绍 (6).pdf -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Apache-IoTDB-Client-CSharp-UserCase"] 2 | path = Apache-IoTDB-Client-CSharp-UserCase 3 | url = git@github.com:eedalong/Apache-IoTDB-Client-CSharp-UserCase.git 4 | -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | using System.Text; 5 | [assembly: InternalsVisibleTo("Apache.IoTDB.Tests")] 6 | -------------------------------------------------------------------------------- /samples/Apache.IoTDB.Samples/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Apache.IoTDB.Samples": { 4 | "commandName": "Project" 5 | }, 6 | "Docker": { 7 | "commandName": "Docker" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /tests/Apache.IoTDB.Tests/Tests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace Apache.IoTDB.Tests 4 | { 5 | public class Tests 6 | { 7 | [SetUp] 8 | public void Setup() 9 | { 10 | } 11 | 12 | [Test] 13 | public void Test1() 14 | { 15 | Assert.Pass(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /tests/Apache.IoTDB.Integration.Tests/Tests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace Apache.IoTDB.Integration.Tests 4 | { 5 | public class Tests 6 | { 7 | [SetUp] 8 | public void Setup() 9 | { 10 | } 11 | 12 | [Test] 13 | public void Test1() 14 | { 15 | Assert.Pass(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/IoTDBResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Apache.IoTDB.Data 6 | { 7 | public class IoTDBErrorResult 8 | { 9 | 10 | public int Code { get; set; } 11 | /// 12 | /// 13 | /// 14 | public string Error { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Docker Compose": { 4 | "commandName": "DockerCompose", 5 | "commandVersion": "1.0", 6 | "composeLaunchAction": "None", 7 | "composeLaunchServiceName": "apache.iotdb.samples", 8 | "serviceActions": { 9 | "apache.iotdb.samples": "StartDebugging", 10 | "iotdb": "StartWithoutDebugging" 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSConnectionType.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | #pragma warning disable IDE0079 // remove unnecessary pragmas 9 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 10 | 11 | public enum TSConnectionType 12 | { 13 | THRIFT_BASED = 0, 14 | MQTT_BASED = 1, 15 | INTERNAL = 2, 16 | } 17 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TConsensusGroupType.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | #pragma warning disable IDE0079 // remove unnecessary pragmas 9 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 10 | 11 | public enum TConsensusGroupType 12 | { 13 | ConfigNodeRegion = 0, 14 | DataRegion = 1, 15 | SchemaRegion = 2, 16 | } 17 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSProtocolVersion.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | #pragma warning disable IDE0079 // remove unnecessary pragmas 9 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 10 | 11 | public enum TSProtocolVersion 12 | { 13 | IOTDB_SERVICE_PROTOCOL_V1 = 0, 14 | IOTDB_SERVICE_PROTOCOL_V2 = 1, 15 | IOTDB_SERVICE_PROTOCOL_V3 = 2, 16 | } 17 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Apache.IoTDB.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0;net6.0;netstandard2.1;netstandard2.0;net461 5 | latest 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TRegionMigrateFailedType.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | #pragma warning disable IDE0079 // remove unnecessary pragmas 9 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 10 | 11 | public enum TRegionMigrateFailedType 12 | { 13 | AddPeerFailed = 0, 14 | RemovePeerFailed = 1, 15 | RemoveConsensusGroupFailed = 2, 16 | DeleteRegionFailed = 3, 17 | CreateRegionFailed = 4, 18 | } 19 | -------------------------------------------------------------------------------- /docker-compose.dcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2.1 5 | Linux 6 | 4d457769-80cb-401f-9155-c3125c04facd 7 | 8 | 9 | 10 | docker-compose.yml 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Client.cs: -------------------------------------------------------------------------------- 1 | using Thrift.Transport; 2 | 3 | namespace Apache.IoTDB 4 | { 5 | public class Client 6 | { 7 | public IClientRPCService.Client ServiceClient { get; } 8 | public long SessionId { get; } 9 | public long StatementId { get; } 10 | public TFramedTransport Transport { get; } 11 | 12 | public Client(IClientRPCService.Client client, long sessionId, long statementId, TFramedTransport transport) 13 | { 14 | ServiceClient = client; 15 | SessionId = sessionId; 16 | StatementId = statementId; 17 | Transport = transport; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/Apache.IoTDB.Integration.Tests/Apache.IoTDB.Integration.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/dotnet.yml: -------------------------------------------------------------------------------- 1 | name: .NET 2 | 3 | on: 4 | push: 5 | branches: [ main, dev/* ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Setup .NET 17 | uses: actions/setup-dotnet@v1 18 | with: 19 | dotnet-version: 6.0.x 20 | - name: Restore dependencies 21 | run: dotnet restore "src/Apache.IoTDB/Apache.IoTDB.csproj" 22 | - name: Build 23 | run: dotnet build --no-restore "src/Apache.IoTDB/Apache.IoTDB.csproj" 24 | - name: Test 25 | run: dotnet test --no-build --verbosity normal "tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csproj" 26 | -------------------------------------------------------------------------------- /samples/Apache.IoTDB.Samples/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using NLog.Extensions.Logging; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace Apache.IoTDB.Samples 7 | { 8 | public static class Program 9 | { 10 | public static async Task Main(string[] args) 11 | { 12 | var sessionPoolTest = new SessionPoolTest("iotdb"); 13 | await sessionPoolTest.Test() ; 14 | } 15 | 16 | public static void OpenDebugMode(this SessionPool session) 17 | { 18 | session.OpenDebugMode(builder => 19 | { 20 | builder.AddConsole(); 21 | builder.AddNLog(); 22 | }); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /.github/workflows/e2e.yml: -------------------------------------------------------------------------------- 1 | name: E2E Tests 2 | 3 | on: 4 | push: 5 | branches: [ main, dev/* ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | name: e2e test 13 | runs-on: ${{ matrix.os }} 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest] 17 | steps: 18 | 19 | - name: Check out code into the CSharp module directory 20 | uses: actions/checkout@v2 21 | 22 | - name: Set Docker & Run Test 23 | run: | 24 | docker network create --subnet 172.18.0.0/24 iotdb-network && docker-compose -f docker-compose.yml up --build --abort-on-container-exit --remove-orphans 25 | 26 | - name: Clean IoTDB & Shut Down Docker 27 | run: | 28 | docker-compose -f docker-compose.yml down 29 | -------------------------------------------------------------------------------- /samples/Apache.IoTDB.Samples/Dockerfile: -------------------------------------------------------------------------------- 1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. 2 | 3 | FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base 4 | WORKDIR /app 5 | 6 | FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build 7 | WORKDIR /src 8 | COPY ["samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj", "samples/Apache.IoTDB.Samples/"] 9 | COPY ["src/Apache.IoTDB/Apache.IoTDB.csproj", "src/Apache.IoTDB/"] 10 | COPY ["src/Apache.IoTDB.Data/Apache.IoTDB.Data.csproj", "src/Apache.IoTDB.Data/"] 11 | RUN dotnet restore "samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj" 12 | COPY . . 13 | WORKDIR "/src/samples/Apache.IoTDB.Samples" 14 | RUN dotnet build "Apache.IoTDB.Samples.csproj" -c Release -o /app/build 15 | 16 | FROM build AS publish 17 | RUN dotnet publish "Apache.IoTDB.Samples.csproj" -c Release -o /app/publish 18 | 19 | FROM base AS final 20 | WORKDIR /app 21 | COPY --from=publish /app/publish . 22 | ENTRYPOINT ["dotnet", "Apache.IoTDB.Samples.dll"] -------------------------------------------------------------------------------- /src/Apache.IoTDB/Template/TemplateNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Apache.IoTDB.DataStructure; 4 | namespace Apache.IoTDB 5 | { 6 | public abstract class TemplateNode 7 | { 8 | private string name; 9 | public TemplateNode(string name) 10 | { 11 | this.name = name; 12 | } 13 | public string Name 14 | { 15 | get 16 | { 17 | return name; 18 | } 19 | } 20 | 21 | public virtual Dictionary getChildren() 22 | { 23 | return null; 24 | } 25 | 26 | public virtual void addChild(TemplateNode node) { } 27 | public virtual void deleteChild(TemplateNode node) { } 28 | public virtual bool isMeasurement() 29 | { 30 | return false; 31 | } 32 | public virtual bool isShareTime() 33 | { 34 | return false; 35 | } 36 | public virtual byte[] ToBytes() 37 | { 38 | return null; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/Apache.IoTDB.Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Apache.IoTDB.Data 5 | $(AssemblyName) 6 | Apache.IoTDB.Data 7 | 8 | IoTDB implementation of the System.Data.Common provider model. 9 | Commonly Used Types: 10 | Apache.IoTDB.Data.IoTDBCommand 11 | Apache.IoTDB.Data.IoTDBConnection 12 | Apache.IoTDB.Data.IoTDBConnectionStringBuilder 13 | Apache.IoTDB.Data.IoTDBDataReader 14 | Apache.IoTDB.Data.IoTDBException 15 | Apache.IoTDB.Data.IoTDBFactory 16 | Apache.IoTDB.Data.IoTDBParameter 17 | Apache.IoTDB.Data.IoTDBTransaction 18 | 19 | net5.0;net6.0;netstandard2.1;netstandard2.0;net461 20 | 10 21 | Apache.IoTDB.Data是一个IoTDB的ADO.Net 提供器。这将允许你通过.Net访问IoTDB数据库。 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Utils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Apache.IoTDB 5 | { 6 | public class Utils 7 | { 8 | public bool IsSorted(IList collection) 9 | { 10 | for (var i = 1; i < collection.Count; i++) 11 | { 12 | if (collection[i] < collection[i - 1]) 13 | { 14 | return false; 15 | } 16 | } 17 | 18 | return true; 19 | } 20 | 21 | public int VerifySuccess(TSStatus status, int successCode, int redirectRecommendCode) 22 | { 23 | if (status.__isset.subStatus) 24 | { 25 | if (status.SubStatus.Any(subStatus => VerifySuccess(subStatus, successCode, redirectRecommendCode) != 0)) 26 | { 27 | return -1; 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | if (status.Code == successCode || status.Code == redirectRecommendCode) 34 | { 35 | return 0; 36 | } 37 | 38 | return -1; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | Linux 7 | ..\.. 8 | 9 | 10 | 11 | default 12 | 13 | 14 | 15 | default 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific files 2 | *.rsuser 3 | *.suo 4 | *.user 5 | *.userosscache 6 | *.sln.docstates 7 | **/tmp 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | [Rr]eleases/ 14 | x64/ 15 | x86/ 16 | [Ww][Ii][Nn]32/ 17 | [Aa][Rr][Mm]/ 18 | [Aa][Rr][Mm]64/ 19 | bld/ 20 | [Bb]in/ 21 | [Oo]bj/ 22 | [Ll]og/ 23 | [Ll]ogs/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | # NUnit 30 | *.VisualState.xml 31 | TestResult.xml 32 | nunit-*.xml 33 | 34 | # Build Results of an ATL Project 35 | [Dd]ebugPS/ 36 | [Rr]eleasePS/ 37 | dlldata.c 38 | 39 | # .NET Core 40 | project.lock.json 41 | project.fragment.lock.json 42 | artifacts/ 43 | 44 | # StyleCop 45 | StyleCopReport.xml 46 | 47 | 48 | # ReSharper is a .NET coding add-in 49 | _ReSharper*/ 50 | *.[Rr]e[Ss]harper 51 | *.DotSettings.user 52 | 53 | # DotCover is a Code Coverage Tool 54 | *.dotCove 55 | 56 | # Click-Once directory 57 | publish/ 58 | 59 | ### VisualStudioCode ### 60 | .vscode/* 61 | !.vscode/settings.json 62 | !.vscode/tasks.json 63 | !.vscode/launch.json 64 | !.vscode/extensions.json 65 | *.code-workspace 66 | 67 | 68 | ### Rider ### 69 | .idea 70 | /.vs/Apache.IoTDB/FileContentIndex 71 | /.vs/ProjectEvaluation 72 | /.vs/Apache.IoTDB 73 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Template/InternalNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Thrift; 4 | 5 | namespace Apache.IoTDB 6 | { 7 | public class InternalNode : TemplateNode 8 | { 9 | private Dictionary children; 10 | private bool shareTime; 11 | public InternalNode(string name, bool shareTime) : base(name) 12 | { 13 | this.children = new Dictionary(); 14 | this.shareTime = shareTime; 15 | } 16 | public override void addChild(TemplateNode node) 17 | { 18 | if (this.children.ContainsKey(node.Name)) 19 | { 20 | throw new Exception("Duplicated child of node in template."); 21 | } 22 | this.children.Add(node.Name, node); 23 | } 24 | 25 | public override void deleteChild(TemplateNode node) 26 | { 27 | if (this.children.ContainsKey(node.Name)) 28 | { 29 | this.children.Remove(node.Name); 30 | } 31 | } 32 | 33 | public override Dictionary getChildren() 34 | { 35 | return this.children; 36 | } 37 | public override bool isShareTime() 38 | { 39 | return this.shareTime; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB/Template/MeasurementNode.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Apache.IoTDB; 3 | using Apache.IoTDB.DataStructure; 4 | 5 | namespace Apache.IoTDB 6 | { 7 | public class MeasurementNode : TemplateNode 8 | { 9 | private TSDataType dataType; 10 | private TSEncoding encoding; 11 | private Compressor compressor; 12 | public MeasurementNode(string name, TSDataType dataType, TSEncoding encoding, Compressor compressor) : base(name) 13 | { 14 | this.dataType = dataType; 15 | this.encoding = encoding; 16 | this.compressor = compressor; 17 | } 18 | public override bool isMeasurement() 19 | { 20 | return true; 21 | } 22 | public TSDataType DataType 23 | { 24 | get 25 | { 26 | return dataType; 27 | } 28 | } 29 | public TSEncoding Encoding 30 | { 31 | get 32 | { 33 | return encoding; 34 | } 35 | } 36 | public Compressor Compressor 37 | { 38 | get 39 | { 40 | return compressor; 41 | } 42 | } 43 | 44 | public override byte[] ToBytes() 45 | { 46 | var buffer = new ByteBuffer(); 47 | buffer.AddStr(this.Name); 48 | buffer.AddByte((byte)this.DataType); 49 | buffer.AddByte((byte)this.Encoding); 50 | buffer.AddByte((byte)this.Compressor); 51 | return buffer.GetBuffer(); 52 | } 53 | 54 | 55 | 56 | } 57 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/IoTDBFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | 3 | namespace Apache.IoTDB.Data 4 | { 5 | /// 6 | /// Creates instances of various Maikebing.Data.IoTDB classes. 7 | /// 8 | public class IoTDBFactory : DbProviderFactory 9 | { 10 | private IoTDBFactory() 11 | { 12 | } 13 | 14 | /// 15 | /// The singleton instance. 16 | /// 17 | public static readonly IoTDBFactory Instance = new IoTDBFactory(); 18 | 19 | /// 20 | /// Creates a new command. 21 | /// 22 | /// The new command. 23 | public override DbCommand CreateCommand() 24 | => new IoTDBCommand(); 25 | 26 | /// 27 | /// Creates a new connection. 28 | /// 29 | /// The new connection. 30 | public override DbConnection CreateConnection() 31 | => new IoTDBConnection(); 32 | 33 | /// 34 | /// Creates a new connection string builder. 35 | /// 36 | /// The new connection string builder. 37 | public override DbConnectionStringBuilder CreateConnectionStringBuilder() 38 | => new IoTDBConnectionStringBuilder(); 39 | 40 | /// 41 | /// Creates a new parameter. 42 | /// 43 | /// The new parameter. 44 | public override DbParameter CreateParameter() 45 | => new IoTDBParameter(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | apache.iotdb.samples: 5 | image: ${DOCKER_REGISTRY-}apacheiotdbsamples 6 | depends_on: 7 | iotdb: 8 | condition: service_healthy 9 | links: 10 | - iotdb 11 | build: 12 | context: . 13 | dockerfile: samples/Apache.IoTDB.Samples/Dockerfile 14 | networks: 15 | iotdb-network: 16 | ipv4_address: 172.18.0.2 17 | 18 | iotdb: 19 | image: apache/iotdb:1.0.0-datanode 20 | restart: always 21 | container_name: iotdb-dn-1 22 | depends_on: 23 | iotdb-confignode-1: 24 | condition: service_healthy 25 | healthcheck: 26 | test: ["CMD", "ls", "/iotdb/data"] 27 | interval: 3s 28 | timeout: 5s 29 | retries: 30 30 | start_period: 30s 31 | ports: 32 | - 6667:6667 33 | networks: 34 | iotdb-network: 35 | ipv4_address: 172.18.0.3 36 | environment: 37 | - dn_rpc_address=iotdb 38 | - dn_internal_address=iotdb 39 | - dn_target_config_node_list=iotdb-confignode-1:22277 40 | 41 | iotdb-confignode-1: 42 | image: apache/iotdb:1.0.0-confignode 43 | restart: always 44 | container_name: iotdb-cn-1 45 | healthcheck: 46 | test: ["CMD", "ls", "/iotdb/data"] 47 | interval: 3s 48 | timeout: 5s 49 | retries: 30 50 | start_period: 30s 51 | networks: 52 | iotdb-network: 53 | ipv4_address: 172.18.0.4 54 | environment: 55 | - cn_internal_address=iotdb-confignode-1 56 | - cn_target_config_node_list=iotdb-confignode-1:22277 57 | 58 | 59 | networks: 60 | iotdb-network: 61 | external: true -------------------------------------------------------------------------------- /src/Apache.IoTDB/IoTDBConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Apache.IoTDB 2 | { 3 | public enum TSDataType 4 | { 5 | BOOLEAN, 6 | INT32, 7 | INT64, 8 | FLOAT, 9 | DOUBLE, 10 | TEXT, 11 | 12 | // default value must be 0 13 | NONE 14 | } 15 | 16 | public enum TSEncoding 17 | { 18 | PLAIN, 19 | PLAIN_DICTIONARY, 20 | RLE, 21 | DIFF, 22 | TS_2DIFF, 23 | BITMAP, 24 | GORILLA_V1, 25 | REGULAR, 26 | GORILLA, 27 | 28 | // default value must be 0 29 | NONE 30 | } 31 | 32 | public enum Compressor 33 | { 34 | UNCOMPRESSED, 35 | SNAPPY, 36 | GZIP, 37 | LZO, 38 | SDT, 39 | PAA, 40 | PLA, 41 | LZ4 42 | } 43 | public enum TemplateQueryType 44 | { 45 | COUNT_MEASUREMENTS, 46 | IS_MEASUREMENT, 47 | PATH_EXIST, 48 | SHOW_MEASUREMENTS, 49 | SHOW_TEMPLATES, 50 | SHOW_SET_TEMPLATES, 51 | SHOW_USING_TEMPLATES 52 | } 53 | public class TsFileConstant 54 | { 55 | 56 | public static string TSFILE_SUFFIX = ".tsfile"; 57 | public static string TSFILE_HOME = "TSFILE_HOME"; 58 | public static string TSFILE_CONF = "TSFILE_CONF"; 59 | public static string PATH_ROOT = "root"; 60 | public static string TMP_SUFFIX = "tmp"; 61 | public static string PATH_SEPARATOR = "."; 62 | public static char PATH_SEPARATOR_CHAR = '.'; 63 | public static string PATH_SEPARATER_NO_REGEX = "\\."; 64 | public static char DOUBLE_QUOTE = '"'; 65 | 66 | public static byte TIME_COLUMN_MASK = (byte)0x80; 67 | public static byte VALUE_COLUMN_MASK = (byte)0x40; 68 | 69 | private TsFileConstant() { } 70 | } 71 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB/DataStructure/GetSubArray.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | #if NET461_OR_GREATER || NETSTANDARD2_0 5 | //https://github.com/bgrainger/IndexRange 6 | //https://gist.github.com/bgrainger/fb2c18659c2cdfce494c82a8c4803360 7 | 8 | namespace System.Runtime.CompilerServices 9 | { 10 | internal static class RuntimeHelpers 11 | { 12 | /// 13 | /// Slices the specified array using the specified range. 14 | /// 15 | public static T[] GetSubArray(T[] array, Range range) 16 | { 17 | if (array == null) 18 | { 19 | throw new ArgumentNullException(); 20 | } 21 | 22 | (int offset, int length) = range.GetOffsetAndLength(array.Length); 23 | 24 | if (default(T)! != null || typeof(T[]) == array.GetType()) // TODO-NULLABLE: default(T) == null warning (https://github.com/dotnet/roslyn/issues/34757) 25 | { 26 | // We know the type of the array to be exactly T[]. 27 | 28 | if (length == 0) 29 | { 30 | return Array.Empty(); 31 | } 32 | 33 | var dest = new T[length]; 34 | Array.Copy(array, offset, dest, 0, length); 35 | return dest; 36 | } 37 | else 38 | { 39 | // The array is actually a U[] where U:T. 40 | T[] dest = (T[])Array.CreateInstance(array.GetType().GetElementType()!, length); 41 | Array.Copy(array, offset, dest, 0, length); 42 | return dest; 43 | } 44 | } 45 | } 46 | } 47 | #endif -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | 21 | [English](./README.md) | [中文](./README_ZH.md) 22 | 23 | # Apache IoTDB C#语言客户端 24 | 25 | ## 概览 26 | 27 | 本仓库是Apache IoTDB的C#语言客户端,与其他语言支持相同语义的用户接口。 28 | 29 | Apache IoTDB website: https://iotdb.apache.org 30 | 31 | Apache IoTDB Github: https://github.com/apache/iotdb 32 | 33 | ## 如何安装 34 | ### 从NuGet Package安装 35 | 36 | 我们为CSharp用户准备了NuGet包,用户可直接通过.NET CLI进行客户端安装,[NuGet包链接如下](https://www.nuget.org/packages/Apache.IoTDB/),命令行中运行如下命令即可完成安装 37 | 38 | ```sh 39 | dotnet add package Apache.IoTDB 40 | ``` 41 | 42 | 请注意,`Apache.IoTDB`这个包仅支持大于`.net framework 4.6.1`的版本。 43 | ## 环境准备 44 | 45 | .NET SDK Version >= 5.0 46 | .NET Framework >= 4.6.1 47 | 48 | ## 如何使用 (快速上手) 49 | 用户可参考[使用样例](https://github.com/eedalong/Apache-IoTDB-Client-CSharp-UserCase)中的测试代码了解各个接口使用方式 50 | 51 | 52 | ## iotdb-client-csharp的开发者环境要求 53 | .NET SDK Version >= 5.0 54 | .NET Framework >= 4.6.1 55 | ApacheThrift >= 0.14.1 56 | NLog >= 4.7.9 57 | 58 | 59 | ### 操作系统 60 | 61 | * Linux、Macos或其他类unix系统 62 | * Windows+bash(WSL、cygwin、Git Bash) 63 | 64 | ### 命令行工具 65 | 66 | ## 在 nuget.org 上发布你自己的客户端 67 | 你可以在这个[文档](./PUBLISH.md)中找到如何发布 -------------------------------------------------------------------------------- /docs/bytebuffer_zh.md: -------------------------------------------------------------------------------- 1 | ## IoTDB CSharp Client ByteBuffer实现介绍 2 | 在进行`RowRecords`以及`Tablet`的插入时,我们需要对多行RowRecord和Tablet进行序列化以进行发送。客户端中的序列化实现主要依赖于ByteBuffer完成。接下来我们介绍ByteBuffer的实现细节。本文包含如下几点内容: 3 | - 序列化的协议 4 | - C#与Java的大小端的差异 5 | - ByteBuffer内存倍增算法 6 | 7 | ### 一、序列化协议 8 | 客户端向IoTDB服务器发送的序列化数据总体应该包含两个信息。 9 | - 数据类型 10 | - 数据本身 11 | 12 | 其中对于`字符串`的序列化时,我们需要再加入字符串的长度信息。即一个字符串的序列化完整结果为: 13 | 14 | [类型][长度][数据内容] 15 | 接下来我们分别介绍`RowRecord`、`Tablet`的序列化方式 16 | 17 | #### 1.1 RowRecord 18 | 我们对RowRecord进行序列化时,`伪代码`如下: 19 | 20 | public byte[] value_to_bytes(List data_types, List values){ 21 | ByteBuffer buffer = new ByteBuffer(values.Count); 22 | for(int i = 0;i < data_types.Count(); i++){ 23 | buffer.add_type((data_types[i]); 24 | buffer.add_val(values[i]); 25 | } 26 | } 27 | 28 | 对于其序列化的结果格式如下: 29 | 30 | [数据类型1][数据1][数据类型2][数据2]...[数据类型N][数据N] 31 | 其中数据类型为自定义的`Enum`变量,分别如下: 32 | 33 | public enum TSDataType{BOOLEAN, INT32, INT64, FLOAT, DOUBLE, TEXT, NONE}; 34 | 35 | #### 1.2. Tablet序列化 36 | 使用`Tabelt`进行数据插入时有如下限制: 37 | 38 | 限制:Tablet中数据不能有空值 39 | 由于向 `IoTDB`服务器发送`Tablet`数据插入请求时会携带`行数`, `列数`, `列数据类型`,所以`Tabelt`序列化时我们不需要加入数据类型信息。`Tablet`是`按照列进行序列化`,这是因为后端可以通过行数得知出当前列的元素个数,同时根据列类型来对数据进行解析。 40 | 41 | ## CSharp与Java序列化数据时的大小端差异 42 | 由于Java序列化默认大端协议,而CSharp序列化默认得到小端序列。所以我们在CSharp中序列化数据之后,需要对数据进行反转这样后端才可以正常解析。同时当我们从后端获取到序列化的结果时(如`SessionDataset`),我们也需要对获得的数据进行反转以解析内容。这其中特例便是字符串的序列化,CSharp中对字符串的序列化结果为大端序,所以序列化字符串或者接收到字符串序列化结果时,不需要反转序列结果。 43 | 44 | ## ByteBuffer内存倍增法 45 | 拥有数万行的Tablet的序列化结果可能有上百兆,为了能够高效的实现大`Tablet`的序列化,我们对ByteBuffer使用`内存倍增法`的策略来减少序列化过程中对于内存的申请和释放。即当当前的buffer的长度不足以放下序列化结果时,我们将当前buffer的内存`至少`扩增2倍。这极大的减少了内存的申请释放次数,加速了大Tablet的序列化速度。 46 | 47 | private void extend_buffer(int space_need){ 48 | if(write_pos + space_need >= total_length){ 49 | total_length = max(space_need, total_length); 50 | byte[] new_buffer = new byte[total_length * 2]; 51 | buffer.CopyTo(new_buffer, 0); 52 | buffer = new_buffer; 53 | total_length = 2 * total_length; 54 | } 55 | } 56 | 同时在序列化`Tablet`时,我们首先根据Tablet的`行数`,`列数`以及每一列的数据类型估计当前`Tablet`序列化结果所需要的内存大小,并在初始化时进行内存的申请。这进一步的减少了内存的申请释放频率。 57 | 58 | 通过上述的策略,我们在一个有`20000`行的Tablet上进行测试时,序列化速度相比Naive数组长度动态生长实现算法具有约35倍的性能加速。 59 | 60 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/ConcurrentClientQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Threading; 6 | 7 | namespace Apache.IoTDB 8 | { 9 | public class ConcurrentClientQueue 10 | { 11 | public ConcurrentQueue ClientQueue { get; } 12 | 13 | public ConcurrentClientQueue(List clients) 14 | { 15 | ClientQueue = new ConcurrentQueue(clients); 16 | } 17 | public ConcurrentClientQueue() 18 | { 19 | ClientQueue = new ConcurrentQueue(); 20 | } 21 | public void Add(Client client) => Return(client); 22 | 23 | public void Return(Client client) 24 | { 25 | Monitor.Enter(ClientQueue); 26 | ClientQueue.Enqueue(client); 27 | Monitor.PulseAll(ClientQueue); // wake up all threads waiting on the queue, refresh the waiting time 28 | Monitor.Exit(ClientQueue); 29 | Thread.Sleep(0); 30 | } 31 | int _ref = 0; 32 | public void AddRef() 33 | { 34 | lock (this) 35 | { 36 | _ref++; 37 | } 38 | } 39 | public int GetRef() 40 | { 41 | return _ref; 42 | } 43 | public void RemoveRef() 44 | { 45 | lock (this) 46 | { 47 | _ref--; 48 | } 49 | } 50 | public int Timeout { get; set; } = 10; 51 | public Client Take() 52 | { 53 | Client client = null; 54 | Monitor.Enter(ClientQueue); 55 | while(true){ 56 | bool timeout = false; 57 | if (ClientQueue.IsEmpty) 58 | { 59 | timeout = !Monitor.Wait(ClientQueue, TimeSpan.FromSeconds(Timeout)); 60 | } 61 | ClientQueue.TryDequeue(out client); 62 | 63 | if(client != null || timeout){ 64 | break; 65 | } 66 | } 67 | Monitor.Exit(ClientQueue); 68 | if (client == null) 69 | { 70 | throw new TimeoutException($"Connection pool is empty and wait time out({Timeout}s)!"); 71 | } 72 | return client; 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/IoTDBException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | 4 | 5 | namespace Apache.IoTDB.Data 6 | { 7 | /// 8 | /// Represents a IoTDB error. 9 | /// 10 | public class IoTDBException : DbException 11 | { 12 | IoTDBErrorResult _IoTDBError; 13 | 14 | public IoTDBException(IoTDBErrorResult IoTDBError) : base(IoTDBError.Error, null) 15 | { 16 | _IoTDBError = IoTDBError; 17 | base.HResult = _IoTDBError.Code; 18 | } 19 | 20 | public IoTDBException(IoTDBErrorResult IoTDBError, Exception ex) : base(IoTDBError.Error, ex) 21 | { 22 | _IoTDBError = IoTDBError; 23 | base.HResult = _IoTDBError.Code; 24 | } 25 | 26 | 27 | 28 | 29 | 30 | public override string Message => _IoTDBError?.Error; 31 | public override int ErrorCode => (int) _IoTDBError?.Code; 32 | /// 33 | /// Throws an exception with a specific IoTDB error code value. 34 | /// 35 | /// The IoTDB error code corresponding to the desired exception. 36 | /// A handle to database connection. 37 | /// 38 | /// No exception is thrown for non-error result codes. 39 | /// 40 | public static void ThrowExceptionForRC(string _commandText, IoTDBErrorResult IoTDBError) 41 | { 42 | var te = new IoTDBException(IoTDBError); 43 | te.Data.Add("commandText", _commandText); 44 | throw te; 45 | } 46 | public static void ThrowExceptionForRC( IoTDBErrorResult IoTDBError) 47 | { 48 | var te = new IoTDBException(IoTDBError); 49 | throw te; 50 | } 51 | public static void ThrowExceptionForRC(IntPtr _IoTDB) 52 | { 53 | var te = new IoTDBException(new IoTDBErrorResult() { }); 54 | throw te; 55 | } 56 | public static void ThrowExceptionForRC(int code, string message, Exception ex) 57 | { 58 | var te = new IoTDBException(new IoTDBErrorResult() { Code = code, Error = message }, ex); 59 | throw te; 60 | } 61 | public static void ThrowExceptionForRC(int code, string message) 62 | { 63 | var te = new IoTDBException(new IoTDBErrorResult() { Code = code, Error = message }); 64 | throw te; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 21 | [English](./README.md) | [中文](./README_ZH.md) 22 | 23 | # Apache IoTDB Client for C# 24 | 25 | ## Overview 26 | 27 | This is the C# client of Apache IoTDB. 28 | 29 | [Apache IoTDB](https://iotdb.apache.org) (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field. 30 | 31 | Apache IoTDB website: https://iotdb.apache.org 32 | Apache IoTDB Github: https://github.com/apache/iotdb 33 | 34 | ## Installation 35 | 36 | ### Install from NuGet Package 37 | 38 | We have prepared Nuget Package for C# users. Users can directly install the client through .NET CLI. [The link of our NuGet Package is here](https://www.nuget.org/packages/Apache.IoTDB/). Run the following command in the command line to complete installation 39 | 40 | ```sh 41 | dotnet add package Apache.IoTDB 42 | ``` 43 | 44 | Note that the `Apache.IoTDB` package only supports versions greater than `.net framework 4.6.1`.(#starting-from-net-framework-4x). 45 | 46 | ## Prerequisites 47 | 48 | .NET SDK Version >= 5.0 49 | .NET Framework >= 4.6.1 50 | 51 | ## How to Use the Client (Quick Start) 52 | 53 | Users can refer to the test code in [tests](https://github.com/eedalong/Apache-IoTDB-Client-CSharp-UserCase) to understand the usage mode of each interface. 54 | 55 | ## Developer environment requirements for iotdb-client-csharp 56 | 57 | ``` 58 | .NET SDK Version >= 5.0 59 | .NET Framework >= 4.6.1 60 | ApacheThrift >= 0.14.1 61 | NLog >= 4.7.9 62 | ``` 63 | 64 | ### OS 65 | 66 | * Linux, Macos or other unix-like OS 67 | * Windows+bash(WSL, cygwin, Git Bash) 68 | 69 | ### Command Line Tools 70 | 71 | ## Publish your own client on nuget.org 72 | You can find out how to publish from this [doc](./PUBLISH.md). -------------------------------------------------------------------------------- /src/Apache.IoTDB/DataStructure/ArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | #if NET461_OR_GREATER || NETSTANDARD2_0 2 | //https://github.com/Grax32/ArrayExtensions/blob/master/docs/index.md 3 | 4 | using System; 5 | namespace Grax32.Extensions 6 | { 7 | public static class ArrayExtensions 8 | { 9 | public static void Fill(this T[] destinationArray, T value) 10 | { 11 | if (destinationArray == null) 12 | { 13 | throw new ArgumentNullException(nameof(destinationArray)); 14 | } 15 | 16 | destinationArray[0] = value; 17 | FillInternal(destinationArray, 1); 18 | } 19 | 20 | public static void Fill(this T[] destinationArray, T[] values) 21 | { 22 | if (destinationArray == null) 23 | { 24 | throw new ArgumentNullException(nameof(destinationArray)); 25 | } 26 | 27 | var copyLength = values.Length; 28 | var destinationArrayLength = destinationArray.Length; 29 | 30 | if (copyLength == 0) 31 | { 32 | throw new ArgumentException("Parameter must contain at least one value.", nameof(values)); 33 | } 34 | 35 | if (copyLength > destinationArrayLength) 36 | { 37 | // value to copy is longer than destination, 38 | // so fill destination with first part of value 39 | Array.Copy(values, destinationArray, destinationArrayLength); 40 | return; 41 | } 42 | 43 | Array.Copy(values, destinationArray, copyLength); 44 | 45 | FillInternal(destinationArray, copyLength); 46 | } 47 | 48 | private static void FillInternal(this T[] destinationArray, int copyLength) 49 | { 50 | var destinationArrayLength = destinationArray.Length; 51 | var destinationArrayHalfLength = destinationArrayLength / 2; 52 | 53 | // looping copy from beginning of array to current position 54 | // doubling copy length with each pass 55 | for (; copyLength < destinationArrayHalfLength; copyLength *= 2) 56 | { 57 | Array.Copy( 58 | sourceArray: destinationArray, 59 | sourceIndex: 0, 60 | destinationArray: destinationArray, 61 | destinationIndex: copyLength, 62 | length: copyLength); 63 | } 64 | 65 | // we're past halfway, meaning only a single copy remains 66 | // exactly fill remainder of array 67 | Array.Copy( 68 | sourceArray: destinationArray, 69 | sourceIndex: 0, 70 | destinationArray: destinationArray, 71 | destinationIndex: copyLength, 72 | length: destinationArrayLength - copyLength); 73 | } 74 | } 75 | } 76 | #endif -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/DataReaderExtensions.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.Data; 6 | using System.Data.Common; 7 | using System.Linq; 8 | using System.Runtime.InteropServices; 9 | using System.Text; 10 | 11 | namespace Apache.IoTDB.Data 12 | { 13 | public static class DataReaderExtensions 14 | { 15 | public static SessionPool CreateSession(this IoTDBConnectionStringBuilder db) 16 | { 17 | return new SessionPool(db.DataSource, db.Port, db.Username, db.Password, db.FetchSize, db.ZoneId, db.PoolSize,db.Compression,db.TimeOut); 18 | } 19 | 20 | public static List ToObject(this IDataReader dataReader) 21 | { 22 | List jArray = new List(); 23 | try 24 | { 25 | var t = typeof(T); 26 | var pots = t.GetProperties(); 27 | while (dataReader.Read()) 28 | { 29 | T jObject = Activator.CreateInstance(); 30 | for (int i = 0; i < dataReader.FieldCount; i++) 31 | { 32 | try 33 | { 34 | string strKey = dataReader.GetName(i); 35 | if (dataReader[i] != DBNull.Value) 36 | { 37 | var pr = from p in pots where (p.Name == strKey || p.ColumnNameIs(strKey)) && p.CanWrite select p; 38 | if (pr.Any()) 39 | { 40 | var pi = pr.FirstOrDefault(); 41 | pi.SetValue(jObject, Convert.ChangeType(dataReader[i], pi.PropertyType)); 42 | } 43 | } 44 | } 45 | catch (Exception) 46 | { 47 | 48 | } 49 | } 50 | jArray.Add(jObject); 51 | } 52 | } 53 | catch (Exception ex) 54 | { 55 | IoTDBException.ThrowExceptionForRC(-10002, $"ToObject<{nameof(T)}> Error", ex); 56 | } 57 | return jArray; 58 | } 59 | 60 | internal static bool ColumnNameIs(this System.Reflection.PropertyInfo p, string strKey) 61 | { 62 | return (p.IsDefined(typeof(ColumnAttribute), true) && (p.GetCustomAttributes(typeof(ColumnAttribute), true) as ColumnAttribute[])?.FirstOrDefault().Name == strKey); 63 | } 64 | 65 | 66 | public static DataTable ToDataTable(this IDataReader reader) 67 | { 68 | var dt = new DataTable(); 69 | try 70 | { 71 | 72 | dt.Load(reader, LoadOption.OverwriteChanges, (object sender, FillErrorEventArgs e) => 73 | { 74 | 75 | }); 76 | } 77 | catch (Exception) 78 | { 79 | 80 | 81 | } 82 | return dt; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /docs/C#原生接口.md: -------------------------------------------------------------------------------- 1 | # C# 原生接口 2 | 3 | ## 依赖 4 | 5 | - .NET SDK >= 5.0 或 .NET Framework 4.x 6 | - ApacheThrift >= 0.14.1 7 | - NLog >= 4.7.9 8 | 9 | ## 安装 10 | 11 | 您可以使用 NuGet Package Manager, .NET CLI等工具来安装,以 .NET CLI为例 12 | 13 | 如果您使用的是.NET 5.0 或者更高版本的SDK,输入如下命令即可安装最新的NuGet包 14 | 15 | ``` 16 | dotnet add package Apache.IoTDB 17 | ``` 18 | 19 | 为了适配 .NET Framework 4.x,我们单独构建了一个NuGet包,如果您使用的是.NET Framework 4.x,输入如下命令即可安装最新的包 20 | 21 | ```bash 22 | dotnet add package Apache.IoTDB.framework 23 | ``` 24 | 25 | 如果您想安装更早版本的客户端,只需要指定版本即可 26 | 27 | ```bash 28 | # 安装0.12.1.2版本的客户端 29 | dotnet add package Apache.IoTDB --version 0.12.1.2 30 | ``` 31 | 32 | ## 基本接口说明 33 | 34 | Session接口在语义上和其他语言客户端相同 35 | 36 | ```c# 37 | // 参数定义 38 | string host = "localhost"; 39 | int port = 6667; 40 | int pool_size = 2; 41 | 42 | // 初始化session 43 | var session_pool = new SessionPool(host, port, pool_size); 44 | 45 | // 开启session 46 | await session_pool.Open(false); 47 | 48 | // 创建时间序列 49 | await session_pool.CreateTimeSeries("root.test_group.test_device.ts1", TSDataType.TEXT, TSEncoding.PLAIN, Compressor.UNCOMPRESSED); 50 | await session_pool.CreateTimeSeries("root.test_group.test_device.ts2", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.UNCOMPRESSED); 51 | await session_pool.CreateTimeSeries("root.test_group.test_device.ts3", TSDataType.INT32, TSEncoding.PLAIN, Compressor.UNCOMPRESSED); 52 | 53 | // 插入record 54 | var measures = new List{"ts1", "ts2", "ts3"}; 55 | var values = new List { "test_text", true, (int)123 }; 56 | var timestamp = 1; 57 | var rowRecord = new RowRecord(timestamp, values, measures); 58 | await session_pool.InsertRecordAsync("root.test_group.test_device", rowRecord); 59 | 60 | // 插入Tablet 61 | var timestamp_lst = new List{ timestamp + 1 }; 62 | var value_lst = new List {new() {"iotdb", true, (int) 12}}; 63 | var tablet = new Tablet("root.test_group.test_device", measures, value_lst, timestamp_ls); 64 | await session_pool.InsertTabletAsync(tablet); 65 | 66 | // 关闭Session 67 | await session_pool.Close(); 68 | ``` 69 | 70 | 详细接口信息可以参考[接口文档](https://github.com/eedalong/Apache-IoTDB-Client-CSharp/blob/main/docs/API.md) 71 | 72 | 用法可以参考[用户示例](https://github.com/eedalong/Apache-IoTDB-Client-CSharp/tree/main/samples/Apache.IoTDB.Samples) 73 | 74 | ## 连接池 75 | 76 | 为了实现并发客户端请求,我们提供了针对原生接口的连接池(`SessionPool`),由于`SessionPool`本身为`Session`的超集,当`SessionPool`的`pool_size`参数设置为1时,退化为原来的`Session` 77 | 78 | 我们使用`ConcurrentQueue`数据结构封装了一个客户端队列,以维护与服务端的多个连接,当调用`Open()`接口时,会在该队列中创建指定个数的客户端,同时通过`System.Threading.Monitor`类实现对队列的同步访问。 79 | 80 | 当请求发生时,会尝试从连接池中寻找一个空闲的客户端连接,如果没有空闲连接,那么程序将需要等待直到有空闲连接 81 | 82 | 当一个连接被用完后,他会自动返回池中等待下次被使用 83 | 84 | 在使用连接池后,客户端的并发性能提升明显,[这篇文档](https://github.com/eedalong/Apache-IoTDB-Client-CSharp/blob/main/docs/session_pool_zh.md#%E5%BB%BA%E7%AB%8Bclient%E8%BF%9E%E6%8E%A5)展示了使用线程池比起单线程所带来的性能提升 85 | 86 | ## ByteBuffer 87 | 88 | 在传入RPC接口参数时,需要对Record和Tablet两种数据结构进行序列化,我们主要通过封装的ByteBuffer类实现 89 | 90 | 在封装字节序列的基础上,我们进行了内存预申请与内存倍增的优化,减少了序列化过程中内存的申请和释放,在一个拥有20000行的Tablet上进行序列化测试时,速度比起原生的数组动态增长具有**35倍的性能加速** 91 | 92 | 详见以下两篇文档 93 | 94 | [ByteBuffer详细介绍](https://github.com/eedalong/Apache-IoTDB-Client-CSharp/blob/main/docs/bytebuffer_zh.md) 95 | 96 | [ByteBuffer性能测试文档](https://bnw3yl170k.feishu.cn/docs/doccnxiHV7avYiFBkuEljCLIYO4#mMS5HE) 97 | 98 | ## 异常重连 99 | 100 | 当服务端发生异常或者宕机重启时,客户端中原来通过`Open()`产生的的session会失效,抛出`TException`异常 101 | 102 | 为了避免这一情况的发生,我们对大部分的接口进行了增强,一旦出现连接问题,就会尝试重新调用`Open()`接口并创建新的Session,并尝试重新发送对应的请求 103 | 104 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/DataStructure/BitMap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET461_OR_GREATER || NETSTANDARD2_0 3 | using Grax32.Extensions; 4 | #endif 5 | public class BitMap 6 | { 7 | private static byte[] BIT_UTIL = new byte[] { 1, 2, 4, 8, 16, 32, 64, 255 }; 8 | private static byte[] UNMARK_BIT_UTIL = 9 | new byte[] { 10 | (byte) 0XFE, // 11111110 11 | (byte) 0XFD, // 11111101 12 | (byte) 0XFB, // 11111011 13 | (byte) 0XF7, // 11110111 14 | (byte) 0XEF, // 11101111 15 | (byte) 0XDF, // 11011111 16 | (byte) 0XBF, // 10111111 17 | (byte) 0X7F // 01111111 18 | }; 19 | private byte[] bits; 20 | private int size; 21 | 22 | /** Initialize a BitMap with given size. */ 23 | public BitMap(int size) 24 | { 25 | this.size = size; 26 | bits = new byte[size / 8 + 1]; 27 | #if NET461_OR_GREATER || NETSTANDARD2_0 28 | bits.Fill((byte)0); 29 | #else 30 | Array.Fill(bits, (byte)0); 31 | #endif 32 | } 33 | 34 | /** Initialize a BitMap with given size and bytes. */ 35 | public BitMap(int size, byte[] bits) 36 | { 37 | this.size = size; 38 | this.bits = bits; 39 | } 40 | 41 | public byte[] getByteArray() 42 | { 43 | return this.bits; 44 | } 45 | 46 | public int getSize() 47 | { 48 | return this.size; 49 | } 50 | 51 | /** returns the value of the bit with the specified index. */ 52 | public bool isMarked(int position) 53 | { 54 | return (bits[position / 8] & BIT_UTIL[position % 8]) != 0; 55 | } 56 | 57 | /** mark as 1 at all positions. */ 58 | public void markAll() 59 | { 60 | #if NET461_OR_GREATER || NETSTANDARD2_0 61 | bits.Fill((byte)0xFF); 62 | #else 63 | Array.Fill(bits, (byte)0xFF); 64 | #endif 65 | 66 | } 67 | 68 | /** mark as 1 at the given bit position. */ 69 | public void mark(int position) 70 | { 71 | bits[position / 8] |= BIT_UTIL[position % 8]; 72 | } 73 | 74 | /** mark as 0 at all positions. */ 75 | public void reset() 76 | { 77 | #if NET461_OR_GREATER || NETSTANDARD2_0 78 | bits.Fill((byte)0xFF); 79 | #else 80 | Array.Fill(bits, (byte)0); 81 | #endif 82 | } 83 | 84 | public void unmark(int position) 85 | { 86 | bits[position / 8] &= UNMARK_BIT_UTIL[position % 8]; 87 | } 88 | 89 | /** whether all bits are zero, i.e., no Null value */ 90 | public bool isAllUnmarked() 91 | { 92 | int j; 93 | for (j = 0; j < size / 8; j++) 94 | { 95 | if (bits[j] != (byte)0) 96 | { 97 | return false; 98 | } 99 | } 100 | for (j = 0; j < size % 8; j++) 101 | { 102 | if ((bits[size / 8] & BIT_UTIL[j]) != 0) 103 | { 104 | return false; 105 | } 106 | } 107 | return true; 108 | } 109 | 110 | /** whether all bits are one, i.e., all are Null */ 111 | public bool isAllMarked() 112 | { 113 | int j; 114 | for (j = 0; j < size / 8; j++) 115 | { 116 | if (bits[j] != (byte)0XFF) 117 | { 118 | return false; 119 | } 120 | } 121 | for (j = 0; j < size % 8; j++) 122 | { 123 | if ((bits[size / 8] & BIT_UTIL[j]) == 0) 124 | { 125 | return false; 126 | } 127 | } 128 | return true; 129 | } 130 | } -------------------------------------------------------------------------------- /docs/session_pool_zh.md: -------------------------------------------------------------------------------- 1 | # IoTDB-CSharp客户端的定制化SessionPool机制 2 | 3 | ### 主要参数 4 | 5 | - `_username`:用户名 6 | - `_password`:密码 7 | - `_zoneId`:时区 8 | - `_host`:主机ip 9 | - `_port`:端口号 10 | - `_fetchSize`:单次请求数据大小 11 | - `_poolSize`:线程池大小(默认为4) 12 | 13 | ### 数据结构 14 | 15 | - #### Client 16 | 17 | 该数据结构对**客户端连接**进行了封装,维护一个客户端实例**TSIService.Client、**线程码**SessionId**与状态码**StatementId**以及分帧传输流**TFramedTransport。** 18 | 19 | ```c# 20 | public Client(TSIService.Client client, long sessionId, long statementId, TFramedTransport transport) 21 | { 22 | ServiceClient = client; 23 | SessionId = sessionId; 24 | StatementId = statementId; 25 | Transport = transport; 26 | } 27 | ``` 28 | 29 | - #### ConcurrentClientQueue 30 | 31 | 该数据结构封装了一个**高效的线程安全队列**,用于维护客户端与服务器的多个Client连接。 32 | 33 | ### Client-Server交互全流程 34 | 35 | - #### 建立Client连接 36 | - 用户创建一个**SessionPool**并调用**Open()**函数后,系统会创建一个**ConcurrentClientQueue**实例,并向其中创建并添加 _poolSize 个**Client**连接(客户端连接)。 37 | - 创建**Client**连接时,首先建立Tcp连接并获得**TSIService.Client**的实例,然后通过**openSessionAsync()**函数为该客户端开启一个新的线程,开启成功后获得线程码**SessionId**与状态码**StatementId**,进而创建一个**Client**连接。 38 | - 添加**Client**连接时,调用**ConcurrentClientQueue**的**Add()**函数,代码如下: 39 | 40 | ```c# 41 | public void Add(Client client) 42 | { 43 | Monitor.Enter(ClientQueue); 44 | ClientQueue.Enqueue(client); 45 | Monitor.Pulse(ClientQueue); 46 | Monitor.Exit(ClientQueue); 47 | } 48 | ``` 49 | 50 | > 通过System.Threading.**Monitor**类实现多线程对**ConcurrentQueue**的同步访问,以确保数据的安全性。 51 | 52 | - #### 获取空闲连接 53 | 54 | 当请求发生时,系统会在**ConcurrentClientQueue**中寻找一个空闲的**Client**连接,即调用 **ConcurrentClientQueue** 的**Take()**函数,代码如下: 55 | 56 | ```c# 57 | public Client Take() 58 | { 59 | Monitor.Enter(ClientQueue); 60 | if (ClientQueue.IsEmpty) 61 | { 62 | Monitor.Wait(ClientQueue); 63 | } 64 | ClientQueue.TryDequeue(out var client); 65 | Monitor.Exit(ClientQueue); 66 | return client; 67 | } 68 | ``` 69 | 70 | 如果请求时**ConcurrentClientQueue**中没有空闲**Client**连接时,系统会调用 Monitor 类中的 **Wait()** 方法让线程等待,直到队列不为空时,弹出空闲**Client**连接。 71 | 72 | - #### 执行操作 73 | 74 | 获取到空闲Client连接后,系统便在此连接上进行数据操作,示例如下: 75 | 76 | ```c# 77 | public async Task InsertRecordAsync(string deviceId, RowRecord record) 78 | { 79 | var client = _clients.Take(); // 获取空闲的Client连接 80 | var req = new TSInsertRecordReq(client.SessionId, deviceId, record.Measurements, record.ToBytes(), 81 | record.Timestamps); 82 | try 83 | { 84 | var status = await client.ServiceClient.insertRecordAsync(req); 85 | if (_debugMode) 86 | { 87 | _logger.Info("insert one record to device {0}, server message: {1}", deviceId, status.Message); 88 | } 89 | return _utilFunctions.verify_success(status, SuccessCode); 90 | } 91 | 92 | catch (TException e) 93 | { 94 | throw new TException("Record insertion failed", e); 95 | } 96 | 97 | finally 98 | { 99 | _clients.Add(client); 100 | } 101 | } 102 | ``` 103 | 104 | - #### 回收Client连接 105 | 106 | 当操作结束后,系统会回收该空闲连接,通过 **ConcurrentClientQueue.Add()** 函数将该连接重新加入队列,并在在添加后会通过 **Pulse()** 方法通知其他处于等待状态的线程。考虑到操作过程中可能出现异常,所有操作都被放在try-catch块中,即使捕获到了异常也会将该Client连接放回队列中,防止连接丢失。 107 | 108 | ### 对比评测 109 | 110 | #### 本地测试 111 | 112 | > ##### 测试环境: 113 | > 114 | > - 操作系统:macOS 115 | > - 处理器:2.3GHz 八核 Intel Core i9 116 | > - IoTDB版本:0.12.0 117 | 118 | 1 119 | 120 | #### 远端测试 121 | 122 | > ##### 测试环境: 123 | > 124 | > - 本地: 125 | > - 操作系统:macOS 126 | > - 处理器:2.3GHz 八核 Intel Core i9 127 | > - 服务器: 128 | > - IoTDB版本:0.12.1 129 | 130 | 2 131 | 132 | 3 133 | 134 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/common.Extensions.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | 20 | #pragma warning disable IDE0079 // remove unnecessary pragmas 21 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 22 | 23 | public static class commonExtensions 24 | { 25 | public static bool Equals(this List instance, object that) 26 | { 27 | if (!(that is List other)) return false; 28 | if (ReferenceEquals(instance, other)) return true; 29 | 30 | return TCollections.Equals(instance, other); 31 | } 32 | 33 | 34 | public static int GetHashCode(this List instance) 35 | { 36 | return TCollections.GetHashCode(instance); 37 | } 38 | 39 | 40 | public static List DeepCopy(this List source) 41 | { 42 | if (source == null) 43 | return null; 44 | 45 | var tmp50 = new List(source.Count); 46 | foreach (var elem in source) 47 | tmp50.Add((elem != null) ? elem.DeepCopy() : null); 48 | return tmp50; 49 | } 50 | 51 | 52 | public static bool Equals(this List instance, object that) 53 | { 54 | if (!(that is List other)) return false; 55 | if (ReferenceEquals(instance, other)) return true; 56 | 57 | return TCollections.Equals(instance, other); 58 | } 59 | 60 | 61 | public static int GetHashCode(this List instance) 62 | { 63 | return TCollections.GetHashCode(instance); 64 | } 65 | 66 | 67 | public static List DeepCopy(this List source) 68 | { 69 | if (source == null) 70 | return null; 71 | 72 | var tmp51 = new List(source.Count); 73 | foreach (var elem in source) 74 | tmp51.Add((elem != null) ? elem.DeepCopy() : null); 75 | return tmp51; 76 | } 77 | 78 | 79 | public static bool Equals(this List instance, object that) 80 | { 81 | if (!(that is List other)) return false; 82 | if (ReferenceEquals(instance, other)) return true; 83 | 84 | return TCollections.Equals(instance, other); 85 | } 86 | 87 | 88 | public static int GetHashCode(this List instance) 89 | { 90 | return TCollections.GetHashCode(instance); 91 | } 92 | 93 | 94 | public static List DeepCopy(this List source) 95 | { 96 | if (source == null) 97 | return null; 98 | 99 | var tmp52 = new List(source.Count); 100 | foreach (var elem in source) 101 | tmp52.Add((elem != null) ? elem.DeepCopy() : null); 102 | return tmp52; 103 | } 104 | 105 | 106 | public static bool Equals(this List instance, object that) 107 | { 108 | if (!(that is List other)) return false; 109 | if (ReferenceEquals(instance, other)) return true; 110 | 111 | return TCollections.Equals(instance, other); 112 | } 113 | 114 | 115 | public static int GetHashCode(this List instance) 116 | { 117 | return TCollections.GetHashCode(instance); 118 | } 119 | 120 | 121 | public static List DeepCopy(this List source) 122 | { 123 | if (source == null) 124 | return null; 125 | 126 | var tmp53 = new List(source.Count); 127 | foreach (var elem in source) 128 | tmp53.Add((elem != null) ? elem : null); 129 | return tmp53; 130 | } 131 | 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/Apache.IoTDB.Data/IoTDBTransaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Data.Common; 4 | 5 | namespace Apache.IoTDB.Data 6 | { 7 | /// 8 | /// Represents a transaction made against a IoTDB database. 9 | /// 10 | public class IoTDBTransaction : DbTransaction 11 | { 12 | private IoTDBConnection _connection; 13 | private readonly IsolationLevel _isolationLevel; 14 | private bool _completed; 15 | private bool _externalRollback; 16 | 17 | internal IoTDBTransaction(IoTDBConnection connection, IsolationLevel isolationLevel) 18 | { 19 | _connection = connection; 20 | _isolationLevel = isolationLevel; 21 | } 22 | 23 | /// 24 | /// Gets the connection associated with the transaction. 25 | /// 26 | /// The connection associated with the transaction. 27 | public new virtual IoTDBConnection Connection 28 | => _connection; 29 | 30 | /// 31 | /// Gets the connection associated with the transaction. 32 | /// 33 | /// The connection associated with the transaction. 34 | protected override DbConnection DbConnection 35 | => Connection; 36 | 37 | internal bool ExternalRollback 38 | => _externalRollback; 39 | 40 | /// 41 | /// Gets the isolation level for the transaction. This cannot be changed if the transaction is completed or 42 | /// closed. 43 | /// 44 | /// The isolation level for the transaction. 45 | public override IsolationLevel IsolationLevel => IsolationLevel.Unspecified; 46 | 47 | 48 | /// 49 | /// Applies the changes made in the transaction. 50 | /// 51 | public override void Commit() 52 | { 53 | //if (_externalRollback || _completed || _connection.State != ConnectionState.Open) 54 | //{ 55 | // throw new InvalidOperationException(Resources.TransactionCompleted); 56 | //} 57 | 58 | //_connection.ExecuteNonQuery("COMMIT;"); 59 | Complete(); 60 | } 61 | 62 | /// 63 | /// Reverts the changes made in the transaction. 64 | /// 65 | public override void Rollback() 66 | { 67 | //if (_completed || _connection.State != ConnectionState.Open) 68 | //{ 69 | // throw new InvalidOperationException(Resources.TransactionCompleted); 70 | //} 71 | 72 | RollbackInternal(); 73 | } 74 | 75 | /// 76 | /// Releases any resources used by the transaction and rolls it back. 77 | /// 78 | /// 79 | /// true to release managed and unmanaged resources; false to release only unmanaged resources. 80 | /// 81 | protected override void Dispose(bool disposing) 82 | { 83 | if (disposing 84 | && !_completed 85 | && _connection.State == ConnectionState.Open) 86 | { 87 | RollbackInternal(); 88 | } 89 | } 90 | 91 | private void Complete() 92 | { 93 | if (_connection!=null)_connection.Transaction = null; 94 | _connection = null; 95 | _completed = true; 96 | } 97 | 98 | private void RollbackInternal() 99 | { 100 | Complete(); 101 | } 102 | 103 | private void RollbackExternal(object userData) 104 | { 105 | _externalRollback = true; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Template/Template.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Apache.IoTDB.DataStructure; 4 | using Thrift; 5 | namespace Apache.IoTDB 6 | { 7 | public class Template 8 | { 9 | private string name; 10 | private Dictionary children; 11 | private bool shareTime; 12 | public Template(string name, bool shareTime) 13 | { 14 | this.name = name; 15 | this.children = new Dictionary(); 16 | this.shareTime = shareTime; 17 | } 18 | public Template(string name) 19 | { 20 | this.name = name; 21 | this.children = new Dictionary(); 22 | this.shareTime = false; 23 | } 24 | public string Name 25 | { 26 | get 27 | { 28 | return name; 29 | } 30 | } 31 | public bool ShareTime 32 | { 33 | get 34 | { 35 | return shareTime; 36 | } 37 | set 38 | { 39 | shareTime = value; 40 | } 41 | } 42 | public void addToTemplate(TemplateNode child) 43 | { 44 | if (this.children.ContainsKey(child.Name)) 45 | { 46 | throw new Exception("Duplicated child of node in template."); 47 | } 48 | this.children.Add(child.Name, child); 49 | } 50 | 51 | public void deleteFromTemplate(string name) 52 | { 53 | if (this.children.ContainsKey(name)) 54 | { 55 | this.children.Remove(name); 56 | } 57 | else 58 | { 59 | throw new Exception("It is not a direct child of the template: " + name); 60 | } 61 | } 62 | 63 | public byte[] ToBytes() 64 | { 65 | var buffer = new ByteBuffer(); 66 | var stack = new Stack>(); 67 | var alignedPrefix = new HashSet(); 68 | buffer.AddStr(this.name); 69 | buffer.AddBool(this.shareTime); 70 | if (this.shareTime) 71 | { 72 | alignedPrefix.Add(""); 73 | } 74 | 75 | foreach (var child in this.children.Values) 76 | { 77 | stack.Push(new KeyValuePair("", child)); 78 | } 79 | 80 | while (stack.Count != 0) 81 | { 82 | var pair = stack.Pop(); 83 | var prefix = pair.Key; 84 | var curNode = pair.Value; 85 | var fullPath = prefix; 86 | 87 | if (!curNode.isMeasurement()) 88 | { 89 | if (!"".Equals(prefix)) 90 | { 91 | fullPath += TsFileConstant.PATH_SEPARATOR; 92 | } 93 | fullPath += curNode.Name; 94 | if (curNode.isShareTime()) 95 | { 96 | alignedPrefix.Add(fullPath); 97 | } 98 | 99 | foreach (var child in curNode.getChildren().Values) 100 | { 101 | stack.Push(new KeyValuePair(fullPath, child)); 102 | } 103 | } 104 | else 105 | { 106 | buffer.AddStr(prefix); 107 | if (alignedPrefix.Contains(prefix)) 108 | { 109 | buffer.AddBool(true); 110 | } 111 | else 112 | { 113 | buffer.AddBool(false); 114 | } 115 | foreach (var singleByte in curNode.ToBytes()) 116 | { 117 | buffer.AddByte(singleByte); 118 | } 119 | } 120 | } 121 | return buffer.GetBuffer(); 122 | 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSeriesPartitionSlot.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSeriesPartitionSlot : TBase 33 | { 34 | 35 | public int SlotId { get; set; } 36 | 37 | public TSeriesPartitionSlot() 38 | { 39 | } 40 | 41 | public TSeriesPartitionSlot(int slotId) : this() 42 | { 43 | this.SlotId = slotId; 44 | } 45 | 46 | public TSeriesPartitionSlot DeepCopy() 47 | { 48 | var tmp10 = new TSeriesPartitionSlot(); 49 | tmp10.SlotId = this.SlotId; 50 | return tmp10; 51 | } 52 | 53 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 54 | { 55 | iprot.IncrementRecursionDepth(); 56 | try 57 | { 58 | bool isset_slotId = false; 59 | TField field; 60 | await iprot.ReadStructBeginAsync(cancellationToken); 61 | while (true) 62 | { 63 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 64 | if (field.Type == TType.Stop) 65 | { 66 | break; 67 | } 68 | 69 | switch (field.ID) 70 | { 71 | case 1: 72 | if (field.Type == TType.I32) 73 | { 74 | SlotId = await iprot.ReadI32Async(cancellationToken); 75 | isset_slotId = true; 76 | } 77 | else 78 | { 79 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 80 | } 81 | break; 82 | default: 83 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 84 | break; 85 | } 86 | 87 | await iprot.ReadFieldEndAsync(cancellationToken); 88 | } 89 | 90 | await iprot.ReadStructEndAsync(cancellationToken); 91 | if (!isset_slotId) 92 | { 93 | throw new TProtocolException(TProtocolException.INVALID_DATA); 94 | } 95 | } 96 | finally 97 | { 98 | iprot.DecrementRecursionDepth(); 99 | } 100 | } 101 | 102 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 103 | { 104 | oprot.IncrementRecursionDepth(); 105 | try 106 | { 107 | var struc = new TStruct("TSeriesPartitionSlot"); 108 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 109 | var field = new TField(); 110 | field.Name = "slotId"; 111 | field.Type = TType.I32; 112 | field.ID = 1; 113 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 114 | await oprot.WriteI32Async(SlotId, cancellationToken); 115 | await oprot.WriteFieldEndAsync(cancellationToken); 116 | await oprot.WriteFieldStopAsync(cancellationToken); 117 | await oprot.WriteStructEndAsync(cancellationToken); 118 | } 119 | finally 120 | { 121 | oprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public override bool Equals(object that) 126 | { 127 | if (!(that is TSeriesPartitionSlot other)) return false; 128 | if (ReferenceEquals(this, other)) return true; 129 | return System.Object.Equals(SlotId, other.SlotId); 130 | } 131 | 132 | public override int GetHashCode() { 133 | int hashcode = 157; 134 | unchecked { 135 | hashcode = (hashcode * 397) + SlotId.GetHashCode(); 136 | } 137 | return hashcode; 138 | } 139 | 140 | public override string ToString() 141 | { 142 | var sb = new StringBuilder("TSeriesPartitionSlot("); 143 | sb.Append(", SlotId: "); 144 | SlotId.ToString(sb); 145 | sb.Append(')'); 146 | return sb.ToString(); 147 | } 148 | } 149 | 150 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSCloseSessionReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSCloseSessionReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public TSCloseSessionReq() 38 | { 39 | } 40 | 41 | public TSCloseSessionReq(long sessionId) : this() 42 | { 43 | this.SessionId = sessionId; 44 | } 45 | 46 | public TSCloseSessionReq DeepCopy() 47 | { 48 | var tmp71 = new TSCloseSessionReq(); 49 | tmp71.SessionId = this.SessionId; 50 | return tmp71; 51 | } 52 | 53 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 54 | { 55 | iprot.IncrementRecursionDepth(); 56 | try 57 | { 58 | bool isset_sessionId = false; 59 | TField field; 60 | await iprot.ReadStructBeginAsync(cancellationToken); 61 | while (true) 62 | { 63 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 64 | if (field.Type == TType.Stop) 65 | { 66 | break; 67 | } 68 | 69 | switch (field.ID) 70 | { 71 | case 1: 72 | if (field.Type == TType.I64) 73 | { 74 | SessionId = await iprot.ReadI64Async(cancellationToken); 75 | isset_sessionId = true; 76 | } 77 | else 78 | { 79 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 80 | } 81 | break; 82 | default: 83 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 84 | break; 85 | } 86 | 87 | await iprot.ReadFieldEndAsync(cancellationToken); 88 | } 89 | 90 | await iprot.ReadStructEndAsync(cancellationToken); 91 | if (!isset_sessionId) 92 | { 93 | throw new TProtocolException(TProtocolException.INVALID_DATA); 94 | } 95 | } 96 | finally 97 | { 98 | iprot.DecrementRecursionDepth(); 99 | } 100 | } 101 | 102 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 103 | { 104 | oprot.IncrementRecursionDepth(); 105 | try 106 | { 107 | var struc = new TStruct("TSCloseSessionReq"); 108 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 109 | var field = new TField(); 110 | field.Name = "sessionId"; 111 | field.Type = TType.I64; 112 | field.ID = 1; 113 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 114 | await oprot.WriteI64Async(SessionId, cancellationToken); 115 | await oprot.WriteFieldEndAsync(cancellationToken); 116 | await oprot.WriteFieldStopAsync(cancellationToken); 117 | await oprot.WriteStructEndAsync(cancellationToken); 118 | } 119 | finally 120 | { 121 | oprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public override bool Equals(object that) 126 | { 127 | if (!(that is TSCloseSessionReq other)) return false; 128 | if (ReferenceEquals(this, other)) return true; 129 | return System.Object.Equals(SessionId, other.SessionId); 130 | } 131 | 132 | public override int GetHashCode() { 133 | int hashcode = 157; 134 | unchecked { 135 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 136 | } 137 | return hashcode; 138 | } 139 | 140 | public override string ToString() 141 | { 142 | var sb = new StringBuilder("TSCloseSessionReq("); 143 | sb.Append(", SessionId: "); 144 | SessionId.ToString(sb); 145 | sb.Append(')'); 146 | return sb.ToString(); 147 | } 148 | } 149 | 150 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TTimePartitionSlot.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TTimePartitionSlot : TBase 33 | { 34 | 35 | public long StartTime { get; set; } 36 | 37 | public TTimePartitionSlot() 38 | { 39 | } 40 | 41 | public TTimePartitionSlot(long startTime) : this() 42 | { 43 | this.StartTime = startTime; 44 | } 45 | 46 | public TTimePartitionSlot DeepCopy() 47 | { 48 | var tmp12 = new TTimePartitionSlot(); 49 | tmp12.StartTime = this.StartTime; 50 | return tmp12; 51 | } 52 | 53 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 54 | { 55 | iprot.IncrementRecursionDepth(); 56 | try 57 | { 58 | bool isset_startTime = false; 59 | TField field; 60 | await iprot.ReadStructBeginAsync(cancellationToken); 61 | while (true) 62 | { 63 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 64 | if (field.Type == TType.Stop) 65 | { 66 | break; 67 | } 68 | 69 | switch (field.ID) 70 | { 71 | case 1: 72 | if (field.Type == TType.I64) 73 | { 74 | StartTime = await iprot.ReadI64Async(cancellationToken); 75 | isset_startTime = true; 76 | } 77 | else 78 | { 79 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 80 | } 81 | break; 82 | default: 83 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 84 | break; 85 | } 86 | 87 | await iprot.ReadFieldEndAsync(cancellationToken); 88 | } 89 | 90 | await iprot.ReadStructEndAsync(cancellationToken); 91 | if (!isset_startTime) 92 | { 93 | throw new TProtocolException(TProtocolException.INVALID_DATA); 94 | } 95 | } 96 | finally 97 | { 98 | iprot.DecrementRecursionDepth(); 99 | } 100 | } 101 | 102 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 103 | { 104 | oprot.IncrementRecursionDepth(); 105 | try 106 | { 107 | var struc = new TStruct("TTimePartitionSlot"); 108 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 109 | var field = new TField(); 110 | field.Name = "startTime"; 111 | field.Type = TType.I64; 112 | field.ID = 1; 113 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 114 | await oprot.WriteI64Async(StartTime, cancellationToken); 115 | await oprot.WriteFieldEndAsync(cancellationToken); 116 | await oprot.WriteFieldStopAsync(cancellationToken); 117 | await oprot.WriteStructEndAsync(cancellationToken); 118 | } 119 | finally 120 | { 121 | oprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public override bool Equals(object that) 126 | { 127 | if (!(that is TTimePartitionSlot other)) return false; 128 | if (ReferenceEquals(this, other)) return true; 129 | return System.Object.Equals(StartTime, other.StartTime); 130 | } 131 | 132 | public override int GetHashCode() { 133 | int hashcode = 157; 134 | unchecked { 135 | hashcode = (hashcode * 397) + StartTime.GetHashCode(); 136 | } 137 | return hashcode; 138 | } 139 | 140 | public override string ToString() 141 | { 142 | var sb = new StringBuilder("TTimePartitionSlot("); 143 | sb.Append(", StartTime: "); 144 | StartTime.ToString(sb); 145 | sb.Append(')'); 146 | return sb.ToString(); 147 | } 148 | } 149 | 150 | -------------------------------------------------------------------------------- /samples/Apache.IoTDB.Samples/SessionPoolTest.Template.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Apache.IoTDB.DataStructure; 6 | namespace Apache.IoTDB.Samples 7 | { 8 | public partial class SessionPoolTest 9 | { 10 | public async Task TestCreateAndDropSchemaTemplate() 11 | { 12 | var session_pool = new SessionPool(host, port, pool_size); 13 | await session_pool.Open(false); 14 | if (debug) session_pool.OpenDebugMode(); 15 | 16 | System.Diagnostics.Debug.Assert(session_pool.IsOpen()); 17 | var status = 0; 18 | await session_pool.DropSchemaTemplateAsync(test_template_name); 19 | 20 | MeasurementNode node1 = new MeasurementNode(test_measurements[1], TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY); 21 | MeasurementNode node2 = new MeasurementNode(test_measurements[2], TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY); 22 | MeasurementNode node3 = new MeasurementNode(test_measurements[3], TSDataType.DOUBLE, TSEncoding.PLAIN, Compressor.SNAPPY); 23 | MeasurementNode node4 = new MeasurementNode(test_measurements[4], TSDataType.FLOAT, TSEncoding.PLAIN, Compressor.SNAPPY); 24 | 25 | Template template = new Template(test_template_name); 26 | template.addToTemplate(node1); 27 | template.addToTemplate(node2); 28 | template.addToTemplate(node3); 29 | template.addToTemplate(node4); 30 | 31 | status = await session_pool.CreateSchemaTemplateAsync(template); 32 | System.Diagnostics.Debug.Assert(status == 0); 33 | var templates = await session_pool.ShowAllTemplatesAsync(); 34 | foreach (var t in templates) 35 | { 36 | Console.WriteLine("template name :\t{0}", t); 37 | } 38 | status = await session_pool.DropSchemaTemplateAsync(test_template_name); 39 | System.Diagnostics.Debug.Assert(status == 0); 40 | status = await session_pool.DeleteStorageGroupAsync(test_group_name); 41 | await session_pool.Close(); 42 | Console.WriteLine("TestCreateAndDropSchemaTemplate Passed!"); 43 | } 44 | 45 | public async Task TestSetAndUnsetSchemaTemplate() 46 | { 47 | var session_pool = new SessionPool(host, port, pool_size); 48 | await session_pool.Open(false); 49 | if (debug) session_pool.OpenDebugMode(); 50 | 51 | System.Diagnostics.Debug.Assert(session_pool.IsOpen()); 52 | var status = 0; 53 | await session_pool.DeleteStorageGroupAsync(test_group_name); 54 | await session_pool.UnsetSchemaTemplateAsync(string.Format("{0}.{1}", test_group_name, test_device), "template"); 55 | await session_pool.DropSchemaTemplateAsync(test_template_name); 56 | 57 | MeasurementNode node1 = new MeasurementNode(test_measurements[1], TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY); 58 | MeasurementNode node2 = new MeasurementNode(test_measurements[2], TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY); 59 | MeasurementNode node3 = new MeasurementNode(test_measurements[3], TSDataType.DOUBLE, TSEncoding.PLAIN, Compressor.SNAPPY); 60 | MeasurementNode node4 = new MeasurementNode(test_measurements[4], TSDataType.FLOAT, TSEncoding.PLAIN, Compressor.SNAPPY); 61 | 62 | Template template = new Template(test_template_name); 63 | template.addToTemplate(node1); 64 | template.addToTemplate(node2); 65 | template.addToTemplate(node3); 66 | template.addToTemplate(node4); 67 | 68 | status = await session_pool.CreateSchemaTemplateAsync(template); 69 | System.Diagnostics.Debug.Assert(status == 0); 70 | status = await session_pool.SetSchemaTemplateAsync(test_template_name, string.Format("{0}.{1}", test_group_name, test_device)); 71 | var paths = await session_pool.ShowPathsTemplateSetOnAsync(test_template_name); 72 | foreach (var p in paths) 73 | { 74 | Console.WriteLine("path :\t{0}", p); 75 | } 76 | status = await session_pool.UnsetSchemaTemplateAsync(string.Format("{0}.{1}", test_group_name, test_device), test_template_name); 77 | status = await session_pool.DropSchemaTemplateAsync(test_template_name); 78 | System.Diagnostics.Debug.Assert(status == 0); 79 | status = await session_pool.DeleteStorageGroupAsync(test_group_name); 80 | await session_pool.Close(); 81 | Console.WriteLine("TestSetAndUnsetSchemaTemplate Passed!"); 82 | } 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /PUBLISH.md: -------------------------------------------------------------------------------- 1 | # Publish your own nuget package 2 | In this doc, we will introduce how to package and publish your own nuget package. Note that this will include the packaging and release of the two packages. 3 | 4 | ## Package 5 | ### Step 1: Rename 6 | Rename the following files/directories, where PACKAGE_NAME is the package name you expect. 7 | 8 | Note that this name should be unique, otherwise it will be rejected. You can search at [nuget.org](https://www.nuget.org/) to confirm whether the name is unique. 9 | - `./src/Apache.IoTDB` => `./src/PACKAGE_NAME` 10 | - `./src/Apache.IoTDB/Apache.IoTDB.csproj` => `./src/PACKAGE_NAME/PACKAGE_NAME.csproj` 11 | - `./src/Apache.IoTDB.Rpc.Generated` => `./src/PACKAGE_NAME.Rpc.Generated` 12 | - `./src/Apache.IoTDB.Rpc.Generated/Apache.IoTDB.Rpc.Generated.csproj` => `./src/PACKAGE_NAME.Rpc.Generated/PACKAGE_NAME.Rpc.Generated.csproj` 13 | 14 | Besides, you also need to modify the configuration in `./src/Apache.IoTDB/Apache.IoTDB.csproj` to ensure that the project references are correct. 15 | ``` xml 16 | 17 | ``` 18 | to 19 | ``` xml 20 | 21 | ``` 22 | 23 | ### Step 2: Add package information 24 | Modify `PACKAGE_NAME.csproj` to add package information, including version number, author, company, package description information, etc. 25 | 26 | The commonly used ones are as follows, you can find a complete list in [NuGet pack and restore as MSBuild targets](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target). 27 | 28 | - `Version`, a specific version number in the form Major.Minor.Patch\[-Suffix\] where -Suffix identifies [pre-release versions](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages). If not specified, the default value is 1.0.0. 29 | - `Authors`, author and owner information. If not specified, the default value is AssemblyName. 30 | - `Company`, your company name. If not specified, the default value is AssemblyName. 31 | - `PackageDescription`, A long description of the package for UI display. 32 | 33 | ``` xml 34 | 35 | 0.12.4 36 | Alice, Bob, Carol 37 | Test Inc. 38 | A test nuget package. 39 | 40 | ``` 41 | 42 | ### Step 3: Build package with dotnet pack 43 | Execute the following commands in the same directory of `PACKAGE_NAME.csproj` and `PACKAGE_NAME.Rpc.Generated.csproj` to pack. You can find the generated package file `PACKAGE_NAME.VERSION.nupkg` in `bin/`. 44 | 45 | #### Debug 46 | ``` bash 47 | dotnet pack PACKAGE_NAME.csproj --configuration debug 48 | ``` 49 | 50 | #### Release 51 | ``` bash 52 | dotnet pack PACKAGE_NAME.csproj --configuration release 53 | ``` 54 | 55 | ## Publish 56 | ### Web portal: use the Upload Package tab on nuget.org 57 | 1. Select Upload on the top menu of nuget.org and browse to the package location. 58 | ![](https://docs.microsoft.com/en-us/nuget/nuget-org/media/publish_uploadyourpackage.png) 59 | 60 | 2. nuget.org tells you if the package name is available. If it isn't, change the package identifier in your project, rebuild, and try the upload again. 61 | 62 | 3. If the package name is available, nuget.org opens a Verify section in which you can review the metadata from the package manifest. To change any of the metadata, edit your project (project file or `.nuspec` file), rebuild, recreate the package, and upload again. 63 | 64 | 4. When all the information is ready, select the Submit button. 65 | 66 | ### Command line 67 | #### Step 1: Sign in & Create API keys 68 | 1. [Sign into your nuget.org](https://www.nuget.org/) account or create an account if you don't have one already. 69 | 70 | 2. Select your user name (on the upper right), then select **API Keys**. 71 | 72 | 3. Select **Create**, provide a name for your key, select **Select Scopes > Push**. Enter **\*** for **Glob pattern**, then select **Create**. (See below for more about scopes.) 73 | 74 | 4. Once the key is created, select **Copy** to retrieve the access key you need in the CLI: 75 | ![](https://docs.microsoft.com/en-us/nuget/quickstart/media/qs_create-02-apikey.png) 76 | 77 | 5. **Important**: Save your key in a secure location because you cannot copy the key again later on. If you return to the API key page, you need to regenerate the key to copy it. You can also remove the API key if you no longer want to push packages via the CLI. 78 | 79 | #### Step 2: Publish with dotnet nuget push 80 | 1. Change to the directory containing the `.nupkg` file (`bin/Debug/` or `bin/Release/`). 81 | 2. Execute the following command, specifying your package name and replacing the key value with your API key: 82 | ``` .NET CLI 83 | dotnet nuget push PACKAGE_NAME.VERSION.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json 84 | ``` 85 | 86 | ## References 87 | [MS Docs: Create a NuGet package](https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package-dotnet-cli) 88 | 89 | [MS Docs: Publishing packages](https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package) 90 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TConsensusGroupId.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TConsensusGroupId : TBase 33 | { 34 | 35 | /// 36 | /// 37 | /// 38 | /// 39 | public TConsensusGroupType Type { get; set; } 40 | 41 | public int Id { get; set; } 42 | 43 | public TConsensusGroupId() 44 | { 45 | } 46 | 47 | public TConsensusGroupId(TConsensusGroupType type, int id) : this() 48 | { 49 | this.Type = type; 50 | this.Id = id; 51 | } 52 | 53 | public TConsensusGroupId DeepCopy() 54 | { 55 | var tmp8 = new TConsensusGroupId(); 56 | tmp8.Type = this.Type; 57 | tmp8.Id = this.Id; 58 | return tmp8; 59 | } 60 | 61 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 62 | { 63 | iprot.IncrementRecursionDepth(); 64 | try 65 | { 66 | bool isset_type = false; 67 | bool isset_id = false; 68 | TField field; 69 | await iprot.ReadStructBeginAsync(cancellationToken); 70 | while (true) 71 | { 72 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 73 | if (field.Type == TType.Stop) 74 | { 75 | break; 76 | } 77 | 78 | switch (field.ID) 79 | { 80 | case 1: 81 | if (field.Type == TType.I32) 82 | { 83 | Type = (TConsensusGroupType)await iprot.ReadI32Async(cancellationToken); 84 | isset_type = true; 85 | } 86 | else 87 | { 88 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 89 | } 90 | break; 91 | case 2: 92 | if (field.Type == TType.I32) 93 | { 94 | Id = await iprot.ReadI32Async(cancellationToken); 95 | isset_id = true; 96 | } 97 | else 98 | { 99 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 100 | } 101 | break; 102 | default: 103 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 104 | break; 105 | } 106 | 107 | await iprot.ReadFieldEndAsync(cancellationToken); 108 | } 109 | 110 | await iprot.ReadStructEndAsync(cancellationToken); 111 | if (!isset_type) 112 | { 113 | throw new TProtocolException(TProtocolException.INVALID_DATA); 114 | } 115 | if (!isset_id) 116 | { 117 | throw new TProtocolException(TProtocolException.INVALID_DATA); 118 | } 119 | } 120 | finally 121 | { 122 | iprot.DecrementRecursionDepth(); 123 | } 124 | } 125 | 126 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 127 | { 128 | oprot.IncrementRecursionDepth(); 129 | try 130 | { 131 | var struc = new TStruct("TConsensusGroupId"); 132 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 133 | var field = new TField(); 134 | field.Name = "type"; 135 | field.Type = TType.I32; 136 | field.ID = 1; 137 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 138 | await oprot.WriteI32Async((int)Type, cancellationToken); 139 | await oprot.WriteFieldEndAsync(cancellationToken); 140 | field.Name = "id"; 141 | field.Type = TType.I32; 142 | field.ID = 2; 143 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 144 | await oprot.WriteI32Async(Id, cancellationToken); 145 | await oprot.WriteFieldEndAsync(cancellationToken); 146 | await oprot.WriteFieldStopAsync(cancellationToken); 147 | await oprot.WriteStructEndAsync(cancellationToken); 148 | } 149 | finally 150 | { 151 | oprot.DecrementRecursionDepth(); 152 | } 153 | } 154 | 155 | public override bool Equals(object that) 156 | { 157 | if (!(that is TConsensusGroupId other)) return false; 158 | if (ReferenceEquals(this, other)) return true; 159 | return System.Object.Equals(Type, other.Type) 160 | && System.Object.Equals(Id, other.Id); 161 | } 162 | 163 | public override int GetHashCode() { 164 | int hashcode = 157; 165 | unchecked { 166 | hashcode = (hashcode * 397) + Type.GetHashCode(); 167 | hashcode = (hashcode * 397) + Id.GetHashCode(); 168 | } 169 | return hashcode; 170 | } 171 | 172 | public override string ToString() 173 | { 174 | var sb = new StringBuilder("TConsensusGroupId("); 175 | sb.Append(", Type: "); 176 | Type.ToString(sb); 177 | sb.Append(", Id: "); 178 | Id.ToString(sb); 179 | sb.Append(')'); 180 | return sb.ToString(); 181 | } 182 | } 183 | 184 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TEndPoint.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TEndPoint : TBase 33 | { 34 | 35 | public string Ip { get; set; } 36 | 37 | public int Port { get; set; } 38 | 39 | public TEndPoint() 40 | { 41 | } 42 | 43 | public TEndPoint(string ip, int port) : this() 44 | { 45 | this.Ip = ip; 46 | this.Port = port; 47 | } 48 | 49 | public TEndPoint DeepCopy() 50 | { 51 | var tmp0 = new TEndPoint(); 52 | if((Ip != null)) 53 | { 54 | tmp0.Ip = this.Ip; 55 | } 56 | tmp0.Port = this.Port; 57 | return tmp0; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_ip = false; 66 | bool isset_port = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.String) 81 | { 82 | Ip = await iprot.ReadStringAsync(cancellationToken); 83 | isset_ip = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.I32) 92 | { 93 | Port = await iprot.ReadI32Async(cancellationToken); 94 | isset_port = true; 95 | } 96 | else 97 | { 98 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 99 | } 100 | break; 101 | default: 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | break; 104 | } 105 | 106 | await iprot.ReadFieldEndAsync(cancellationToken); 107 | } 108 | 109 | await iprot.ReadStructEndAsync(cancellationToken); 110 | if (!isset_ip) 111 | { 112 | throw new TProtocolException(TProtocolException.INVALID_DATA); 113 | } 114 | if (!isset_port) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | } 119 | finally 120 | { 121 | iprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 126 | { 127 | oprot.IncrementRecursionDepth(); 128 | try 129 | { 130 | var struc = new TStruct("TEndPoint"); 131 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 132 | var field = new TField(); 133 | if((Ip != null)) 134 | { 135 | field.Name = "ip"; 136 | field.Type = TType.String; 137 | field.ID = 1; 138 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 139 | await oprot.WriteStringAsync(Ip, cancellationToken); 140 | await oprot.WriteFieldEndAsync(cancellationToken); 141 | } 142 | field.Name = "port"; 143 | field.Type = TType.I32; 144 | field.ID = 2; 145 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 146 | await oprot.WriteI32Async(Port, cancellationToken); 147 | await oprot.WriteFieldEndAsync(cancellationToken); 148 | await oprot.WriteFieldStopAsync(cancellationToken); 149 | await oprot.WriteStructEndAsync(cancellationToken); 150 | } 151 | finally 152 | { 153 | oprot.DecrementRecursionDepth(); 154 | } 155 | } 156 | 157 | public override bool Equals(object that) 158 | { 159 | if (!(that is TEndPoint other)) return false; 160 | if (ReferenceEquals(this, other)) return true; 161 | return System.Object.Equals(Ip, other.Ip) 162 | && System.Object.Equals(Port, other.Port); 163 | } 164 | 165 | public override int GetHashCode() { 166 | int hashcode = 157; 167 | unchecked { 168 | if((Ip != null)) 169 | { 170 | hashcode = (hashcode * 397) + Ip.GetHashCode(); 171 | } 172 | hashcode = (hashcode * 397) + Port.GetHashCode(); 173 | } 174 | return hashcode; 175 | } 176 | 177 | public override string ToString() 178 | { 179 | var sb = new StringBuilder("TEndPoint("); 180 | if((Ip != null)) 181 | { 182 | sb.Append(", Ip: "); 183 | Ip.ToString(sb); 184 | } 185 | sb.Append(", Port: "); 186 | Port.ToString(sb); 187 | sb.Append(')'); 188 | return sb.ToString(); 189 | } 190 | } 191 | 192 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TNodeResource.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TNodeResource : TBase 33 | { 34 | 35 | public int CpuCoreNum { get; set; } 36 | 37 | public long MaxMemory { get; set; } 38 | 39 | public TNodeResource() 40 | { 41 | } 42 | 43 | public TNodeResource(int cpuCoreNum, long maxMemory) : this() 44 | { 45 | this.CpuCoreNum = cpuCoreNum; 46 | this.MaxMemory = maxMemory; 47 | } 48 | 49 | public TNodeResource DeepCopy() 50 | { 51 | var tmp20 = new TNodeResource(); 52 | tmp20.CpuCoreNum = this.CpuCoreNum; 53 | tmp20.MaxMemory = this.MaxMemory; 54 | return tmp20; 55 | } 56 | 57 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 58 | { 59 | iprot.IncrementRecursionDepth(); 60 | try 61 | { 62 | bool isset_cpuCoreNum = false; 63 | bool isset_maxMemory = false; 64 | TField field; 65 | await iprot.ReadStructBeginAsync(cancellationToken); 66 | while (true) 67 | { 68 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 69 | if (field.Type == TType.Stop) 70 | { 71 | break; 72 | } 73 | 74 | switch (field.ID) 75 | { 76 | case 1: 77 | if (field.Type == TType.I32) 78 | { 79 | CpuCoreNum = await iprot.ReadI32Async(cancellationToken); 80 | isset_cpuCoreNum = true; 81 | } 82 | else 83 | { 84 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 85 | } 86 | break; 87 | case 2: 88 | if (field.Type == TType.I64) 89 | { 90 | MaxMemory = await iprot.ReadI64Async(cancellationToken); 91 | isset_maxMemory = true; 92 | } 93 | else 94 | { 95 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 96 | } 97 | break; 98 | default: 99 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 100 | break; 101 | } 102 | 103 | await iprot.ReadFieldEndAsync(cancellationToken); 104 | } 105 | 106 | await iprot.ReadStructEndAsync(cancellationToken); 107 | if (!isset_cpuCoreNum) 108 | { 109 | throw new TProtocolException(TProtocolException.INVALID_DATA); 110 | } 111 | if (!isset_maxMemory) 112 | { 113 | throw new TProtocolException(TProtocolException.INVALID_DATA); 114 | } 115 | } 116 | finally 117 | { 118 | iprot.DecrementRecursionDepth(); 119 | } 120 | } 121 | 122 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 123 | { 124 | oprot.IncrementRecursionDepth(); 125 | try 126 | { 127 | var struc = new TStruct("TNodeResource"); 128 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 129 | var field = new TField(); 130 | field.Name = "cpuCoreNum"; 131 | field.Type = TType.I32; 132 | field.ID = 1; 133 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 134 | await oprot.WriteI32Async(CpuCoreNum, cancellationToken); 135 | await oprot.WriteFieldEndAsync(cancellationToken); 136 | field.Name = "maxMemory"; 137 | field.Type = TType.I64; 138 | field.ID = 2; 139 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 140 | await oprot.WriteI64Async(MaxMemory, cancellationToken); 141 | await oprot.WriteFieldEndAsync(cancellationToken); 142 | await oprot.WriteFieldStopAsync(cancellationToken); 143 | await oprot.WriteStructEndAsync(cancellationToken); 144 | } 145 | finally 146 | { 147 | oprot.DecrementRecursionDepth(); 148 | } 149 | } 150 | 151 | public override bool Equals(object that) 152 | { 153 | if (!(that is TNodeResource other)) return false; 154 | if (ReferenceEquals(this, other)) return true; 155 | return System.Object.Equals(CpuCoreNum, other.CpuCoreNum) 156 | && System.Object.Equals(MaxMemory, other.MaxMemory); 157 | } 158 | 159 | public override int GetHashCode() { 160 | int hashcode = 157; 161 | unchecked { 162 | hashcode = (hashcode * 397) + CpuCoreNum.GetHashCode(); 163 | hashcode = (hashcode * 397) + MaxMemory.GetHashCode(); 164 | } 165 | return hashcode; 166 | } 167 | 168 | public override string ToString() 169 | { 170 | var sb = new StringBuilder("TNodeResource("); 171 | sb.Append(", CpuCoreNum: "); 172 | CpuCoreNum.ToString(sb); 173 | sb.Append(", MaxMemory: "); 174 | MaxMemory.ToString(sb); 175 | sb.Append(')'); 176 | return sb.ToString(); 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSCancelOperationReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSCancelOperationReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public long QueryId { get; set; } 38 | 39 | public TSCancelOperationReq() 40 | { 41 | } 42 | 43 | public TSCancelOperationReq(long sessionId, long queryId) : this() 44 | { 45 | this.SessionId = sessionId; 46 | this.QueryId = queryId; 47 | } 48 | 49 | public TSCancelOperationReq DeepCopy() 50 | { 51 | var tmp83 = new TSCancelOperationReq(); 52 | tmp83.SessionId = this.SessionId; 53 | tmp83.QueryId = this.QueryId; 54 | return tmp83; 55 | } 56 | 57 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 58 | { 59 | iprot.IncrementRecursionDepth(); 60 | try 61 | { 62 | bool isset_sessionId = false; 63 | bool isset_queryId = false; 64 | TField field; 65 | await iprot.ReadStructBeginAsync(cancellationToken); 66 | while (true) 67 | { 68 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 69 | if (field.Type == TType.Stop) 70 | { 71 | break; 72 | } 73 | 74 | switch (field.ID) 75 | { 76 | case 1: 77 | if (field.Type == TType.I64) 78 | { 79 | SessionId = await iprot.ReadI64Async(cancellationToken); 80 | isset_sessionId = true; 81 | } 82 | else 83 | { 84 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 85 | } 86 | break; 87 | case 2: 88 | if (field.Type == TType.I64) 89 | { 90 | QueryId = await iprot.ReadI64Async(cancellationToken); 91 | isset_queryId = true; 92 | } 93 | else 94 | { 95 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 96 | } 97 | break; 98 | default: 99 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 100 | break; 101 | } 102 | 103 | await iprot.ReadFieldEndAsync(cancellationToken); 104 | } 105 | 106 | await iprot.ReadStructEndAsync(cancellationToken); 107 | if (!isset_sessionId) 108 | { 109 | throw new TProtocolException(TProtocolException.INVALID_DATA); 110 | } 111 | if (!isset_queryId) 112 | { 113 | throw new TProtocolException(TProtocolException.INVALID_DATA); 114 | } 115 | } 116 | finally 117 | { 118 | iprot.DecrementRecursionDepth(); 119 | } 120 | } 121 | 122 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 123 | { 124 | oprot.IncrementRecursionDepth(); 125 | try 126 | { 127 | var struc = new TStruct("TSCancelOperationReq"); 128 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 129 | var field = new TField(); 130 | field.Name = "sessionId"; 131 | field.Type = TType.I64; 132 | field.ID = 1; 133 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 134 | await oprot.WriteI64Async(SessionId, cancellationToken); 135 | await oprot.WriteFieldEndAsync(cancellationToken); 136 | field.Name = "queryId"; 137 | field.Type = TType.I64; 138 | field.ID = 2; 139 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 140 | await oprot.WriteI64Async(QueryId, cancellationToken); 141 | await oprot.WriteFieldEndAsync(cancellationToken); 142 | await oprot.WriteFieldStopAsync(cancellationToken); 143 | await oprot.WriteStructEndAsync(cancellationToken); 144 | } 145 | finally 146 | { 147 | oprot.DecrementRecursionDepth(); 148 | } 149 | } 150 | 151 | public override bool Equals(object that) 152 | { 153 | if (!(that is TSCancelOperationReq other)) return false; 154 | if (ReferenceEquals(this, other)) return true; 155 | return System.Object.Equals(SessionId, other.SessionId) 156 | && System.Object.Equals(QueryId, other.QueryId); 157 | } 158 | 159 | public override int GetHashCode() { 160 | int hashcode = 157; 161 | unchecked { 162 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 163 | hashcode = (hashcode * 397) + QueryId.GetHashCode(); 164 | } 165 | return hashcode; 166 | } 167 | 168 | public override string ToString() 169 | { 170 | var sb = new StringBuilder("TSCancelOperationReq("); 171 | sb.Append(", SessionId: "); 172 | SessionId.ToString(sb); 173 | sb.Append(", QueryId: "); 174 | QueryId.ToString(sb); 175 | sb.Append(')'); 176 | return sb.ToString(); 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSGetOperationStatusReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSGetOperationStatusReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public long QueryId { get; set; } 38 | 39 | public TSGetOperationStatusReq() 40 | { 41 | } 42 | 43 | public TSGetOperationStatusReq(long sessionId, long queryId) : this() 44 | { 45 | this.SessionId = sessionId; 46 | this.QueryId = queryId; 47 | } 48 | 49 | public TSGetOperationStatusReq DeepCopy() 50 | { 51 | var tmp81 = new TSGetOperationStatusReq(); 52 | tmp81.SessionId = this.SessionId; 53 | tmp81.QueryId = this.QueryId; 54 | return tmp81; 55 | } 56 | 57 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 58 | { 59 | iprot.IncrementRecursionDepth(); 60 | try 61 | { 62 | bool isset_sessionId = false; 63 | bool isset_queryId = false; 64 | TField field; 65 | await iprot.ReadStructBeginAsync(cancellationToken); 66 | while (true) 67 | { 68 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 69 | if (field.Type == TType.Stop) 70 | { 71 | break; 72 | } 73 | 74 | switch (field.ID) 75 | { 76 | case 1: 77 | if (field.Type == TType.I64) 78 | { 79 | SessionId = await iprot.ReadI64Async(cancellationToken); 80 | isset_sessionId = true; 81 | } 82 | else 83 | { 84 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 85 | } 86 | break; 87 | case 2: 88 | if (field.Type == TType.I64) 89 | { 90 | QueryId = await iprot.ReadI64Async(cancellationToken); 91 | isset_queryId = true; 92 | } 93 | else 94 | { 95 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 96 | } 97 | break; 98 | default: 99 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 100 | break; 101 | } 102 | 103 | await iprot.ReadFieldEndAsync(cancellationToken); 104 | } 105 | 106 | await iprot.ReadStructEndAsync(cancellationToken); 107 | if (!isset_sessionId) 108 | { 109 | throw new TProtocolException(TProtocolException.INVALID_DATA); 110 | } 111 | if (!isset_queryId) 112 | { 113 | throw new TProtocolException(TProtocolException.INVALID_DATA); 114 | } 115 | } 116 | finally 117 | { 118 | iprot.DecrementRecursionDepth(); 119 | } 120 | } 121 | 122 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 123 | { 124 | oprot.IncrementRecursionDepth(); 125 | try 126 | { 127 | var struc = new TStruct("TSGetOperationStatusReq"); 128 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 129 | var field = new TField(); 130 | field.Name = "sessionId"; 131 | field.Type = TType.I64; 132 | field.ID = 1; 133 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 134 | await oprot.WriteI64Async(SessionId, cancellationToken); 135 | await oprot.WriteFieldEndAsync(cancellationToken); 136 | field.Name = "queryId"; 137 | field.Type = TType.I64; 138 | field.ID = 2; 139 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 140 | await oprot.WriteI64Async(QueryId, cancellationToken); 141 | await oprot.WriteFieldEndAsync(cancellationToken); 142 | await oprot.WriteFieldStopAsync(cancellationToken); 143 | await oprot.WriteStructEndAsync(cancellationToken); 144 | } 145 | finally 146 | { 147 | oprot.DecrementRecursionDepth(); 148 | } 149 | } 150 | 151 | public override bool Equals(object that) 152 | { 153 | if (!(that is TSGetOperationStatusReq other)) return false; 154 | if (ReferenceEquals(this, other)) return true; 155 | return System.Object.Equals(SessionId, other.SessionId) 156 | && System.Object.Equals(QueryId, other.QueryId); 157 | } 158 | 159 | public override int GetHashCode() { 160 | int hashcode = 157; 161 | unchecked { 162 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 163 | hashcode = (hashcode * 397) + QueryId.GetHashCode(); 164 | } 165 | return hashcode; 166 | } 167 | 168 | public override string ToString() 169 | { 170 | var sb = new StringBuilder("TSGetOperationStatusReq("); 171 | sb.Append(", SessionId: "); 172 | SessionId.ToString(sb); 173 | sb.Append(", QueryId: "); 174 | QueryId.ToString(sb); 175 | sb.Append(')'); 176 | return sb.ToString(); 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSConnectionInfoResp.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSConnectionInfoResp : TBase 33 | { 34 | 35 | public List ConnectionInfoList { get; set; } 36 | 37 | public TSConnectionInfoResp() 38 | { 39 | } 40 | 41 | public TSConnectionInfoResp(List connectionInfoList) : this() 42 | { 43 | this.ConnectionInfoList = connectionInfoList; 44 | } 45 | 46 | public TSConnectionInfoResp DeepCopy() 47 | { 48 | var tmp429 = new TSConnectionInfoResp(); 49 | if((ConnectionInfoList != null)) 50 | { 51 | tmp429.ConnectionInfoList = this.ConnectionInfoList.DeepCopy(); 52 | } 53 | return tmp429; 54 | } 55 | 56 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 57 | { 58 | iprot.IncrementRecursionDepth(); 59 | try 60 | { 61 | bool isset_connectionInfoList = false; 62 | TField field; 63 | await iprot.ReadStructBeginAsync(cancellationToken); 64 | while (true) 65 | { 66 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 67 | if (field.Type == TType.Stop) 68 | { 69 | break; 70 | } 71 | 72 | switch (field.ID) 73 | { 74 | case 1: 75 | if (field.Type == TType.List) 76 | { 77 | { 78 | TList _list430 = await iprot.ReadListBeginAsync(cancellationToken); 79 | ConnectionInfoList = new List(_list430.Count); 80 | for(int _i431 = 0; _i431 < _list430.Count; ++_i431) 81 | { 82 | TSConnectionInfo _elem432; 83 | _elem432 = new TSConnectionInfo(); 84 | await _elem432.ReadAsync(iprot, cancellationToken); 85 | ConnectionInfoList.Add(_elem432); 86 | } 87 | await iprot.ReadListEndAsync(cancellationToken); 88 | } 89 | isset_connectionInfoList = true; 90 | } 91 | else 92 | { 93 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 94 | } 95 | break; 96 | default: 97 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 98 | break; 99 | } 100 | 101 | await iprot.ReadFieldEndAsync(cancellationToken); 102 | } 103 | 104 | await iprot.ReadStructEndAsync(cancellationToken); 105 | if (!isset_connectionInfoList) 106 | { 107 | throw new TProtocolException(TProtocolException.INVALID_DATA); 108 | } 109 | } 110 | finally 111 | { 112 | iprot.DecrementRecursionDepth(); 113 | } 114 | } 115 | 116 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 117 | { 118 | oprot.IncrementRecursionDepth(); 119 | try 120 | { 121 | var struc = new TStruct("TSConnectionInfoResp"); 122 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 123 | var field = new TField(); 124 | if((ConnectionInfoList != null)) 125 | { 126 | field.Name = "connectionInfoList"; 127 | field.Type = TType.List; 128 | field.ID = 1; 129 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 130 | { 131 | await oprot.WriteListBeginAsync(new TList(TType.Struct, ConnectionInfoList.Count), cancellationToken); 132 | foreach (TSConnectionInfo _iter433 in ConnectionInfoList) 133 | { 134 | await _iter433.WriteAsync(oprot, cancellationToken); 135 | } 136 | await oprot.WriteListEndAsync(cancellationToken); 137 | } 138 | await oprot.WriteFieldEndAsync(cancellationToken); 139 | } 140 | await oprot.WriteFieldStopAsync(cancellationToken); 141 | await oprot.WriteStructEndAsync(cancellationToken); 142 | } 143 | finally 144 | { 145 | oprot.DecrementRecursionDepth(); 146 | } 147 | } 148 | 149 | public override bool Equals(object that) 150 | { 151 | if (!(that is TSConnectionInfoResp other)) return false; 152 | if (ReferenceEquals(this, other)) return true; 153 | return TCollections.Equals(ConnectionInfoList, other.ConnectionInfoList); 154 | } 155 | 156 | public override int GetHashCode() { 157 | int hashcode = 157; 158 | unchecked { 159 | if((ConnectionInfoList != null)) 160 | { 161 | hashcode = (hashcode * 397) + TCollections.GetHashCode(ConnectionInfoList); 162 | } 163 | } 164 | return hashcode; 165 | } 166 | 167 | public override string ToString() 168 | { 169 | var sb = new StringBuilder("TSConnectionInfoResp("); 170 | if((ConnectionInfoList != null)) 171 | { 172 | sb.Append(", ConnectionInfoList: "); 173 | ConnectionInfoList.ToString(sb); 174 | } 175 | sb.Append(')'); 176 | return sb.ToString(); 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSchemaNode.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSchemaNode : TBase 33 | { 34 | 35 | public string NodeName { get; set; } 36 | 37 | public sbyte NodeType { get; set; } 38 | 39 | public TSchemaNode() 40 | { 41 | } 42 | 43 | public TSchemaNode(string nodeName, sbyte nodeType) : this() 44 | { 45 | this.NodeName = nodeName; 46 | this.NodeType = nodeType; 47 | } 48 | 49 | public TSchemaNode DeepCopy() 50 | { 51 | var tmp34 = new TSchemaNode(); 52 | if((NodeName != null)) 53 | { 54 | tmp34.NodeName = this.NodeName; 55 | } 56 | tmp34.NodeType = this.NodeType; 57 | return tmp34; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_nodeName = false; 66 | bool isset_nodeType = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.String) 81 | { 82 | NodeName = await iprot.ReadStringAsync(cancellationToken); 83 | isset_nodeName = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.Byte) 92 | { 93 | NodeType = await iprot.ReadByteAsync(cancellationToken); 94 | isset_nodeType = true; 95 | } 96 | else 97 | { 98 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 99 | } 100 | break; 101 | default: 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | break; 104 | } 105 | 106 | await iprot.ReadFieldEndAsync(cancellationToken); 107 | } 108 | 109 | await iprot.ReadStructEndAsync(cancellationToken); 110 | if (!isset_nodeName) 111 | { 112 | throw new TProtocolException(TProtocolException.INVALID_DATA); 113 | } 114 | if (!isset_nodeType) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | } 119 | finally 120 | { 121 | iprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 126 | { 127 | oprot.IncrementRecursionDepth(); 128 | try 129 | { 130 | var struc = new TStruct("TSchemaNode"); 131 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 132 | var field = new TField(); 133 | if((NodeName != null)) 134 | { 135 | field.Name = "nodeName"; 136 | field.Type = TType.String; 137 | field.ID = 1; 138 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 139 | await oprot.WriteStringAsync(NodeName, cancellationToken); 140 | await oprot.WriteFieldEndAsync(cancellationToken); 141 | } 142 | field.Name = "nodeType"; 143 | field.Type = TType.Byte; 144 | field.ID = 2; 145 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 146 | await oprot.WriteByteAsync(NodeType, cancellationToken); 147 | await oprot.WriteFieldEndAsync(cancellationToken); 148 | await oprot.WriteFieldStopAsync(cancellationToken); 149 | await oprot.WriteStructEndAsync(cancellationToken); 150 | } 151 | finally 152 | { 153 | oprot.DecrementRecursionDepth(); 154 | } 155 | } 156 | 157 | public override bool Equals(object that) 158 | { 159 | if (!(that is TSchemaNode other)) return false; 160 | if (ReferenceEquals(this, other)) return true; 161 | return System.Object.Equals(NodeName, other.NodeName) 162 | && System.Object.Equals(NodeType, other.NodeType); 163 | } 164 | 165 | public override int GetHashCode() { 166 | int hashcode = 157; 167 | unchecked { 168 | if((NodeName != null)) 169 | { 170 | hashcode = (hashcode * 397) + NodeName.GetHashCode(); 171 | } 172 | hashcode = (hashcode * 397) + NodeType.GetHashCode(); 173 | } 174 | return hashcode; 175 | } 176 | 177 | public override string ToString() 178 | { 179 | var sb = new StringBuilder("TSchemaNode("); 180 | if((NodeName != null)) 181 | { 182 | sb.Append(", NodeName: "); 183 | NodeName.ToString(sb); 184 | } 185 | sb.Append(", NodeType: "); 186 | NodeType.ToString(sb); 187 | sb.Append(')'); 188 | return sb.ToString(); 189 | } 190 | } 191 | 192 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSSetTimeZoneReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSSetTimeZoneReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public string TimeZone { get; set; } 38 | 39 | public TSSetTimeZoneReq() 40 | { 41 | } 42 | 43 | public TSSetTimeZoneReq(long sessionId, string timeZone) : this() 44 | { 45 | this.SessionId = sessionId; 46 | this.TimeZone = timeZone; 47 | } 48 | 49 | public TSSetTimeZoneReq DeepCopy() 50 | { 51 | var tmp105 = new TSSetTimeZoneReq(); 52 | tmp105.SessionId = this.SessionId; 53 | if((TimeZone != null)) 54 | { 55 | tmp105.TimeZone = this.TimeZone; 56 | } 57 | return tmp105; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_sessionId = false; 66 | bool isset_timeZone = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.I64) 81 | { 82 | SessionId = await iprot.ReadI64Async(cancellationToken); 83 | isset_sessionId = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.String) 92 | { 93 | TimeZone = await iprot.ReadStringAsync(cancellationToken); 94 | isset_timeZone = true; 95 | } 96 | else 97 | { 98 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 99 | } 100 | break; 101 | default: 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | break; 104 | } 105 | 106 | await iprot.ReadFieldEndAsync(cancellationToken); 107 | } 108 | 109 | await iprot.ReadStructEndAsync(cancellationToken); 110 | if (!isset_sessionId) 111 | { 112 | throw new TProtocolException(TProtocolException.INVALID_DATA); 113 | } 114 | if (!isset_timeZone) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | } 119 | finally 120 | { 121 | iprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 126 | { 127 | oprot.IncrementRecursionDepth(); 128 | try 129 | { 130 | var struc = new TStruct("TSSetTimeZoneReq"); 131 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 132 | var field = new TField(); 133 | field.Name = "sessionId"; 134 | field.Type = TType.I64; 135 | field.ID = 1; 136 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 137 | await oprot.WriteI64Async(SessionId, cancellationToken); 138 | await oprot.WriteFieldEndAsync(cancellationToken); 139 | if((TimeZone != null)) 140 | { 141 | field.Name = "timeZone"; 142 | field.Type = TType.String; 143 | field.ID = 2; 144 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 145 | await oprot.WriteStringAsync(TimeZone, cancellationToken); 146 | await oprot.WriteFieldEndAsync(cancellationToken); 147 | } 148 | await oprot.WriteFieldStopAsync(cancellationToken); 149 | await oprot.WriteStructEndAsync(cancellationToken); 150 | } 151 | finally 152 | { 153 | oprot.DecrementRecursionDepth(); 154 | } 155 | } 156 | 157 | public override bool Equals(object that) 158 | { 159 | if (!(that is TSSetTimeZoneReq other)) return false; 160 | if (ReferenceEquals(this, other)) return true; 161 | return System.Object.Equals(SessionId, other.SessionId) 162 | && System.Object.Equals(TimeZone, other.TimeZone); 163 | } 164 | 165 | public override int GetHashCode() { 166 | int hashcode = 157; 167 | unchecked { 168 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 169 | if((TimeZone != null)) 170 | { 171 | hashcode = (hashcode * 397) + TimeZone.GetHashCode(); 172 | } 173 | } 174 | return hashcode; 175 | } 176 | 177 | public override string ToString() 178 | { 179 | var sb = new StringBuilder("TSSetTimeZoneReq("); 180 | sb.Append(", SessionId: "); 181 | SessionId.ToString(sb); 182 | if((TimeZone != null)) 183 | { 184 | sb.Append(", TimeZone: "); 185 | TimeZone.ToString(sb); 186 | } 187 | sb.Append(')'); 188 | return sb.ToString(); 189 | } 190 | } 191 | 192 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSyncTransportMetaInfo.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSyncTransportMetaInfo : TBase 33 | { 34 | 35 | public string FileName { get; set; } 36 | 37 | public long StartIndex { get; set; } 38 | 39 | public TSyncTransportMetaInfo() 40 | { 41 | } 42 | 43 | public TSyncTransportMetaInfo(string fileName, long startIndex) : this() 44 | { 45 | this.FileName = fileName; 46 | this.StartIndex = startIndex; 47 | } 48 | 49 | public TSyncTransportMetaInfo DeepCopy() 50 | { 51 | var tmp423 = new TSyncTransportMetaInfo(); 52 | if((FileName != null)) 53 | { 54 | tmp423.FileName = this.FileName; 55 | } 56 | tmp423.StartIndex = this.StartIndex; 57 | return tmp423; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_fileName = false; 66 | bool isset_startIndex = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.String) 81 | { 82 | FileName = await iprot.ReadStringAsync(cancellationToken); 83 | isset_fileName = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.I64) 92 | { 93 | StartIndex = await iprot.ReadI64Async(cancellationToken); 94 | isset_startIndex = true; 95 | } 96 | else 97 | { 98 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 99 | } 100 | break; 101 | default: 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | break; 104 | } 105 | 106 | await iprot.ReadFieldEndAsync(cancellationToken); 107 | } 108 | 109 | await iprot.ReadStructEndAsync(cancellationToken); 110 | if (!isset_fileName) 111 | { 112 | throw new TProtocolException(TProtocolException.INVALID_DATA); 113 | } 114 | if (!isset_startIndex) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | } 119 | finally 120 | { 121 | iprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 126 | { 127 | oprot.IncrementRecursionDepth(); 128 | try 129 | { 130 | var struc = new TStruct("TSyncTransportMetaInfo"); 131 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 132 | var field = new TField(); 133 | if((FileName != null)) 134 | { 135 | field.Name = "fileName"; 136 | field.Type = TType.String; 137 | field.ID = 1; 138 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 139 | await oprot.WriteStringAsync(FileName, cancellationToken); 140 | await oprot.WriteFieldEndAsync(cancellationToken); 141 | } 142 | field.Name = "startIndex"; 143 | field.Type = TType.I64; 144 | field.ID = 2; 145 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 146 | await oprot.WriteI64Async(StartIndex, cancellationToken); 147 | await oprot.WriteFieldEndAsync(cancellationToken); 148 | await oprot.WriteFieldStopAsync(cancellationToken); 149 | await oprot.WriteStructEndAsync(cancellationToken); 150 | } 151 | finally 152 | { 153 | oprot.DecrementRecursionDepth(); 154 | } 155 | } 156 | 157 | public override bool Equals(object that) 158 | { 159 | if (!(that is TSyncTransportMetaInfo other)) return false; 160 | if (ReferenceEquals(this, other)) return true; 161 | return System.Object.Equals(FileName, other.FileName) 162 | && System.Object.Equals(StartIndex, other.StartIndex); 163 | } 164 | 165 | public override int GetHashCode() { 166 | int hashcode = 157; 167 | unchecked { 168 | if((FileName != null)) 169 | { 170 | hashcode = (hashcode * 397) + FileName.GetHashCode(); 171 | } 172 | hashcode = (hashcode * 397) + StartIndex.GetHashCode(); 173 | } 174 | return hashcode; 175 | } 176 | 177 | public override string ToString() 178 | { 179 | var sb = new StringBuilder("TSyncTransportMetaInfo("); 180 | if((FileName != null)) 181 | { 182 | sb.Append(", FileName: "); 183 | FileName.ToString(sb); 184 | } 185 | sb.Append(", StartIndex: "); 186 | StartIndex.ToString(sb); 187 | sb.Append(')'); 188 | return sb.ToString(); 189 | } 190 | } 191 | 192 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TFile.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TFile : TBase 33 | { 34 | 35 | public string FileName { get; set; } 36 | 37 | public byte[] File { get; set; } 38 | 39 | public TFile() 40 | { 41 | } 42 | 43 | public TFile(string fileName, byte[] file) : this() 44 | { 45 | this.FileName = fileName; 46 | this.File = file; 47 | } 48 | 49 | public TFile DeepCopy() 50 | { 51 | var tmp42 = new TFile(); 52 | if((FileName != null)) 53 | { 54 | tmp42.FileName = this.FileName; 55 | } 56 | if((File != null)) 57 | { 58 | tmp42.File = this.File.ToArray(); 59 | } 60 | return tmp42; 61 | } 62 | 63 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 64 | { 65 | iprot.IncrementRecursionDepth(); 66 | try 67 | { 68 | bool isset_fileName = false; 69 | bool isset_file = false; 70 | TField field; 71 | await iprot.ReadStructBeginAsync(cancellationToken); 72 | while (true) 73 | { 74 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 75 | if (field.Type == TType.Stop) 76 | { 77 | break; 78 | } 79 | 80 | switch (field.ID) 81 | { 82 | case 1: 83 | if (field.Type == TType.String) 84 | { 85 | FileName = await iprot.ReadStringAsync(cancellationToken); 86 | isset_fileName = true; 87 | } 88 | else 89 | { 90 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 91 | } 92 | break; 93 | case 2: 94 | if (field.Type == TType.String) 95 | { 96 | File = await iprot.ReadBinaryAsync(cancellationToken); 97 | isset_file = true; 98 | } 99 | else 100 | { 101 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 102 | } 103 | break; 104 | default: 105 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 106 | break; 107 | } 108 | 109 | await iprot.ReadFieldEndAsync(cancellationToken); 110 | } 111 | 112 | await iprot.ReadStructEndAsync(cancellationToken); 113 | if (!isset_fileName) 114 | { 115 | throw new TProtocolException(TProtocolException.INVALID_DATA); 116 | } 117 | if (!isset_file) 118 | { 119 | throw new TProtocolException(TProtocolException.INVALID_DATA); 120 | } 121 | } 122 | finally 123 | { 124 | iprot.DecrementRecursionDepth(); 125 | } 126 | } 127 | 128 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 129 | { 130 | oprot.IncrementRecursionDepth(); 131 | try 132 | { 133 | var struc = new TStruct("TFile"); 134 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 135 | var field = new TField(); 136 | if((FileName != null)) 137 | { 138 | field.Name = "fileName"; 139 | field.Type = TType.String; 140 | field.ID = 1; 141 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 142 | await oprot.WriteStringAsync(FileName, cancellationToken); 143 | await oprot.WriteFieldEndAsync(cancellationToken); 144 | } 145 | if((File != null)) 146 | { 147 | field.Name = "file"; 148 | field.Type = TType.String; 149 | field.ID = 2; 150 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 151 | await oprot.WriteBinaryAsync(File, cancellationToken); 152 | await oprot.WriteFieldEndAsync(cancellationToken); 153 | } 154 | await oprot.WriteFieldStopAsync(cancellationToken); 155 | await oprot.WriteStructEndAsync(cancellationToken); 156 | } 157 | finally 158 | { 159 | oprot.DecrementRecursionDepth(); 160 | } 161 | } 162 | 163 | public override bool Equals(object that) 164 | { 165 | if (!(that is TFile other)) return false; 166 | if (ReferenceEquals(this, other)) return true; 167 | return System.Object.Equals(FileName, other.FileName) 168 | && TCollections.Equals(File, other.File); 169 | } 170 | 171 | public override int GetHashCode() { 172 | int hashcode = 157; 173 | unchecked { 174 | if((FileName != null)) 175 | { 176 | hashcode = (hashcode * 397) + FileName.GetHashCode(); 177 | } 178 | if((File != null)) 179 | { 180 | hashcode = (hashcode * 397) + File.GetHashCode(); 181 | } 182 | } 183 | return hashcode; 184 | } 185 | 186 | public override string ToString() 187 | { 188 | var sb = new StringBuilder("TFile("); 189 | if((FileName != null)) 190 | { 191 | sb.Append(", FileName: "); 192 | FileName.ToString(sb); 193 | } 194 | if((File != null)) 195 | { 196 | sb.Append(", File: "); 197 | File.ToString(sb); 198 | } 199 | sb.Append(')'); 200 | return sb.ToString(); 201 | } 202 | } 203 | 204 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSDropSchemaTemplateReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSDropSchemaTemplateReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public string TemplateName { get; set; } 38 | 39 | public TSDropSchemaTemplateReq() 40 | { 41 | } 42 | 43 | public TSDropSchemaTemplateReq(long sessionId, string templateName) : this() 44 | { 45 | this.SessionId = sessionId; 46 | this.TemplateName = templateName; 47 | } 48 | 49 | public TSDropSchemaTemplateReq DeepCopy() 50 | { 51 | var tmp419 = new TSDropSchemaTemplateReq(); 52 | tmp419.SessionId = this.SessionId; 53 | if((TemplateName != null)) 54 | { 55 | tmp419.TemplateName = this.TemplateName; 56 | } 57 | return tmp419; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_sessionId = false; 66 | bool isset_templateName = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.I64) 81 | { 82 | SessionId = await iprot.ReadI64Async(cancellationToken); 83 | isset_sessionId = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.String) 92 | { 93 | TemplateName = await iprot.ReadStringAsync(cancellationToken); 94 | isset_templateName = true; 95 | } 96 | else 97 | { 98 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 99 | } 100 | break; 101 | default: 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | break; 104 | } 105 | 106 | await iprot.ReadFieldEndAsync(cancellationToken); 107 | } 108 | 109 | await iprot.ReadStructEndAsync(cancellationToken); 110 | if (!isset_sessionId) 111 | { 112 | throw new TProtocolException(TProtocolException.INVALID_DATA); 113 | } 114 | if (!isset_templateName) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | } 119 | finally 120 | { 121 | iprot.DecrementRecursionDepth(); 122 | } 123 | } 124 | 125 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 126 | { 127 | oprot.IncrementRecursionDepth(); 128 | try 129 | { 130 | var struc = new TStruct("TSDropSchemaTemplateReq"); 131 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 132 | var field = new TField(); 133 | field.Name = "sessionId"; 134 | field.Type = TType.I64; 135 | field.ID = 1; 136 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 137 | await oprot.WriteI64Async(SessionId, cancellationToken); 138 | await oprot.WriteFieldEndAsync(cancellationToken); 139 | if((TemplateName != null)) 140 | { 141 | field.Name = "templateName"; 142 | field.Type = TType.String; 143 | field.ID = 2; 144 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 145 | await oprot.WriteStringAsync(TemplateName, cancellationToken); 146 | await oprot.WriteFieldEndAsync(cancellationToken); 147 | } 148 | await oprot.WriteFieldStopAsync(cancellationToken); 149 | await oprot.WriteStructEndAsync(cancellationToken); 150 | } 151 | finally 152 | { 153 | oprot.DecrementRecursionDepth(); 154 | } 155 | } 156 | 157 | public override bool Equals(object that) 158 | { 159 | if (!(that is TSDropSchemaTemplateReq other)) return false; 160 | if (ReferenceEquals(this, other)) return true; 161 | return System.Object.Equals(SessionId, other.SessionId) 162 | && System.Object.Equals(TemplateName, other.TemplateName); 163 | } 164 | 165 | public override int GetHashCode() { 166 | int hashcode = 157; 167 | unchecked { 168 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 169 | if((TemplateName != null)) 170 | { 171 | hashcode = (hashcode * 397) + TemplateName.GetHashCode(); 172 | } 173 | } 174 | return hashcode; 175 | } 176 | 177 | public override string ToString() 178 | { 179 | var sb = new StringBuilder("TSDropSchemaTemplateReq("); 180 | sb.Append(", SessionId: "); 181 | SessionId.ToString(sb); 182 | if((TemplateName != null)) 183 | { 184 | sb.Append(", TemplateName: "); 185 | TemplateName.ToString(sb); 186 | } 187 | sb.Append(')'); 188 | return sb.ToString(); 189 | } 190 | } 191 | 192 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSGetTimeZoneResp.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSGetTimeZoneResp : TBase 33 | { 34 | 35 | public TSStatus Status { get; set; } 36 | 37 | public string TimeZone { get; set; } 38 | 39 | public TSGetTimeZoneResp() 40 | { 41 | } 42 | 43 | public TSGetTimeZoneResp(TSStatus status, string timeZone) : this() 44 | { 45 | this.Status = status; 46 | this.TimeZone = timeZone; 47 | } 48 | 49 | public TSGetTimeZoneResp DeepCopy() 50 | { 51 | var tmp103 = new TSGetTimeZoneResp(); 52 | if((Status != null)) 53 | { 54 | tmp103.Status = (TSStatus)this.Status.DeepCopy(); 55 | } 56 | if((TimeZone != null)) 57 | { 58 | tmp103.TimeZone = this.TimeZone; 59 | } 60 | return tmp103; 61 | } 62 | 63 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 64 | { 65 | iprot.IncrementRecursionDepth(); 66 | try 67 | { 68 | bool isset_status = false; 69 | bool isset_timeZone = false; 70 | TField field; 71 | await iprot.ReadStructBeginAsync(cancellationToken); 72 | while (true) 73 | { 74 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 75 | if (field.Type == TType.Stop) 76 | { 77 | break; 78 | } 79 | 80 | switch (field.ID) 81 | { 82 | case 1: 83 | if (field.Type == TType.Struct) 84 | { 85 | Status = new TSStatus(); 86 | await Status.ReadAsync(iprot, cancellationToken); 87 | isset_status = true; 88 | } 89 | else 90 | { 91 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 92 | } 93 | break; 94 | case 2: 95 | if (field.Type == TType.String) 96 | { 97 | TimeZone = await iprot.ReadStringAsync(cancellationToken); 98 | isset_timeZone = true; 99 | } 100 | else 101 | { 102 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 103 | } 104 | break; 105 | default: 106 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 107 | break; 108 | } 109 | 110 | await iprot.ReadFieldEndAsync(cancellationToken); 111 | } 112 | 113 | await iprot.ReadStructEndAsync(cancellationToken); 114 | if (!isset_status) 115 | { 116 | throw new TProtocolException(TProtocolException.INVALID_DATA); 117 | } 118 | if (!isset_timeZone) 119 | { 120 | throw new TProtocolException(TProtocolException.INVALID_DATA); 121 | } 122 | } 123 | finally 124 | { 125 | iprot.DecrementRecursionDepth(); 126 | } 127 | } 128 | 129 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 130 | { 131 | oprot.IncrementRecursionDepth(); 132 | try 133 | { 134 | var struc = new TStruct("TSGetTimeZoneResp"); 135 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 136 | var field = new TField(); 137 | if((Status != null)) 138 | { 139 | field.Name = "status"; 140 | field.Type = TType.Struct; 141 | field.ID = 1; 142 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 143 | await Status.WriteAsync(oprot, cancellationToken); 144 | await oprot.WriteFieldEndAsync(cancellationToken); 145 | } 146 | if((TimeZone != null)) 147 | { 148 | field.Name = "timeZone"; 149 | field.Type = TType.String; 150 | field.ID = 2; 151 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 152 | await oprot.WriteStringAsync(TimeZone, cancellationToken); 153 | await oprot.WriteFieldEndAsync(cancellationToken); 154 | } 155 | await oprot.WriteFieldStopAsync(cancellationToken); 156 | await oprot.WriteStructEndAsync(cancellationToken); 157 | } 158 | finally 159 | { 160 | oprot.DecrementRecursionDepth(); 161 | } 162 | } 163 | 164 | public override bool Equals(object that) 165 | { 166 | if (!(that is TSGetTimeZoneResp other)) return false; 167 | if (ReferenceEquals(this, other)) return true; 168 | return System.Object.Equals(Status, other.Status) 169 | && System.Object.Equals(TimeZone, other.TimeZone); 170 | } 171 | 172 | public override int GetHashCode() { 173 | int hashcode = 157; 174 | unchecked { 175 | if((Status != null)) 176 | { 177 | hashcode = (hashcode * 397) + Status.GetHashCode(); 178 | } 179 | if((TimeZone != null)) 180 | { 181 | hashcode = (hashcode * 397) + TimeZone.GetHashCode(); 182 | } 183 | } 184 | return hashcode; 185 | } 186 | 187 | public override string ToString() 188 | { 189 | var sb = new StringBuilder("TSGetTimeZoneResp("); 190 | if((Status != null)) 191 | { 192 | sb.Append(", Status: "); 193 | Status.ToString(sb); 194 | } 195 | if((TimeZone != null)) 196 | { 197 | sb.Append(", TimeZone: "); 198 | TimeZone.ToString(sb); 199 | } 200 | sb.Append(')'); 201 | return sb.ToString(); 202 | } 203 | } 204 | 205 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TDataNodeConfiguration.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TDataNodeConfiguration : TBase 33 | { 34 | 35 | public TDataNodeLocation Location { get; set; } 36 | 37 | public TNodeResource Resource { get; set; } 38 | 39 | public TDataNodeConfiguration() 40 | { 41 | } 42 | 43 | public TDataNodeConfiguration(TDataNodeLocation location, TNodeResource resource) : this() 44 | { 45 | this.Location = location; 46 | this.Resource = resource; 47 | } 48 | 49 | public TDataNodeConfiguration DeepCopy() 50 | { 51 | var tmp26 = new TDataNodeConfiguration(); 52 | if((Location != null)) 53 | { 54 | tmp26.Location = (TDataNodeLocation)this.Location.DeepCopy(); 55 | } 56 | if((Resource != null)) 57 | { 58 | tmp26.Resource = (TNodeResource)this.Resource.DeepCopy(); 59 | } 60 | return tmp26; 61 | } 62 | 63 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 64 | { 65 | iprot.IncrementRecursionDepth(); 66 | try 67 | { 68 | bool isset_location = false; 69 | bool isset_resource = false; 70 | TField field; 71 | await iprot.ReadStructBeginAsync(cancellationToken); 72 | while (true) 73 | { 74 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 75 | if (field.Type == TType.Stop) 76 | { 77 | break; 78 | } 79 | 80 | switch (field.ID) 81 | { 82 | case 1: 83 | if (field.Type == TType.Struct) 84 | { 85 | Location = new TDataNodeLocation(); 86 | await Location.ReadAsync(iprot, cancellationToken); 87 | isset_location = true; 88 | } 89 | else 90 | { 91 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 92 | } 93 | break; 94 | case 2: 95 | if (field.Type == TType.Struct) 96 | { 97 | Resource = new TNodeResource(); 98 | await Resource.ReadAsync(iprot, cancellationToken); 99 | isset_resource = true; 100 | } 101 | else 102 | { 103 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 104 | } 105 | break; 106 | default: 107 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 108 | break; 109 | } 110 | 111 | await iprot.ReadFieldEndAsync(cancellationToken); 112 | } 113 | 114 | await iprot.ReadStructEndAsync(cancellationToken); 115 | if (!isset_location) 116 | { 117 | throw new TProtocolException(TProtocolException.INVALID_DATA); 118 | } 119 | if (!isset_resource) 120 | { 121 | throw new TProtocolException(TProtocolException.INVALID_DATA); 122 | } 123 | } 124 | finally 125 | { 126 | iprot.DecrementRecursionDepth(); 127 | } 128 | } 129 | 130 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 131 | { 132 | oprot.IncrementRecursionDepth(); 133 | try 134 | { 135 | var struc = new TStruct("TDataNodeConfiguration"); 136 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 137 | var field = new TField(); 138 | if((Location != null)) 139 | { 140 | field.Name = "location"; 141 | field.Type = TType.Struct; 142 | field.ID = 1; 143 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 144 | await Location.WriteAsync(oprot, cancellationToken); 145 | await oprot.WriteFieldEndAsync(cancellationToken); 146 | } 147 | if((Resource != null)) 148 | { 149 | field.Name = "resource"; 150 | field.Type = TType.Struct; 151 | field.ID = 2; 152 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 153 | await Resource.WriteAsync(oprot, cancellationToken); 154 | await oprot.WriteFieldEndAsync(cancellationToken); 155 | } 156 | await oprot.WriteFieldStopAsync(cancellationToken); 157 | await oprot.WriteStructEndAsync(cancellationToken); 158 | } 159 | finally 160 | { 161 | oprot.DecrementRecursionDepth(); 162 | } 163 | } 164 | 165 | public override bool Equals(object that) 166 | { 167 | if (!(that is TDataNodeConfiguration other)) return false; 168 | if (ReferenceEquals(this, other)) return true; 169 | return System.Object.Equals(Location, other.Location) 170 | && System.Object.Equals(Resource, other.Resource); 171 | } 172 | 173 | public override int GetHashCode() { 174 | int hashcode = 157; 175 | unchecked { 176 | if((Location != null)) 177 | { 178 | hashcode = (hashcode * 397) + Location.GetHashCode(); 179 | } 180 | if((Resource != null)) 181 | { 182 | hashcode = (hashcode * 397) + Resource.GetHashCode(); 183 | } 184 | } 185 | return hashcode; 186 | } 187 | 188 | public override string ToString() 189 | { 190 | var sb = new StringBuilder("TDataNodeConfiguration("); 191 | if((Location != null)) 192 | { 193 | sb.Append(", Location: "); 194 | Location.ToString(sb); 195 | } 196 | if((Resource != null)) 197 | { 198 | sb.Append(", Resource: "); 199 | Resource.ToString(sb); 200 | } 201 | sb.Append(')'); 202 | return sb.ToString(); 203 | } 204 | } 205 | 206 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSExecuteBatchStatementReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSExecuteBatchStatementReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public List Statements { get; set; } 38 | 39 | public TSExecuteBatchStatementReq() 40 | { 41 | } 42 | 43 | public TSExecuteBatchStatementReq(long sessionId, List statements) : this() 44 | { 45 | this.SessionId = sessionId; 46 | this.Statements = statements; 47 | } 48 | 49 | public TSExecuteBatchStatementReq DeepCopy() 50 | { 51 | var tmp75 = new TSExecuteBatchStatementReq(); 52 | tmp75.SessionId = this.SessionId; 53 | if((Statements != null)) 54 | { 55 | tmp75.Statements = this.Statements.DeepCopy(); 56 | } 57 | return tmp75; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_sessionId = false; 66 | bool isset_statements = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.I64) 81 | { 82 | SessionId = await iprot.ReadI64Async(cancellationToken); 83 | isset_sessionId = true; 84 | } 85 | else 86 | { 87 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 88 | } 89 | break; 90 | case 2: 91 | if (field.Type == TType.List) 92 | { 93 | { 94 | TList _list76 = await iprot.ReadListBeginAsync(cancellationToken); 95 | Statements = new List(_list76.Count); 96 | for(int _i77 = 0; _i77 < _list76.Count; ++_i77) 97 | { 98 | string _elem78; 99 | _elem78 = await iprot.ReadStringAsync(cancellationToken); 100 | Statements.Add(_elem78); 101 | } 102 | await iprot.ReadListEndAsync(cancellationToken); 103 | } 104 | isset_statements = true; 105 | } 106 | else 107 | { 108 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 109 | } 110 | break; 111 | default: 112 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 113 | break; 114 | } 115 | 116 | await iprot.ReadFieldEndAsync(cancellationToken); 117 | } 118 | 119 | await iprot.ReadStructEndAsync(cancellationToken); 120 | if (!isset_sessionId) 121 | { 122 | throw new TProtocolException(TProtocolException.INVALID_DATA); 123 | } 124 | if (!isset_statements) 125 | { 126 | throw new TProtocolException(TProtocolException.INVALID_DATA); 127 | } 128 | } 129 | finally 130 | { 131 | iprot.DecrementRecursionDepth(); 132 | } 133 | } 134 | 135 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 136 | { 137 | oprot.IncrementRecursionDepth(); 138 | try 139 | { 140 | var struc = new TStruct("TSExecuteBatchStatementReq"); 141 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 142 | var field = new TField(); 143 | field.Name = "sessionId"; 144 | field.Type = TType.I64; 145 | field.ID = 1; 146 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 147 | await oprot.WriteI64Async(SessionId, cancellationToken); 148 | await oprot.WriteFieldEndAsync(cancellationToken); 149 | if((Statements != null)) 150 | { 151 | field.Name = "statements"; 152 | field.Type = TType.List; 153 | field.ID = 2; 154 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 155 | { 156 | await oprot.WriteListBeginAsync(new TList(TType.String, Statements.Count), cancellationToken); 157 | foreach (string _iter79 in Statements) 158 | { 159 | await oprot.WriteStringAsync(_iter79, cancellationToken); 160 | } 161 | await oprot.WriteListEndAsync(cancellationToken); 162 | } 163 | await oprot.WriteFieldEndAsync(cancellationToken); 164 | } 165 | await oprot.WriteFieldStopAsync(cancellationToken); 166 | await oprot.WriteStructEndAsync(cancellationToken); 167 | } 168 | finally 169 | { 170 | oprot.DecrementRecursionDepth(); 171 | } 172 | } 173 | 174 | public override bool Equals(object that) 175 | { 176 | if (!(that is TSExecuteBatchStatementReq other)) return false; 177 | if (ReferenceEquals(this, other)) return true; 178 | return System.Object.Equals(SessionId, other.SessionId) 179 | && TCollections.Equals(Statements, other.Statements); 180 | } 181 | 182 | public override int GetHashCode() { 183 | int hashcode = 157; 184 | unchecked { 185 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 186 | if((Statements != null)) 187 | { 188 | hashcode = (hashcode * 397) + TCollections.GetHashCode(Statements); 189 | } 190 | } 191 | return hashcode; 192 | } 193 | 194 | public override string ToString() 195 | { 196 | var sb = new StringBuilder("TSExecuteBatchStatementReq("); 197 | sb.Append(", SessionId: "); 198 | SessionId.ToString(sb); 199 | if((Statements != null)) 200 | { 201 | sb.Append(", Statements: "); 202 | Statements.ToString(sb); 203 | } 204 | sb.Append(')'); 205 | return sb.ToString(); 206 | } 207 | } 208 | 209 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TFilesResp.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TFilesResp : TBase 33 | { 34 | 35 | public TSStatus Status { get; set; } 36 | 37 | public List Files { get; set; } 38 | 39 | public TFilesResp() 40 | { 41 | } 42 | 43 | public TFilesResp(TSStatus status, List files) : this() 44 | { 45 | this.Status = status; 46 | this.Files = files; 47 | } 48 | 49 | public TFilesResp DeepCopy() 50 | { 51 | var tmp44 = new TFilesResp(); 52 | if((Status != null)) 53 | { 54 | tmp44.Status = (TSStatus)this.Status.DeepCopy(); 55 | } 56 | if((Files != null)) 57 | { 58 | tmp44.Files = this.Files.DeepCopy(); 59 | } 60 | return tmp44; 61 | } 62 | 63 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 64 | { 65 | iprot.IncrementRecursionDepth(); 66 | try 67 | { 68 | bool isset_status = false; 69 | bool isset_files = false; 70 | TField field; 71 | await iprot.ReadStructBeginAsync(cancellationToken); 72 | while (true) 73 | { 74 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 75 | if (field.Type == TType.Stop) 76 | { 77 | break; 78 | } 79 | 80 | switch (field.ID) 81 | { 82 | case 1: 83 | if (field.Type == TType.Struct) 84 | { 85 | Status = new TSStatus(); 86 | await Status.ReadAsync(iprot, cancellationToken); 87 | isset_status = true; 88 | } 89 | else 90 | { 91 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 92 | } 93 | break; 94 | case 2: 95 | if (field.Type == TType.List) 96 | { 97 | { 98 | TList _list45 = await iprot.ReadListBeginAsync(cancellationToken); 99 | Files = new List(_list45.Count); 100 | for(int _i46 = 0; _i46 < _list45.Count; ++_i46) 101 | { 102 | TFile _elem47; 103 | _elem47 = new TFile(); 104 | await _elem47.ReadAsync(iprot, cancellationToken); 105 | Files.Add(_elem47); 106 | } 107 | await iprot.ReadListEndAsync(cancellationToken); 108 | } 109 | isset_files = true; 110 | } 111 | else 112 | { 113 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 114 | } 115 | break; 116 | default: 117 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 118 | break; 119 | } 120 | 121 | await iprot.ReadFieldEndAsync(cancellationToken); 122 | } 123 | 124 | await iprot.ReadStructEndAsync(cancellationToken); 125 | if (!isset_status) 126 | { 127 | throw new TProtocolException(TProtocolException.INVALID_DATA); 128 | } 129 | if (!isset_files) 130 | { 131 | throw new TProtocolException(TProtocolException.INVALID_DATA); 132 | } 133 | } 134 | finally 135 | { 136 | iprot.DecrementRecursionDepth(); 137 | } 138 | } 139 | 140 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 141 | { 142 | oprot.IncrementRecursionDepth(); 143 | try 144 | { 145 | var struc = new TStruct("TFilesResp"); 146 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 147 | var field = new TField(); 148 | if((Status != null)) 149 | { 150 | field.Name = "status"; 151 | field.Type = TType.Struct; 152 | field.ID = 1; 153 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 154 | await Status.WriteAsync(oprot, cancellationToken); 155 | await oprot.WriteFieldEndAsync(cancellationToken); 156 | } 157 | if((Files != null)) 158 | { 159 | field.Name = "files"; 160 | field.Type = TType.List; 161 | field.ID = 2; 162 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 163 | { 164 | await oprot.WriteListBeginAsync(new TList(TType.Struct, Files.Count), cancellationToken); 165 | foreach (TFile _iter48 in Files) 166 | { 167 | await _iter48.WriteAsync(oprot, cancellationToken); 168 | } 169 | await oprot.WriteListEndAsync(cancellationToken); 170 | } 171 | await oprot.WriteFieldEndAsync(cancellationToken); 172 | } 173 | await oprot.WriteFieldStopAsync(cancellationToken); 174 | await oprot.WriteStructEndAsync(cancellationToken); 175 | } 176 | finally 177 | { 178 | oprot.DecrementRecursionDepth(); 179 | } 180 | } 181 | 182 | public override bool Equals(object that) 183 | { 184 | if (!(that is TFilesResp other)) return false; 185 | if (ReferenceEquals(this, other)) return true; 186 | return System.Object.Equals(Status, other.Status) 187 | && TCollections.Equals(Files, other.Files); 188 | } 189 | 190 | public override int GetHashCode() { 191 | int hashcode = 157; 192 | unchecked { 193 | if((Status != null)) 194 | { 195 | hashcode = (hashcode * 397) + Status.GetHashCode(); 196 | } 197 | if((Files != null)) 198 | { 199 | hashcode = (hashcode * 397) + TCollections.GetHashCode(Files); 200 | } 201 | } 202 | return hashcode; 203 | } 204 | 205 | public override string ToString() 206 | { 207 | var sb = new StringBuilder("TFilesResp("); 208 | if((Status != null)) 209 | { 210 | sb.Append(", Status: "); 211 | Status.ToString(sb); 212 | } 213 | if((Files != null)) 214 | { 215 | sb.Append(", Files: "); 216 | Files.ToString(sb); 217 | } 218 | sb.Append(')'); 219 | return sb.ToString(); 220 | } 221 | } 222 | 223 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSetTTLReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSetTTLReq : TBase 33 | { 34 | 35 | public List StorageGroupPathPattern { get; set; } 36 | 37 | public long TTL { get; set; } 38 | 39 | public TSetTTLReq() 40 | { 41 | } 42 | 43 | public TSetTTLReq(List storageGroupPathPattern, long TTL) : this() 44 | { 45 | this.StorageGroupPathPattern = storageGroupPathPattern; 46 | this.TTL = TTL; 47 | } 48 | 49 | public TSetTTLReq DeepCopy() 50 | { 51 | var tmp36 = new TSetTTLReq(); 52 | if((StorageGroupPathPattern != null)) 53 | { 54 | tmp36.StorageGroupPathPattern = this.StorageGroupPathPattern.DeepCopy(); 55 | } 56 | tmp36.TTL = this.TTL; 57 | return tmp36; 58 | } 59 | 60 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 61 | { 62 | iprot.IncrementRecursionDepth(); 63 | try 64 | { 65 | bool isset_storageGroupPathPattern = false; 66 | bool isset_TTL = false; 67 | TField field; 68 | await iprot.ReadStructBeginAsync(cancellationToken); 69 | while (true) 70 | { 71 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 72 | if (field.Type == TType.Stop) 73 | { 74 | break; 75 | } 76 | 77 | switch (field.ID) 78 | { 79 | case 1: 80 | if (field.Type == TType.List) 81 | { 82 | { 83 | TList _list37 = await iprot.ReadListBeginAsync(cancellationToken); 84 | StorageGroupPathPattern = new List(_list37.Count); 85 | for(int _i38 = 0; _i38 < _list37.Count; ++_i38) 86 | { 87 | string _elem39; 88 | _elem39 = await iprot.ReadStringAsync(cancellationToken); 89 | StorageGroupPathPattern.Add(_elem39); 90 | } 91 | await iprot.ReadListEndAsync(cancellationToken); 92 | } 93 | isset_storageGroupPathPattern = true; 94 | } 95 | else 96 | { 97 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 98 | } 99 | break; 100 | case 2: 101 | if (field.Type == TType.I64) 102 | { 103 | TTL = await iprot.ReadI64Async(cancellationToken); 104 | isset_TTL = true; 105 | } 106 | else 107 | { 108 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 109 | } 110 | break; 111 | default: 112 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 113 | break; 114 | } 115 | 116 | await iprot.ReadFieldEndAsync(cancellationToken); 117 | } 118 | 119 | await iprot.ReadStructEndAsync(cancellationToken); 120 | if (!isset_storageGroupPathPattern) 121 | { 122 | throw new TProtocolException(TProtocolException.INVALID_DATA); 123 | } 124 | if (!isset_TTL) 125 | { 126 | throw new TProtocolException(TProtocolException.INVALID_DATA); 127 | } 128 | } 129 | finally 130 | { 131 | iprot.DecrementRecursionDepth(); 132 | } 133 | } 134 | 135 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 136 | { 137 | oprot.IncrementRecursionDepth(); 138 | try 139 | { 140 | var struc = new TStruct("TSetTTLReq"); 141 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 142 | var field = new TField(); 143 | if((StorageGroupPathPattern != null)) 144 | { 145 | field.Name = "storageGroupPathPattern"; 146 | field.Type = TType.List; 147 | field.ID = 1; 148 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 149 | { 150 | await oprot.WriteListBeginAsync(new TList(TType.String, StorageGroupPathPattern.Count), cancellationToken); 151 | foreach (string _iter40 in StorageGroupPathPattern) 152 | { 153 | await oprot.WriteStringAsync(_iter40, cancellationToken); 154 | } 155 | await oprot.WriteListEndAsync(cancellationToken); 156 | } 157 | await oprot.WriteFieldEndAsync(cancellationToken); 158 | } 159 | field.Name = "TTL"; 160 | field.Type = TType.I64; 161 | field.ID = 2; 162 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 163 | await oprot.WriteI64Async(TTL, cancellationToken); 164 | await oprot.WriteFieldEndAsync(cancellationToken); 165 | await oprot.WriteFieldStopAsync(cancellationToken); 166 | await oprot.WriteStructEndAsync(cancellationToken); 167 | } 168 | finally 169 | { 170 | oprot.DecrementRecursionDepth(); 171 | } 172 | } 173 | 174 | public override bool Equals(object that) 175 | { 176 | if (!(that is TSetTTLReq other)) return false; 177 | if (ReferenceEquals(this, other)) return true; 178 | return TCollections.Equals(StorageGroupPathPattern, other.StorageGroupPathPattern) 179 | && System.Object.Equals(TTL, other.TTL); 180 | } 181 | 182 | public override int GetHashCode() { 183 | int hashcode = 157; 184 | unchecked { 185 | if((StorageGroupPathPattern != null)) 186 | { 187 | hashcode = (hashcode * 397) + TCollections.GetHashCode(StorageGroupPathPattern); 188 | } 189 | hashcode = (hashcode * 397) + TTL.GetHashCode(); 190 | } 191 | return hashcode; 192 | } 193 | 194 | public override string ToString() 195 | { 196 | var sb = new StringBuilder("TSetTTLReq("); 197 | if((StorageGroupPathPattern != null)) 198 | { 199 | sb.Append(", StorageGroupPathPattern: "); 200 | StorageGroupPathPattern.ToString(sb); 201 | } 202 | sb.Append(", TTL: "); 203 | TTL.ToString(sb); 204 | sb.Append(')'); 205 | return sb.ToString(); 206 | } 207 | } 208 | 209 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/DataStructure/ByteBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | 5 | namespace Apache.IoTDB.DataStructure 6 | { 7 | public class ByteBuffer 8 | { 9 | private byte[] _buffer; 10 | private int _writePos; 11 | private int _readPos; 12 | private int _totalLength; 13 | private readonly bool _isLittleEndian = BitConverter.IsLittleEndian; 14 | 15 | public ByteBuffer(byte[] buffer) 16 | { 17 | _buffer = buffer; 18 | _readPos = 0; 19 | _writePos = buffer.Length; 20 | _totalLength = buffer.Length; 21 | } 22 | 23 | public ByteBuffer(int reserve = 1) 24 | { 25 | _buffer = new byte[reserve]; 26 | _writePos = 0; 27 | _readPos = 0; 28 | _totalLength = reserve; 29 | } 30 | 31 | public bool HasRemaining() 32 | { 33 | return _readPos < _writePos; 34 | } 35 | 36 | // these for read 37 | public byte GetByte() 38 | { 39 | var byteVal = _buffer[_readPos]; 40 | _readPos += 1; 41 | return byteVal; 42 | } 43 | 44 | public bool GetBool() 45 | { 46 | var boolValue = BitConverter.ToBoolean(_buffer, _readPos); 47 | _readPos += 1; 48 | return boolValue; 49 | } 50 | 51 | public int GetInt() 52 | { 53 | var intBuff = _buffer[_readPos..(_readPos + 4)]; 54 | if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray(); 55 | #if NET461_OR_GREATER || NETSTANDARD2_0 56 | var intValue = BitConverter.ToInt32(intBuff,0); 57 | #else 58 | var intValue = BitConverter.ToInt32(intBuff); 59 | #endif 60 | 61 | _readPos += 4; 62 | return intValue; 63 | } 64 | 65 | public long GetLong() 66 | { 67 | var longBuff = _buffer[_readPos..(_readPos + 8)]; 68 | 69 | if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray(); 70 | #if NET461_OR_GREATER || NETSTANDARD2_0 71 | var longValue = BitConverter.ToInt64(longBuff,0); 72 | #else 73 | var longValue = BitConverter.ToInt64(longBuff); 74 | #endif 75 | 76 | _readPos += 8; 77 | return longValue; 78 | } 79 | 80 | public float GetFloat() 81 | { 82 | var floatBuff = _buffer[_readPos..(_readPos + 4)]; 83 | 84 | if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray(); 85 | #if NET461_OR_GREATER || NETSTANDARD2_0 86 | var floatValue = BitConverter.ToSingle(floatBuff,0); 87 | #else 88 | var floatValue = BitConverter.ToSingle(floatBuff); 89 | #endif 90 | _readPos += 4; 91 | return floatValue; 92 | } 93 | 94 | public double GetDouble() 95 | { 96 | var doubleBuff = _buffer[_readPos..(_readPos + 8)]; 97 | 98 | if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray(); 99 | #if NET461_OR_GREATER || NETSTANDARD2_0 100 | var doubleValue = BitConverter.ToDouble(doubleBuff,0); 101 | #else 102 | var doubleValue = BitConverter.ToDouble(doubleBuff); 103 | #endif 104 | _readPos += 8; 105 | return doubleValue; 106 | } 107 | 108 | public string GetStr() 109 | { 110 | var length = GetInt(); 111 | var strBuff = _buffer[_readPos..(_readPos + length)]; 112 | var strValue = Encoding.UTF8.GetString(strBuff); 113 | _readPos += length; 114 | return strValue; 115 | } 116 | 117 | public byte[] GetBuffer() 118 | { 119 | return _buffer[.._writePos]; 120 | } 121 | 122 | private void ExtendBuffer(int spaceNeed) 123 | { 124 | if (_writePos + spaceNeed >= _totalLength) 125 | { 126 | _totalLength = Math.Max(spaceNeed, _totalLength); 127 | var newBuffer = new byte[_totalLength * 2]; 128 | _buffer.CopyTo(newBuffer, 0); 129 | _buffer = newBuffer; 130 | _totalLength = 2 * _totalLength; 131 | } 132 | } 133 | 134 | // these for write 135 | public void AddBool(bool value) 136 | { 137 | var boolBuffer = BitConverter.GetBytes(value); 138 | 139 | if (_isLittleEndian) boolBuffer = boolBuffer.Reverse().ToArray(); 140 | 141 | ExtendBuffer(boolBuffer.Length); 142 | boolBuffer.CopyTo(_buffer, _writePos); 143 | _writePos += boolBuffer.Length; 144 | } 145 | 146 | public void AddInt(int value) 147 | { 148 | var intBuff = BitConverter.GetBytes(value); 149 | 150 | if (_isLittleEndian) intBuff = intBuff.Reverse().ToArray(); 151 | 152 | ExtendBuffer(intBuff.Length); 153 | intBuff.CopyTo(_buffer, _writePos); 154 | _writePos += intBuff.Length; 155 | } 156 | 157 | public void AddLong(long value) 158 | { 159 | var longBuff = BitConverter.GetBytes(value); 160 | 161 | if (_isLittleEndian) longBuff = longBuff.Reverse().ToArray(); 162 | 163 | ExtendBuffer(longBuff.Length); 164 | longBuff.CopyTo(_buffer, _writePos); 165 | _writePos += longBuff.Length; 166 | } 167 | 168 | public void AddFloat(float value) 169 | { 170 | var floatBuff = BitConverter.GetBytes(value); 171 | 172 | if (_isLittleEndian) floatBuff = floatBuff.Reverse().ToArray(); 173 | 174 | ExtendBuffer(floatBuff.Length); 175 | floatBuff.CopyTo(_buffer, _writePos); 176 | _writePos += floatBuff.Length; 177 | } 178 | 179 | public void AddDouble(double value) 180 | { 181 | var doubleBuff = BitConverter.GetBytes(value); 182 | 183 | if (_isLittleEndian) doubleBuff = doubleBuff.Reverse().ToArray(); 184 | 185 | ExtendBuffer(doubleBuff.Length); 186 | doubleBuff.CopyTo(_buffer, _writePos); 187 | _writePos += doubleBuff.Length; 188 | } 189 | 190 | public void AddStr(string value) 191 | { 192 | var strBuf = Encoding.UTF8.GetBytes(value); 193 | 194 | AddInt(strBuf.Length); 195 | 196 | ExtendBuffer(strBuf.Length); 197 | strBuf.CopyTo(_buffer, _writePos); 198 | _writePos += strBuf.Length; 199 | } 200 | 201 | public void AddChar(char value) 202 | { 203 | var charBuf = BitConverter.GetBytes(value); 204 | 205 | if (_isLittleEndian) charBuf = charBuf.Reverse().ToArray(); 206 | 207 | ExtendBuffer(charBuf.Length); 208 | charBuf.CopyTo(_buffer, _writePos); 209 | _writePos += charBuf.Length; 210 | } 211 | public void AddByte(byte value) 212 | { 213 | ExtendBuffer(1); 214 | _buffer[_writePos] = value; 215 | _writePos += 1; 216 | } 217 | } 218 | } -------------------------------------------------------------------------------- /docs/API.md: -------------------------------------------------------------------------------- 1 | # **核心概念** 2 | 3 | ### **Row Record** 4 | 5 | - 对**IoTDB**中的`record`数据进行封装和抽象。 6 | - 示例: 7 | 8 | | timestamp | status | temperature | 9 | | --------- | ------ | ----------- | 10 | | 1 | 0 | 20 | 11 | 12 | - 构造方法: 13 | 14 | ```c# 15 | var rowRecord = 16 | new RowRecord(long timestamps, List values, List measurements); 17 | ``` 18 | 19 | ### **Tablet** 20 | 21 | - 一种类似于表格的数据结构,包含一个设备的若干行非空数据块。 22 | - 示例: 23 | 24 | | time | status | temperature | 25 | | ---- | ------ | ----------- | 26 | | 1 | 0 | 20 | 27 | | 2 | 0 | 20 | 28 | | 3 | 3 | 21 | 29 | 30 | - 构造方法: 31 | 32 | ```c# 33 | var tablet = 34 | Tablet(string deviceId, List measurements, List> values, List timestamps); 35 | ``` 36 | 37 | 38 | 39 | # **API** 40 | 41 | ### **基础接口** 42 | 43 | | api name | parameters | notes | use example | 44 | | -------------- | ------------------------- | ------------------------ | ----------------------------- | 45 | | Open | bool | open session | session_pool.Open(false) | 46 | | Close | null | close session | session_pool.Close() | 47 | | IsOpen | null | check if session is open | session_pool.IsOpen() | 48 | | OpenDebugMode | LoggingConfiguration=null | open debug mode | session_pool.OpenDebugMode() | 49 | | CloseDebugMode | null | close debug mode | session_pool.CloseDebugMode() | 50 | | SetTimeZone | string | set time zone | session_pool.GetTimeZone() | 51 | | GetTimeZone | null | get time zone | session_pool.GetTimeZone() | 52 | 53 | ### **Record相关接口** 54 | 55 | | api name | parameters | notes | use example | 56 | | ----------------------------------- | ----------------------------- | ----------------------------------- | ------------------------------------------------------------ | 57 | | InsertRecordAsync | string, RowRecord | insert single record | session_pool.InsertRecordAsync("root.97209_TEST_CSHARP_CLIENT_GROUP.TEST_CSHARP_CLIENT_DEVICE", new RowRecord(1, values, measures)); | 58 | | InsertRecordsAsync | List, List | insert records | session_pool.InsertRecordsAsync(device_id, rowRecords) | 59 | | InsertRecordsOfOneDeviceAsync | string, List | insert records of one device | session_pool.InsertRecordsOfOneDeviceAsync(device_id, rowRecords) | 60 | | InsertRecordsOfOneDeviceSortedAsync | string, List | insert sorted records of one device | InsertRecordsOfOneDeviceSortedAsync(deviceId, sortedRowRecords); | 61 | | TestInsertRecordAsync | string, RowRecord | test insert record | session_pool.TestInsertRecordAsync("root.97209_TEST_CSHARP_CLIENT_GROUP.TEST_CSHARP_CLIENT_DEVICE", rowRecord) | 62 | | TestInsertRecordsAsync | List, List | test insert record | session_pool.TestInsertRecordsAsync(device_id, rowRecords) | 63 | 64 | ### **Tablet相关接口** 65 | 66 | | api name | parameters | notes | use example | 67 | | ---------------------- | ------------ | -------------------- | -------------------------------------------- | 68 | | InsertTabletAsync | Tablet | insert single tablet | session_pool.InsertTabletAsync(tablet) | 69 | | InsertTabletsAsync | List | insert tablets | session_pool.InsertTabletsAsync(tablets) | 70 | | TestInsertTabletAsync | Tablet | test insert tablet | session_pool.TestInsertTabletAsync(tablet) | 71 | | TestInsertTabletsAsync | List | test insert tablets | session_pool.TestInsertTabletsAsync(tablets) | 72 | 73 | - ### **SQL语句接口** 74 | 75 | | api name | parameters | notes | use example | 76 | | ----------------------------- | ---------- | ------------------------------ | ------------------------------------------------------------ | 77 | | ExecuteQueryStatementAsync | string | execute sql query statement | session_pool.ExecuteQueryStatementAsync("select * from root.97209_TEST_CSHARP_CLIENT_GROUP.TEST_CSHARP_CLIENT_DEVICE where time<15"); | 78 | | ExecuteNonQueryStatementAsync | string | execute sql nonquery statement | session_pool.ExecuteNonQueryStatementAsync( "create timeseries root.97209_TEST_CSHARP_CLIENT_GROUP.TEST_CSHARP_CLIENT_DEVICE.status with datatype=BOOLEAN,encoding=PLAIN") | 79 | 80 | - ### 数据表接口 81 | 82 | | api name | parameters | notes | use example | 83 | | -------------------------- | ------------------------------------------------------------ | --------------------------- | ------------------------------------------------------------ | 84 | | SetStorageGroup | string | set storage group | session_pool.SetStorageGroup("root.97209_TEST_CSHARP_CLIENT_GROUP_01") | 85 | | CreateTimeSeries | string, TSDataType, TSEncoding, Compressor | create time series | session_pool.InsertTabletsAsync(tablets) | 86 | | DeleteStorageGroupAsync | string | delete single storage group | session_pool.DeleteStorageGroupAsync("root.97209_TEST_CSHARP_CLIENT_GROUP_01") | 87 | | DeleteStorageGroupsAsync | List | delete storage group | session_pool.DeleteStorageGroupAsync("root.97209_TEST_CSHARP_CLIENT_GROUP") | 88 | | CreateMultiTimeSeriesAsync | List, List , List , List | create multi time series | session_pool.CreateMultiTimeSeriesAsync(ts_path_lst, data_type_lst, encoding_lst, compressor_lst); | 89 | | DeleteTimeSeriesAsync | List | delete time series | | 90 | | DeleteTimeSeriesAsync | string | delete time series | | 91 | | DeleteDataAsync | List, long, long | delete data | session_pool.DeleteDataAsync(ts_path_lst, 2, 3) | 92 | 93 | - ### **辅助接口** 94 | 95 | | api name | parameters | notes | use example | 96 | | -------------------------- | ---------- | --------------------------- | ---------------------------------------------------- | 97 | | CheckTimeSeriesExistsAsync | string | check if time series exists | session_pool.CheckTimeSeriesExistsAsync(time series) | 98 | 99 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TSPruneSchemaTemplateReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TSPruneSchemaTemplateReq : TBase 33 | { 34 | 35 | public long SessionId { get; set; } 36 | 37 | public string Name { get; set; } 38 | 39 | public string Path { get; set; } 40 | 41 | public TSPruneSchemaTemplateReq() 42 | { 43 | } 44 | 45 | public TSPruneSchemaTemplateReq(long sessionId, string name, string path) : this() 46 | { 47 | this.SessionId = sessionId; 48 | this.Name = name; 49 | this.Path = path; 50 | } 51 | 52 | public TSPruneSchemaTemplateReq DeepCopy() 53 | { 54 | var tmp407 = new TSPruneSchemaTemplateReq(); 55 | tmp407.SessionId = this.SessionId; 56 | if((Name != null)) 57 | { 58 | tmp407.Name = this.Name; 59 | } 60 | if((Path != null)) 61 | { 62 | tmp407.Path = this.Path; 63 | } 64 | return tmp407; 65 | } 66 | 67 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 68 | { 69 | iprot.IncrementRecursionDepth(); 70 | try 71 | { 72 | bool isset_sessionId = false; 73 | bool isset_name = false; 74 | bool isset_path = false; 75 | TField field; 76 | await iprot.ReadStructBeginAsync(cancellationToken); 77 | while (true) 78 | { 79 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 80 | if (field.Type == TType.Stop) 81 | { 82 | break; 83 | } 84 | 85 | switch (field.ID) 86 | { 87 | case 1: 88 | if (field.Type == TType.I64) 89 | { 90 | SessionId = await iprot.ReadI64Async(cancellationToken); 91 | isset_sessionId = true; 92 | } 93 | else 94 | { 95 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 96 | } 97 | break; 98 | case 2: 99 | if (field.Type == TType.String) 100 | { 101 | Name = await iprot.ReadStringAsync(cancellationToken); 102 | isset_name = true; 103 | } 104 | else 105 | { 106 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 107 | } 108 | break; 109 | case 3: 110 | if (field.Type == TType.String) 111 | { 112 | Path = await iprot.ReadStringAsync(cancellationToken); 113 | isset_path = true; 114 | } 115 | else 116 | { 117 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 118 | } 119 | break; 120 | default: 121 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 122 | break; 123 | } 124 | 125 | await iprot.ReadFieldEndAsync(cancellationToken); 126 | } 127 | 128 | await iprot.ReadStructEndAsync(cancellationToken); 129 | if (!isset_sessionId) 130 | { 131 | throw new TProtocolException(TProtocolException.INVALID_DATA); 132 | } 133 | if (!isset_name) 134 | { 135 | throw new TProtocolException(TProtocolException.INVALID_DATA); 136 | } 137 | if (!isset_path) 138 | { 139 | throw new TProtocolException(TProtocolException.INVALID_DATA); 140 | } 141 | } 142 | finally 143 | { 144 | iprot.DecrementRecursionDepth(); 145 | } 146 | } 147 | 148 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 149 | { 150 | oprot.IncrementRecursionDepth(); 151 | try 152 | { 153 | var struc = new TStruct("TSPruneSchemaTemplateReq"); 154 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 155 | var field = new TField(); 156 | field.Name = "sessionId"; 157 | field.Type = TType.I64; 158 | field.ID = 1; 159 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 160 | await oprot.WriteI64Async(SessionId, cancellationToken); 161 | await oprot.WriteFieldEndAsync(cancellationToken); 162 | if((Name != null)) 163 | { 164 | field.Name = "name"; 165 | field.Type = TType.String; 166 | field.ID = 2; 167 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 168 | await oprot.WriteStringAsync(Name, cancellationToken); 169 | await oprot.WriteFieldEndAsync(cancellationToken); 170 | } 171 | if((Path != null)) 172 | { 173 | field.Name = "path"; 174 | field.Type = TType.String; 175 | field.ID = 3; 176 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 177 | await oprot.WriteStringAsync(Path, cancellationToken); 178 | await oprot.WriteFieldEndAsync(cancellationToken); 179 | } 180 | await oprot.WriteFieldStopAsync(cancellationToken); 181 | await oprot.WriteStructEndAsync(cancellationToken); 182 | } 183 | finally 184 | { 185 | oprot.DecrementRecursionDepth(); 186 | } 187 | } 188 | 189 | public override bool Equals(object that) 190 | { 191 | if (!(that is TSPruneSchemaTemplateReq other)) return false; 192 | if (ReferenceEquals(this, other)) return true; 193 | return System.Object.Equals(SessionId, other.SessionId) 194 | && System.Object.Equals(Name, other.Name) 195 | && System.Object.Equals(Path, other.Path); 196 | } 197 | 198 | public override int GetHashCode() { 199 | int hashcode = 157; 200 | unchecked { 201 | hashcode = (hashcode * 397) + SessionId.GetHashCode(); 202 | if((Name != null)) 203 | { 204 | hashcode = (hashcode * 397) + Name.GetHashCode(); 205 | } 206 | if((Path != null)) 207 | { 208 | hashcode = (hashcode * 397) + Path.GetHashCode(); 209 | } 210 | } 211 | return hashcode; 212 | } 213 | 214 | public override string ToString() 215 | { 216 | var sb = new StringBuilder("TSPruneSchemaTemplateReq("); 217 | sb.Append(", SessionId: "); 218 | SessionId.ToString(sb); 219 | if((Name != null)) 220 | { 221 | sb.Append(", Name: "); 222 | Name.ToString(sb); 223 | } 224 | if((Path != null)) 225 | { 226 | sb.Append(", Path: "); 227 | Path.ToString(sb); 228 | } 229 | sb.Append(')'); 230 | return sb.ToString(); 231 | } 232 | } 233 | 234 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TRegionReplicaSet.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TRegionReplicaSet : TBase 33 | { 34 | 35 | public TConsensusGroupId RegionId { get; set; } 36 | 37 | public List DataNodeLocations { get; set; } 38 | 39 | public TRegionReplicaSet() 40 | { 41 | } 42 | 43 | public TRegionReplicaSet(TConsensusGroupId regionId, List dataNodeLocations) : this() 44 | { 45 | this.RegionId = regionId; 46 | this.DataNodeLocations = dataNodeLocations; 47 | } 48 | 49 | public TRegionReplicaSet DeepCopy() 50 | { 51 | var tmp14 = new TRegionReplicaSet(); 52 | if((RegionId != null)) 53 | { 54 | tmp14.RegionId = (TConsensusGroupId)this.RegionId.DeepCopy(); 55 | } 56 | if((DataNodeLocations != null)) 57 | { 58 | tmp14.DataNodeLocations = this.DataNodeLocations.DeepCopy(); 59 | } 60 | return tmp14; 61 | } 62 | 63 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 64 | { 65 | iprot.IncrementRecursionDepth(); 66 | try 67 | { 68 | bool isset_regionId = false; 69 | bool isset_dataNodeLocations = false; 70 | TField field; 71 | await iprot.ReadStructBeginAsync(cancellationToken); 72 | while (true) 73 | { 74 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 75 | if (field.Type == TType.Stop) 76 | { 77 | break; 78 | } 79 | 80 | switch (field.ID) 81 | { 82 | case 1: 83 | if (field.Type == TType.Struct) 84 | { 85 | RegionId = new TConsensusGroupId(); 86 | await RegionId.ReadAsync(iprot, cancellationToken); 87 | isset_regionId = true; 88 | } 89 | else 90 | { 91 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 92 | } 93 | break; 94 | case 2: 95 | if (field.Type == TType.List) 96 | { 97 | { 98 | TList _list15 = await iprot.ReadListBeginAsync(cancellationToken); 99 | DataNodeLocations = new List(_list15.Count); 100 | for(int _i16 = 0; _i16 < _list15.Count; ++_i16) 101 | { 102 | TDataNodeLocation _elem17; 103 | _elem17 = new TDataNodeLocation(); 104 | await _elem17.ReadAsync(iprot, cancellationToken); 105 | DataNodeLocations.Add(_elem17); 106 | } 107 | await iprot.ReadListEndAsync(cancellationToken); 108 | } 109 | isset_dataNodeLocations = true; 110 | } 111 | else 112 | { 113 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 114 | } 115 | break; 116 | default: 117 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 118 | break; 119 | } 120 | 121 | await iprot.ReadFieldEndAsync(cancellationToken); 122 | } 123 | 124 | await iprot.ReadStructEndAsync(cancellationToken); 125 | if (!isset_regionId) 126 | { 127 | throw new TProtocolException(TProtocolException.INVALID_DATA); 128 | } 129 | if (!isset_dataNodeLocations) 130 | { 131 | throw new TProtocolException(TProtocolException.INVALID_DATA); 132 | } 133 | } 134 | finally 135 | { 136 | iprot.DecrementRecursionDepth(); 137 | } 138 | } 139 | 140 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 141 | { 142 | oprot.IncrementRecursionDepth(); 143 | try 144 | { 145 | var struc = new TStruct("TRegionReplicaSet"); 146 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 147 | var field = new TField(); 148 | if((RegionId != null)) 149 | { 150 | field.Name = "regionId"; 151 | field.Type = TType.Struct; 152 | field.ID = 1; 153 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 154 | await RegionId.WriteAsync(oprot, cancellationToken); 155 | await oprot.WriteFieldEndAsync(cancellationToken); 156 | } 157 | if((DataNodeLocations != null)) 158 | { 159 | field.Name = "dataNodeLocations"; 160 | field.Type = TType.List; 161 | field.ID = 2; 162 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 163 | { 164 | await oprot.WriteListBeginAsync(new TList(TType.Struct, DataNodeLocations.Count), cancellationToken); 165 | foreach (TDataNodeLocation _iter18 in DataNodeLocations) 166 | { 167 | await _iter18.WriteAsync(oprot, cancellationToken); 168 | } 169 | await oprot.WriteListEndAsync(cancellationToken); 170 | } 171 | await oprot.WriteFieldEndAsync(cancellationToken); 172 | } 173 | await oprot.WriteFieldStopAsync(cancellationToken); 174 | await oprot.WriteStructEndAsync(cancellationToken); 175 | } 176 | finally 177 | { 178 | oprot.DecrementRecursionDepth(); 179 | } 180 | } 181 | 182 | public override bool Equals(object that) 183 | { 184 | if (!(that is TRegionReplicaSet other)) return false; 185 | if (ReferenceEquals(this, other)) return true; 186 | return System.Object.Equals(RegionId, other.RegionId) 187 | && TCollections.Equals(DataNodeLocations, other.DataNodeLocations); 188 | } 189 | 190 | public override int GetHashCode() { 191 | int hashcode = 157; 192 | unchecked { 193 | if((RegionId != null)) 194 | { 195 | hashcode = (hashcode * 397) + RegionId.GetHashCode(); 196 | } 197 | if((DataNodeLocations != null)) 198 | { 199 | hashcode = (hashcode * 397) + TCollections.GetHashCode(DataNodeLocations); 200 | } 201 | } 202 | return hashcode; 203 | } 204 | 205 | public override string ToString() 206 | { 207 | var sb = new StringBuilder("TRegionReplicaSet("); 208 | if((RegionId != null)) 209 | { 210 | sb.Append(", RegionId: "); 211 | RegionId.ToString(sb); 212 | } 213 | if((DataNodeLocations != null)) 214 | { 215 | sb.Append(", DataNodeLocations: "); 216 | DataNodeLocations.ToString(sb); 217 | } 218 | sb.Append(')'); 219 | return sb.ToString(); 220 | } 221 | } 222 | 223 | -------------------------------------------------------------------------------- /src/Apache.IoTDB/Rpc/Generated/TFlushReq.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.14.2) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using System.Threading.Tasks; 15 | using Microsoft.Extensions.Logging; 16 | using Thrift; 17 | using Thrift.Collections; 18 | 19 | using Thrift.Protocol; 20 | using Thrift.Protocol.Entities; 21 | using Thrift.Protocol.Utilities; 22 | using Thrift.Transport; 23 | using Thrift.Transport.Client; 24 | using Thrift.Transport.Server; 25 | using Thrift.Processor; 26 | 27 | 28 | #pragma warning disable IDE0079 // remove unnecessary pragmas 29 | #pragma warning disable IDE1006 // parts of the code use IDL spelling 30 | 31 | 32 | public partial class TFlushReq : TBase 33 | { 34 | private string _isSeq; 35 | private List _storageGroups; 36 | 37 | public string IsSeq 38 | { 39 | get 40 | { 41 | return _isSeq; 42 | } 43 | set 44 | { 45 | __isset.isSeq = true; 46 | this._isSeq = value; 47 | } 48 | } 49 | 50 | public List StorageGroups 51 | { 52 | get 53 | { 54 | return _storageGroups; 55 | } 56 | set 57 | { 58 | __isset.storageGroups = true; 59 | this._storageGroups = value; 60 | } 61 | } 62 | 63 | 64 | public Isset __isset; 65 | public struct Isset 66 | { 67 | public bool isSeq; 68 | public bool storageGroups; 69 | } 70 | 71 | public TFlushReq() 72 | { 73 | } 74 | 75 | public TFlushReq DeepCopy() 76 | { 77 | var tmp28 = new TFlushReq(); 78 | if((IsSeq != null) && __isset.isSeq) 79 | { 80 | tmp28.IsSeq = this.IsSeq; 81 | } 82 | tmp28.__isset.isSeq = this.__isset.isSeq; 83 | if((StorageGroups != null) && __isset.storageGroups) 84 | { 85 | tmp28.StorageGroups = this.StorageGroups.DeepCopy(); 86 | } 87 | tmp28.__isset.storageGroups = this.__isset.storageGroups; 88 | return tmp28; 89 | } 90 | 91 | public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) 92 | { 93 | iprot.IncrementRecursionDepth(); 94 | try 95 | { 96 | TField field; 97 | await iprot.ReadStructBeginAsync(cancellationToken); 98 | while (true) 99 | { 100 | field = await iprot.ReadFieldBeginAsync(cancellationToken); 101 | if (field.Type == TType.Stop) 102 | { 103 | break; 104 | } 105 | 106 | switch (field.ID) 107 | { 108 | case 1: 109 | if (field.Type == TType.String) 110 | { 111 | IsSeq = await iprot.ReadStringAsync(cancellationToken); 112 | } 113 | else 114 | { 115 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 116 | } 117 | break; 118 | case 2: 119 | if (field.Type == TType.List) 120 | { 121 | { 122 | TList _list29 = await iprot.ReadListBeginAsync(cancellationToken); 123 | StorageGroups = new List(_list29.Count); 124 | for(int _i30 = 0; _i30 < _list29.Count; ++_i30) 125 | { 126 | string _elem31; 127 | _elem31 = await iprot.ReadStringAsync(cancellationToken); 128 | StorageGroups.Add(_elem31); 129 | } 130 | await iprot.ReadListEndAsync(cancellationToken); 131 | } 132 | } 133 | else 134 | { 135 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 136 | } 137 | break; 138 | default: 139 | await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); 140 | break; 141 | } 142 | 143 | await iprot.ReadFieldEndAsync(cancellationToken); 144 | } 145 | 146 | await iprot.ReadStructEndAsync(cancellationToken); 147 | } 148 | finally 149 | { 150 | iprot.DecrementRecursionDepth(); 151 | } 152 | } 153 | 154 | public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) 155 | { 156 | oprot.IncrementRecursionDepth(); 157 | try 158 | { 159 | var struc = new TStruct("TFlushReq"); 160 | await oprot.WriteStructBeginAsync(struc, cancellationToken); 161 | var field = new TField(); 162 | if((IsSeq != null) && __isset.isSeq) 163 | { 164 | field.Name = "isSeq"; 165 | field.Type = TType.String; 166 | field.ID = 1; 167 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 168 | await oprot.WriteStringAsync(IsSeq, cancellationToken); 169 | await oprot.WriteFieldEndAsync(cancellationToken); 170 | } 171 | if((StorageGroups != null) && __isset.storageGroups) 172 | { 173 | field.Name = "storageGroups"; 174 | field.Type = TType.List; 175 | field.ID = 2; 176 | await oprot.WriteFieldBeginAsync(field, cancellationToken); 177 | { 178 | await oprot.WriteListBeginAsync(new TList(TType.String, StorageGroups.Count), cancellationToken); 179 | foreach (string _iter32 in StorageGroups) 180 | { 181 | await oprot.WriteStringAsync(_iter32, cancellationToken); 182 | } 183 | await oprot.WriteListEndAsync(cancellationToken); 184 | } 185 | await oprot.WriteFieldEndAsync(cancellationToken); 186 | } 187 | await oprot.WriteFieldStopAsync(cancellationToken); 188 | await oprot.WriteStructEndAsync(cancellationToken); 189 | } 190 | finally 191 | { 192 | oprot.DecrementRecursionDepth(); 193 | } 194 | } 195 | 196 | public override bool Equals(object that) 197 | { 198 | if (!(that is TFlushReq other)) return false; 199 | if (ReferenceEquals(this, other)) return true; 200 | return ((__isset.isSeq == other.__isset.isSeq) && ((!__isset.isSeq) || (System.Object.Equals(IsSeq, other.IsSeq)))) 201 | && ((__isset.storageGroups == other.__isset.storageGroups) && ((!__isset.storageGroups) || (TCollections.Equals(StorageGroups, other.StorageGroups)))); 202 | } 203 | 204 | public override int GetHashCode() { 205 | int hashcode = 157; 206 | unchecked { 207 | if((IsSeq != null) && __isset.isSeq) 208 | { 209 | hashcode = (hashcode * 397) + IsSeq.GetHashCode(); 210 | } 211 | if((StorageGroups != null) && __isset.storageGroups) 212 | { 213 | hashcode = (hashcode * 397) + TCollections.GetHashCode(StorageGroups); 214 | } 215 | } 216 | return hashcode; 217 | } 218 | 219 | public override string ToString() 220 | { 221 | var sb = new StringBuilder("TFlushReq("); 222 | int tmp33 = 0; 223 | if((IsSeq != null) && __isset.isSeq) 224 | { 225 | if(0 < tmp33++) { sb.Append(", "); } 226 | sb.Append("IsSeq: "); 227 | IsSeq.ToString(sb); 228 | } 229 | if((StorageGroups != null) && __isset.storageGroups) 230 | { 231 | if(0 < tmp33++) { sb.Append(", "); } 232 | sb.Append("StorageGroups: "); 233 | StorageGroups.ToString(sb); 234 | } 235 | sb.Append(')'); 236 | return sb.ToString(); 237 | } 238 | } 239 | 240 | --------------------------------------------------------------------------------