コード例 #1
0
        public SpanRef DeepCopy()
        {
            var tmp8 = new SpanRef();

            tmp8.RefType     = this.RefType;
            tmp8.TraceIdLow  = this.TraceIdLow;
            tmp8.TraceIdHigh = this.TraceIdHigh;
            tmp8.SpanId      = this.SpanId;
            return(tmp8);
        }
コード例 #2
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_traceIdLow    = false;
                bool   isset_traceIdHigh   = false;
                bool   isset_spanId        = false;
                bool   isset_parentSpanId  = false;
                bool   isset_operationName = false;
                bool   isset_flags         = false;
                bool   isset_startTime     = false;
                bool   isset_duration      = 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.I64)
                        {
                            TraceIdLow = await iprot.ReadI64Async(cancellationToken);

                            isset_traceIdLow = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I64)
                        {
                            TraceIdHigh = await iprot.ReadI64Async(cancellationToken);

                            isset_traceIdHigh = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I64)
                        {
                            SpanId = await iprot.ReadI64Async(cancellationToken);

                            isset_spanId = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.I64)
                        {
                            ParentSpanId = await iprot.ReadI64Async(cancellationToken);

                            isset_parentSpanId = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.String)
                        {
                            OperationName = await iprot.ReadStringAsync(cancellationToken);

                            isset_operationName = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.List)
                        {
                            {
                                TList _list4 = await iprot.ReadListBeginAsync(cancellationToken);

                                References = new List <SpanRef>(_list4.Count);
                                for (int _i5 = 0; _i5 < _list4.Count; ++_i5)
                                {
                                    SpanRef _elem6;
                                    _elem6 = new SpanRef();
                                    await _elem6.ReadAsync(iprot, cancellationToken);

                                    References.Add(_elem6);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.I32)
                        {
                            Flags = await iprot.ReadI32Async(cancellationToken);

                            isset_flags = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.I64)
                        {
                            StartTime = await iprot.ReadI64Async(cancellationToken);

                            isset_startTime = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.I64)
                        {
                            Duration = await iprot.ReadI64Async(cancellationToken);

                            isset_duration = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.List)
                        {
                            {
                                TList _list7 = await iprot.ReadListBeginAsync(cancellationToken);

                                Tags = new List <Tag>(_list7.Count);
                                for (int _i8 = 0; _i8 < _list7.Count; ++_i8)
                                {
                                    Tag _elem9;
                                    _elem9 = new Tag();
                                    await _elem9.ReadAsync(iprot, cancellationToken);

                                    Tags.Add(_elem9);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 11:
                        if (field.Type == TType.List)
                        {
                            {
                                TList _list10 = await iprot.ReadListBeginAsync(cancellationToken);

                                Logs = new List <Log>(_list10.Count);
                                for (int _i11 = 0; _i11 < _list10.Count; ++_i11)
                                {
                                    Log _elem12;
                                    _elem12 = new Log();
                                    await _elem12.ReadAsync(iprot, cancellationToken);

                                    Logs.Add(_elem12);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);

                if (!isset_traceIdLow)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_traceIdHigh)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_spanId)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_parentSpanId)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_operationName)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_flags)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_startTime)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_duration)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }