MySQL 8.0.39
Source Code Documentation
Gcs_xcom_input_queue_impl< Queue >::Reply Class Reference

Wraps XCom's reply to a queued request. More...

#include <gcs_xcom_input_queue.h>

Public Member Functions

 Reply () noexcept
 
 ~Reply ()
 
void resolve (pax_msg *payload)
 Associates the payload of XCom's reply to this object. More...
 
future_reply get_future ()
 Get the future that will hold a pointer to this object after it has been resolved. More...
 
pax_msg const * get_payload ()
 Get XCom's reply. More...
 

Private Attributes

pax_msgm_payload
 XCom's reply. More...
 
std::promise< std::unique_ptr< Reply > > m_promise
 Simultaneously holds the future's shared state and takes care of the lifetime of *this. More...
 

Detailed Description

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
class Gcs_xcom_input_queue_impl< Queue >::Reply

Wraps XCom's reply to a queued request.

A request sent to XCom contains three important pieces of data:

  1. The payload, i.e. what we want XCom to do
  2. A function instructing XCom how to reply to the request
  3. A Reply object (For more details please see xcom_input_request.)

When GCS pushes a request to XCom, GCS receives back a future pointer to the Reply object associated with the request. (future_reply) Basically, this future's result is equivalent to the reply GCS would get if it used a TCP socket to send the request to XCom. XCom will resolve this future when it receives and processes the request. When GCS retrieves the future's result, GCS obtains a std::unique_ptr to the Reply. Unless you do any shenanigans with this std::unique_ptr, when it goes out of scope the Reply object is destroyed. The Reply object owns the payload of XCom's reply (pax_msg), so the Reply object destroys the pax_msg when it is destroyed.

Constructor & Destructor Documentation

◆ Reply()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl< Queue >::Reply::Reply ( )
inlinenoexcept

◆ ~Reply()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl< Queue >::Reply::~Reply ( )
inline

Member Function Documentation

◆ get_future()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
future_reply Gcs_xcom_input_queue_impl< Queue >::Reply::get_future ( )
inline

Get the future that will hold a pointer to this object after it has been resolved.

Returns
a future pointer to this object when it already contains XCom's reply

◆ get_payload()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
pax_msg const * Gcs_xcom_input_queue_impl< Queue >::Reply::get_payload ( )
inline

Get XCom's reply.

Returns
XCom's reply

◆ resolve()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
void Gcs_xcom_input_queue_impl< Queue >::Reply::resolve ( pax_msg payload)
inline

Associates the payload of XCom's reply to this object.

Resolves the future.

Parameters
payloadXCom's reply

Member Data Documentation

◆ m_payload

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
pax_msg* Gcs_xcom_input_queue_impl< Queue >::Reply::m_payload
private

XCom's reply.

◆ m_promise

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
std::promise<std::unique_ptr<Reply> > Gcs_xcom_input_queue_impl< Queue >::Reply::m_promise
private

Simultaneously holds the future's shared state and takes care of the lifetime of *this.


The documentation for this class was generated from the following file: