boost::redis::resp3::flat_tree

A generic response that stores data contiguously.

Synopsis

class flat_tree;

Description

Implements a container of RESP3 nodes. It's similar to boost::redis::resp3::tree, but node data is stored contiguously. This allows for amortized no allocations when re‐using flat_tree objects. Like tree, it can contain the response to several Redis commands or several server pushes. Use get_total_msgs to obtain how many responses this object contains.

Objects are typically created by the user and passed to connection::async_exec to be used as response containers. Call get_view to access the actual RESP3 nodes. Once populated, flat_tree can't be modified, except for clear and assignment.

A flat_tree is conceptually similar to a pair of std::vector objects, one holding resp3::node_view objects, and another owning the the string data that these views point to. The node capacity and the data capacity are the capacities of these two vectors.

Member Functions

Name

Description

flat_tree [constructor]

Constructors

operator=

Assignment operators

reserve

Reserves capacity for incoming data.

clear

Clears the tree so it contains no nodes.

data_size

Returns the size of the data buffer, in bytes.

data_capacity

Returns the capacity of the data buffer, in bytes.

get_view

Returns a vector with the nodes in the tree.

get_reallocs

Returns the number of memory reallocations that took place in the data buffer.

get_total_msgs

Returns the number of complete RESP3 messages contained in this object.

Friends

Name Description

boost::redis::adapter::detail::general_aggregate

boost::redis::resp3::operator!=

Inequality operator.

boost::redis::resp3::operator==

Equality operator.

Non-Member Functions

Name

Description

operator!=

Inequality operator.

operator==

Equality operator.

Created with MrDocs