Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Public Attributes | List of all members
Akumuli::RESPStream Struct Reference

#include <resp.h>

Public Types

enum  { KB = 1024, MB = 1024 * KB, STRING_LENGTH_MAX = 1 * KB, BULK_LENGTH_MAX = 1 * MB }
 
enum  Type {
  STRING, INTEGER, ARRAY, BULK_STR,
  ERROR, BAD
}
 

Public Member Functions

 RESPStream (ByteStreamReader *stream)
 
Type next_type () const
 
uint64_t read_int ()
 
uint64_t _read_int_body ()
 
int read_string (Byte *buffer, size_t buffer_size)
 
int _read_string_body (Byte *buffer, size_t buffer_size)
 
int read_bulkstr (Byte *buffer, size_t buffer_size)
 
uint64_t read_array_size ()
 

Public Attributes

ByteStreamReaderstream_
 

Detailed Description

REdis Serialization Protocol implementation.

Member Function Documentation

uint64_t Akumuli::RESPStream::_read_int_body ( )

Read integer implementation

Exceptions
onerror
Returns
parsed integer
int Akumuli::RESPStream::_read_string_body ( Byte *  buffer,
size_t  buffer_size 
)

Read string implementation

RESPStream::Type Akumuli::RESPStream::next_type ( ) const

Read next element's type.

uint64_t Akumuli::RESPStream::read_array_size ( )

Read size of the array element. Exception is thrown unless next element in a stream is an array. Funtion reads size of the array and puts stream cursor to the first array element.

int Akumuli::RESPStream::read_bulkstr ( Byte *  buffer,
size_t  buffer_size 
)

Read bulk string element. Result is undefined unless next element in a stream is a bulk string.

Parameters
bufferuser suplied buffer
buffer_sizesize of the buffer
Returns
number of bytes copied or negative value on error
uint64_t Akumuli::RESPStream::read_int ( )

Read integer. Result is undefined unless next element in a stream is an integer.

Returns
value
Exceptions
onerror
int Akumuli::RESPStream::read_string ( Byte *  buffer,
size_t  buffer_size 
)

Read string element. Result is undefined unless next element in a stream is a string.

Parameters
bufferuser suplied buffer
buffer_sizesize of the buffer
Returns
number of bytes copied or negative value on error

The documentation for this struct was generated from the following files: