Пример #1
0
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_row          = false;
            bool   isset_columnValues = 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.String)
                    {
                        Row = await iprot.ReadBinaryAsync(cancellationToken);

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

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            ColumnValues = new List <TColumnValue>();
                            TList _list17 = await iprot.ReadListBeginAsync(cancellationToken);

                            for (int _i18 = 0; _i18 < _list17.Count; ++_i18)
                            {
                                TColumnValue _elem19;
                                _elem19 = new TColumnValue();
                                await _elem19.ReadAsync(iprot, cancellationToken);

                                ColumnValues.Add(_elem19);
                            }
                            await iprot.ReadListEndAsync(cancellationToken);
                        }
                        isset_columnValues = true;
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I64)
                    {
                        Timestamp = await iprot.ReadI64Async(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 5:
                    if (field.Type == TType.Map)
                    {
                        {
                            Attributes = new Dictionary <byte[], byte[]>();
                            TMap _map20 = await iprot.ReadMapBeginAsync(cancellationToken);

                            for (int _i21 = 0; _i21 < _map20.Count; ++_i21)
                            {
                                byte[] _key22;
                                byte[] _val23;
                                _key22 = await iprot.ReadBinaryAsync(cancellationToken);

                                _val23 = await iprot.ReadBinaryAsync(cancellationToken);

                                Attributes[_key22] = _val23;
                            }
                            await iprot.ReadMapEndAsync(cancellationToken);
                        }
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 6:
                    if (field.Type == TType.I32)
                    {
                        Durability = (TDurability)await iprot.ReadI32Async(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 7:
                    if (field.Type == TType.Struct)
                    {
                        CellVisibility = new TCellVisibility();
                        await CellVisibility.ReadAsync(iprot, 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_row)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_columnValues)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
Пример #2
0
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_columnValues = 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.String)
                    {
                        Row = await iprot.ReadBinaryAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            ColumnValues = new List <TColumnValue>();
                            TList _list0 = await iprot.ReadListBeginAsync(cancellationToken);

                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                TColumnValue _elem2;
                                _elem2 = new TColumnValue();
                                await _elem2.ReadAsync(iprot, cancellationToken);

                                ColumnValues.Add(_elem2);
                            }
                            await iprot.ReadListEndAsync(cancellationToken);
                        }
                        isset_columnValues = true;
                    }
                    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_columnValues)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }