| /** |
| * Autogenerated by Thrift Compiler (0.14.1) |
| * |
| * 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 TThrottleQuota : TBase |
| { |
| private Dictionary<ThrottleType, TTimedQuota> _throttleLimit; |
| private long _memLimit; |
| private int _cpuLimit; |
| |
| public Dictionary<ThrottleType, TTimedQuota> ThrottleLimit |
| { |
| get |
| { |
| return _throttleLimit; |
| } |
| set |
| { |
| __isset.throttleLimit = true; |
| this._throttleLimit = value; |
| } |
| } |
| |
| public long MemLimit |
| { |
| get |
| { |
| return _memLimit; |
| } |
| set |
| { |
| __isset.memLimit = true; |
| this._memLimit = value; |
| } |
| } |
| |
| public int CpuLimit |
| { |
| get |
| { |
| return _cpuLimit; |
| } |
| set |
| { |
| __isset.cpuLimit = true; |
| this._cpuLimit = value; |
| } |
| } |
| |
| |
| public Isset __isset; |
| public struct Isset |
| { |
| public bool throttleLimit; |
| public bool memLimit; |
| public bool cpuLimit; |
| } |
| |
| public TThrottleQuota() |
| { |
| } |
| |
| public TThrottleQuota DeepCopy() |
| { |
| var tmp77 = new TThrottleQuota(); |
| if((ThrottleLimit != null) && __isset.throttleLimit) |
| { |
| tmp77.ThrottleLimit = this.ThrottleLimit.DeepCopy(); |
| } |
| tmp77.__isset.throttleLimit = this.__isset.throttleLimit; |
| if(__isset.memLimit) |
| { |
| tmp77.MemLimit = this.MemLimit; |
| } |
| tmp77.__isset.memLimit = this.__isset.memLimit; |
| if(__isset.cpuLimit) |
| { |
| tmp77.CpuLimit = this.CpuLimit; |
| } |
| tmp77.__isset.cpuLimit = this.__isset.cpuLimit; |
| return tmp77; |
| } |
| |
| public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) |
| { |
| iprot.IncrementRecursionDepth(); |
| try |
| { |
| TField field; |
| await iprot.ReadStructBeginAsync(cancellationToken); |
| while (true) |
| { |
| field = await iprot.ReadFieldBeginAsync(cancellationToken); |
| if (field.Type == TType.Stop) |
| { |
| break; |
| } |
| |
| switch (field.ID) |
| { |
| case 1: |
| if (field.Type == TType.Map) |
| { |
| { |
| TMap _map78 = await iprot.ReadMapBeginAsync(cancellationToken); |
| ThrottleLimit = new Dictionary<ThrottleType, TTimedQuota>(_map78.Count); |
| for(int _i79 = 0; _i79 < _map78.Count; ++_i79) |
| { |
| ThrottleType _key80; |
| TTimedQuota _val81; |
| _key80 = (ThrottleType)await iprot.ReadI32Async(cancellationToken); |
| _val81 = new TTimedQuota(); |
| await _val81.ReadAsync(iprot, cancellationToken); |
| ThrottleLimit[_key80] = _val81; |
| } |
| await iprot.ReadMapEndAsync(cancellationToken); |
| } |
| } |
| else |
| { |
| await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); |
| } |
| break; |
| case 2: |
| if (field.Type == TType.I64) |
| { |
| MemLimit = await iprot.ReadI64Async(cancellationToken); |
| } |
| else |
| { |
| await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); |
| } |
| break; |
| case 3: |
| if (field.Type == TType.I32) |
| { |
| CpuLimit = await iprot.ReadI32Async(cancellationToken); |
| } |
| else |
| { |
| await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); |
| } |
| break; |
| default: |
| await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); |
| break; |
| } |
| |
| await iprot.ReadFieldEndAsync(cancellationToken); |
| } |
| |
| await iprot.ReadStructEndAsync(cancellationToken); |
| } |
| finally |
| { |
| iprot.DecrementRecursionDepth(); |
| } |
| } |
| |
| public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) |
| { |
| oprot.IncrementRecursionDepth(); |
| try |
| { |
| var struc = new TStruct("TThrottleQuota"); |
| await oprot.WriteStructBeginAsync(struc, cancellationToken); |
| var field = new TField(); |
| if((ThrottleLimit != null) && __isset.throttleLimit) |
| { |
| field.Name = "throttleLimit"; |
| field.Type = TType.Map; |
| field.ID = 1; |
| await oprot.WriteFieldBeginAsync(field, cancellationToken); |
| { |
| await oprot.WriteMapBeginAsync(new TMap(TType.I32, TType.Struct, ThrottleLimit.Count), cancellationToken); |
| foreach (ThrottleType _iter82 in ThrottleLimit.Keys) |
| { |
| await oprot.WriteI32Async((int)_iter82, cancellationToken); |
| await ThrottleLimit[_iter82].WriteAsync(oprot, cancellationToken); |
| } |
| await oprot.WriteMapEndAsync(cancellationToken); |
| } |
| await oprot.WriteFieldEndAsync(cancellationToken); |
| } |
| if(__isset.memLimit) |
| { |
| field.Name = "memLimit"; |
| field.Type = TType.I64; |
| field.ID = 2; |
| await oprot.WriteFieldBeginAsync(field, cancellationToken); |
| await oprot.WriteI64Async(MemLimit, cancellationToken); |
| await oprot.WriteFieldEndAsync(cancellationToken); |
| } |
| if(__isset.cpuLimit) |
| { |
| field.Name = "cpuLimit"; |
| field.Type = TType.I32; |
| field.ID = 3; |
| await oprot.WriteFieldBeginAsync(field, cancellationToken); |
| await oprot.WriteI32Async(CpuLimit, 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 TThrottleQuota other)) return false; |
| if (ReferenceEquals(this, other)) return true; |
| return ((__isset.throttleLimit == other.__isset.throttleLimit) && ((!__isset.throttleLimit) || (TCollections.Equals(ThrottleLimit, other.ThrottleLimit)))) |
| && ((__isset.memLimit == other.__isset.memLimit) && ((!__isset.memLimit) || (System.Object.Equals(MemLimit, other.MemLimit)))) |
| && ((__isset.cpuLimit == other.__isset.cpuLimit) && ((!__isset.cpuLimit) || (System.Object.Equals(CpuLimit, other.CpuLimit)))); |
| } |
| |
| public override int GetHashCode() { |
| int hashcode = 157; |
| unchecked { |
| if((ThrottleLimit != null) && __isset.throttleLimit) |
| { |
| hashcode = (hashcode * 397) + TCollections.GetHashCode(ThrottleLimit); |
| } |
| if(__isset.memLimit) |
| { |
| hashcode = (hashcode * 397) + MemLimit.GetHashCode(); |
| } |
| if(__isset.cpuLimit) |
| { |
| hashcode = (hashcode * 397) + CpuLimit.GetHashCode(); |
| } |
| } |
| return hashcode; |
| } |
| |
| public override string ToString() |
| { |
| var sb = new StringBuilder("TThrottleQuota("); |
| int tmp83 = 0; |
| if((ThrottleLimit != null) && __isset.throttleLimit) |
| { |
| if(0 < tmp83++) { sb.Append(", "); } |
| sb.Append("ThrottleLimit: "); |
| ThrottleLimit.ToString(sb); |
| } |
| if(__isset.memLimit) |
| { |
| if(0 < tmp83++) { sb.Append(", "); } |
| sb.Append("MemLimit: "); |
| MemLimit.ToString(sb); |
| } |
| if(__isset.cpuLimit) |
| { |
| if(0 < tmp83++) { sb.Append(", "); } |
| sb.Append("CpuLimit: "); |
| CpuLimit.ToString(sb); |
| } |
| sb.Append(')'); |
| return sb.ToString(); |
| } |
| } |
| |