Beispiel #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();
        }
    }
Beispiel #2
0
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_row     = false;
            bool   isset_columns = 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)
                    {
                        {
                            Columns = new List <TColumnIncrement>();
                            TList _list35 = await iprot.ReadListBeginAsync(cancellationToken);

                            for (int _i36 = 0; _i36 < _list35.Count; ++_i36)
                            {
                                TColumnIncrement _elem37;
                                _elem37 = new TColumnIncrement();
                                await _elem37.ReadAsync(iprot, cancellationToken);

                                Columns.Add(_elem37);
                            }
                            await iprot.ReadListEndAsync(cancellationToken);
                        }
                        isset_columns = true;
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

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

                            for (int _i39 = 0; _i39 < _map38.Count; ++_i39)
                            {
                                byte[] _key40;
                                byte[] _val41;
                                _key40 = await iprot.ReadBinaryAsync(cancellationToken);

                                _val41 = await iprot.ReadBinaryAsync(cancellationToken);

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

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

                case 6:
                    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_columns)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }