blob: f4d6916da258c5814c55b2890f8f2c78bd5eb12e [file] [log] [blame]
/**
* Autogenerated by Thrift Compiler (0.14.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Thrift;
using Thrift.Collections;
using Thrift.Protocol;
using Thrift.Protocol.Entities;
using Thrift.Protocol.Utilities;
using Thrift.Transport;
using Thrift.Transport.Client;
using Thrift.Transport.Server;
using Thrift.Processor;
#pragma warning disable IDE0079 // remove unnecessary pragmas
#pragma warning disable IDE1006 // parts of the code use IDL spelling
public partial class TSOpenSessionReq : TBase
{
private string _password;
private Dictionary<string, string> _configuration;
/// <summary>
///
/// <seealso cref="global::.TSProtocolVersion"/>
/// </summary>
public TSProtocolVersion Client_protocol { get; set; }
public string ZoneId { get; set; }
public string Username { get; set; }
public string Password
{
get
{
return _password;
}
set
{
__isset.password = true;
this._password = value;
}
}
public Dictionary<string, string> Configuration
{
get
{
return _configuration;
}
set
{
__isset.configuration = true;
this._configuration = value;
}
}
public Isset __isset;
public struct Isset
{
public bool password;
public bool configuration;
}
public TSOpenSessionReq()
{
this.Client_protocol = TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;
}
public TSOpenSessionReq(TSProtocolVersion client_protocol, string zoneId, string username) : this()
{
this.Client_protocol = client_protocol;
this.ZoneId = zoneId;
this.Username = username;
}
public TSOpenSessionReq DeepCopy()
{
var tmp64 = new TSOpenSessionReq();
tmp64.Client_protocol = this.Client_protocol;
if((ZoneId != null))
{
tmp64.ZoneId = this.ZoneId;
}
if((Username != null))
{
tmp64.Username = this.Username;
}
if((Password != null) && __isset.password)
{
tmp64.Password = this.Password;
}
tmp64.__isset.password = this.__isset.password;
if((Configuration != null) && __isset.configuration)
{
tmp64.Configuration = this.Configuration.DeepCopy();
}
tmp64.__isset.configuration = this.__isset.configuration;
return tmp64;
}
public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
{
iprot.IncrementRecursionDepth();
try
{
bool isset_client_protocol = false;
bool isset_zoneId = false;
bool isset_username = false;
TField field;
await iprot.ReadStructBeginAsync(cancellationToken);
while (true)
{
field = await iprot.ReadFieldBeginAsync(cancellationToken);
if (field.Type == TType.Stop)
{
break;
}
switch (field.ID)
{
case 1:
if (field.Type == TType.I32)
{
Client_protocol = (TSProtocolVersion)await iprot.ReadI32Async(cancellationToken);
isset_client_protocol = true;
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.String)
{
ZoneId = await iprot.ReadStringAsync(cancellationToken);
isset_zoneId = true;
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.String)
{
Username = await iprot.ReadStringAsync(cancellationToken);
isset_username = true;
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.String)
{
Password = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.Map)
{
{
TMap _map65 = await iprot.ReadMapBeginAsync(cancellationToken);
Configuration = new Dictionary<string, string>(_map65.Count);
for(int _i66 = 0; _i66 < _map65.Count; ++_i66)
{
string _key67;
string _val68;
_key67 = await iprot.ReadStringAsync(cancellationToken);
_val68 = await iprot.ReadStringAsync(cancellationToken);
Configuration[_key67] = _val68;
}
await iprot.ReadMapEndAsync(cancellationToken);
}
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
default:
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
break;
}
await iprot.ReadFieldEndAsync(cancellationToken);
}
await iprot.ReadStructEndAsync(cancellationToken);
if (!isset_client_protocol)
{
throw new TProtocolException(TProtocolException.INVALID_DATA);
}
if (!isset_zoneId)
{
throw new TProtocolException(TProtocolException.INVALID_DATA);
}
if (!isset_username)
{
throw new TProtocolException(TProtocolException.INVALID_DATA);
}
}
finally
{
iprot.DecrementRecursionDepth();
}
}
public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
{
oprot.IncrementRecursionDepth();
try
{
var struc = new TStruct("TSOpenSessionReq");
await oprot.WriteStructBeginAsync(struc, cancellationToken);
var field = new TField();
field.Name = "client_protocol";
field.Type = TType.I32;
field.ID = 1;
await oprot.WriteFieldBeginAsync(field, cancellationToken);
await oprot.WriteI32Async((int)Client_protocol, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
if((ZoneId != null))
{
field.Name = "zoneId";
field.Type = TType.String;
field.ID = 2;
await oprot.WriteFieldBeginAsync(field, cancellationToken);
await oprot.WriteStringAsync(ZoneId, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Username != null))
{
field.Name = "username";
field.Type = TType.String;
field.ID = 3;
await oprot.WriteFieldBeginAsync(field, cancellationToken);
await oprot.WriteStringAsync(Username, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Password != null) && __isset.password)
{
field.Name = "password";
field.Type = TType.String;
field.ID = 4;
await oprot.WriteFieldBeginAsync(field, cancellationToken);
await oprot.WriteStringAsync(Password, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((Configuration != null) && __isset.configuration)
{
field.Name = "configuration";
field.Type = TType.Map;
field.ID = 5;
await oprot.WriteFieldBeginAsync(field, cancellationToken);
{
await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.String, Configuration.Count), cancellationToken);
foreach (string _iter69 in Configuration.Keys)
{
await oprot.WriteStringAsync(_iter69, cancellationToken);
await oprot.WriteStringAsync(Configuration[_iter69], cancellationToken);
}
await oprot.WriteMapEndAsync(cancellationToken);
}
await oprot.WriteFieldEndAsync(cancellationToken);
}
await oprot.WriteFieldStopAsync(cancellationToken);
await oprot.WriteStructEndAsync(cancellationToken);
}
finally
{
oprot.DecrementRecursionDepth();
}
}
public override bool Equals(object that)
{
if (!(that is TSOpenSessionReq other)) return false;
if (ReferenceEquals(this, other)) return true;
return System.Object.Equals(Client_protocol, other.Client_protocol)
&& System.Object.Equals(ZoneId, other.ZoneId)
&& System.Object.Equals(Username, other.Username)
&& ((__isset.password == other.__isset.password) && ((!__isset.password) || (System.Object.Equals(Password, other.Password))))
&& ((__isset.configuration == other.__isset.configuration) && ((!__isset.configuration) || (TCollections.Equals(Configuration, other.Configuration))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
hashcode = (hashcode * 397) + Client_protocol.GetHashCode();
if((ZoneId != null))
{
hashcode = (hashcode * 397) + ZoneId.GetHashCode();
}
if((Username != null))
{
hashcode = (hashcode * 397) + Username.GetHashCode();
}
if((Password != null) && __isset.password)
{
hashcode = (hashcode * 397) + Password.GetHashCode();
}
if((Configuration != null) && __isset.configuration)
{
hashcode = (hashcode * 397) + TCollections.GetHashCode(Configuration);
}
}
return hashcode;
}
public override string ToString()
{
var sb = new StringBuilder("TSOpenSessionReq(");
sb.Append(", Client_protocol: ");
Client_protocol.ToString(sb);
if((ZoneId != null))
{
sb.Append(", ZoneId: ");
ZoneId.ToString(sb);
}
if((Username != null))
{
sb.Append(", Username: ");
Username.ToString(sb);
}
if((Password != null) && __isset.password)
{
sb.Append(", Password: ");
Password.ToString(sb);
}
if((Configuration != null) && __isset.configuration)
{
sb.Append(", Configuration: ");
Configuration.ToString(sb);
}
sb.Append(')');
return sb.ToString();
}
}