MySQL 8.0.39
Source Code Documentation
Gcs_xcom_input_queue_impl< Queue > Class Template Reference

MPSC queue with FIFO semantics used to send commands to XCom. More...

#include <gcs_xcom_input_queue.h>

Classes

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

Public Types

using future_reply = std::future< std::unique_ptr< Reply > >
 

Public Member Functions

 Gcs_xcom_input_queue_impl () noexcept
 
 ~Gcs_xcom_input_queue_impl ()
 
 Gcs_xcom_input_queue_impl (Gcs_xcom_input_queue_impl const &)=delete
 
 Gcs_xcom_input_queue_impl (Gcs_xcom_input_queue_impl &&)=delete
 
Gcs_xcom_input_queue_imploperator= (Gcs_xcom_input_queue_impl const &)=delete
 
Gcs_xcom_input_queue_imploperator= (Gcs_xcom_input_queue_impl &&)=delete
 
bool push (app_data_ptr msg)
 Sends the command msg to XCom. More...
 
future_reply push_and_get_reply (app_data_ptr msg)
 Sends the command msg to XCom. More...
 
xcom_input_request_ptr pop ()
 Attempts to retrieve all the queued app_data_ptr in one swoop. More...
 
void reset ()
 Empties the queue. More...
 

Private Member Functions

Replypush_internal (app_data_ptr msg, xcom_input_reply_function_ptr reply_function)
 Internal helper to implement push and @ push_and_get_reply. More...
 

Private Attributes

Queue m_queue
 

Detailed Description

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

MPSC queue with FIFO semantics used to send commands to XCom.

Member Typedef Documentation

◆ future_reply

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
using Gcs_xcom_input_queue_impl< Queue >::future_reply = std::future<std::unique_ptr<Reply> >

Constructor & Destructor Documentation

◆ Gcs_xcom_input_queue_impl() [1/3]

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

◆ ~Gcs_xcom_input_queue_impl()

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

◆ Gcs_xcom_input_queue_impl() [2/3]

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl< Queue >::Gcs_xcom_input_queue_impl ( Gcs_xcom_input_queue_impl< Queue > const &  )
delete

◆ Gcs_xcom_input_queue_impl() [3/3]

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl< Queue >::Gcs_xcom_input_queue_impl ( Gcs_xcom_input_queue_impl< Queue > &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl & Gcs_xcom_input_queue_impl< Queue >::operator= ( Gcs_xcom_input_queue_impl< Queue > &&  )
delete

◆ operator=() [2/2]

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Gcs_xcom_input_queue_impl & Gcs_xcom_input_queue_impl< Queue >::operator= ( Gcs_xcom_input_queue_impl< Queue > const &  )
delete

◆ pop()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
xcom_input_request_ptr Gcs_xcom_input_queue_impl< Queue >::pop ( )
inline

Attempts to retrieve all the queued app_data_ptr in one swoop.

Transfers ownership of the returned pointer(s). Note that this method is non-blocking.

Return values
app_data_ptrlinked list of the queued commands if the queue is not empty
nullptrif the queue is empty

◆ push()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
bool Gcs_xcom_input_queue_impl< Queue >::push ( app_data_ptr  msg)
inline

Sends the command msg to XCom.

This method has fire-and-forget semantics, i.e. we do not wait or have access to any potential reply from XCom. Takes ownership of msg.

Parameters
msgthe app_data_ptr to send to XCom
Return values
falseif there is no memory available
trueotherwise (operation was successful)

◆ push_and_get_reply()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
future_reply Gcs_xcom_input_queue_impl< Queue >::push_and_get_reply ( app_data_ptr  msg)
inline

Sends the command msg to XCom.

This method has request-response semantics, i.e. we get back a future on which we must wait for XCom's reply. Please note that you must retrieve the future's value, otherwise it will leak. If you do not care for a reply, use push instead. Takes ownership of msg.

Parameters
msgthe app_data_ptr to send to XCom
Returns
a valid future (future.valid()) if successful, an invalid future (!future.valid()) otherwise.

◆ push_internal()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Reply * Gcs_xcom_input_queue_impl< Queue >::push_internal ( app_data_ptr  msg,
xcom_input_reply_function_ptr  reply_function 
)
inlineprivate

Internal helper to implement push and @ push_and_get_reply.

Creates and pushes a request to XCom with the payload msg and using the reply strategy reply_function.

Parameters
msgthe request's payload
reply_functionthe reply strategy for this request
Return values
Reply*if successful
nullptrif unsuccessful

◆ reset()

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
void Gcs_xcom_input_queue_impl< Queue >::reset ( )
inline

Empties the queue.

Member Data Documentation

◆ m_queue

template<typename Queue = Gcs_mpsc_queue<xcom_input_request, xcom_input_request_ptr_deleter>>
Queue Gcs_xcom_input_queue_impl< Queue >::m_queue
private

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