CqlSharp.Protocol.FrameReader.ReadIntAsync C# (CSharp) Method

ReadIntAsync() public method

Reads the int async.
public ReadIntAsync ( ) : Task
return Task
        public Task<int> ReadIntAsync()
        {
            if(TryGetSegmentFromBuffer(4))
            {
                int value = _lastReadSegment.Array.ToInt(_lastReadSegment.Offset);

                //return cached int value if possible
                return value.AsTask();
            }

            return ReadIntInternalAsync();
        }

Usage Example

Exemplo n.º 1
0
        protected override async Task InitializeAsync()
        {
            FrameReader reader = Reader;

            ResultOpcode = (ResultOpcode)await reader.ReadIntAsync().ConfigureAwait(false);

            switch (ResultOpcode)
            {
            case ResultOpcode.Void:
                break;

            case ResultOpcode.Rows:
                Schema = await ReadCqlSchemaAsync().ConfigureAwait(false);

                _count = await reader.ReadIntAsync().ConfigureAwait(false);

                break;

            case ResultOpcode.SetKeyspace:
                Keyspace = await reader.ReadStringAsync().ConfigureAwait(false);

                break;

            case ResultOpcode.SchemaChange:
                Change = await reader.ReadStringAsync().ConfigureAwait(false);

                Keyspace = await reader.ReadStringAsync().ConfigureAwait(false);

                Table = await reader.ReadStringAsync().ConfigureAwait(false);

                break;

            case ResultOpcode.Prepared:
                PreparedQueryId = await reader.ReadShortBytesAsync().ConfigureAwait(false);

                Schema = await ReadCqlSchemaAsync().ConfigureAwait(false);

                break;

            default:
                throw new ArgumentException("Unexpected ResultOpcode");
            }

            //_readLock = new SemaphoreSlim(1);
        }
All Usage Examples Of CqlSharp.Protocol.FrameReader::ReadIntAsync