MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransporterCallback Class Reference

#include <TransporterCallback.hpp>

Inheritance diagram for TransporterCallback:

Public Member Functions

virtual void deliver_signal (SignalHeader *const header, Uint8 prio, Uint32 *const signalData, LinearSectionPtr ptr[3])=0
virtual int checkJobBuffer ()=0
virtual void reportSendLen (NodeId nodeId, Uint32 count, Uint64 bytes)=0
virtual void reportReceiveLen (NodeId nodeId, Uint32 count, Uint64 bytes)=0
virtual void reportConnect (NodeId nodeId)=0
virtual void reportDisconnect (NodeId nodeId, Uint32 errNo)=0
virtual void reportError (NodeId nodeId, TransporterError errorCode, const char *info=0)=0
virtual void transporter_recv_from (NodeId node)=0
virtual void lock_transporter (NodeId node)
virtual void unlock_transporter (NodeId node)
virtual Uint32 get_bytes_to_send_iovec (NodeId, struct iovec *dst, Uint32)=0
virtual Uint32 bytes_sent (NodeId node, Uint32 bytes)=0
virtual bool has_data_to_send (NodeId node)=0
virtual void reset_send_buffer (NodeId node, bool should_be_empty=false)=0

Detailed Description

The TransporterCallback class encapsulates those aspects of the transporter code that is specific to particular upper layer (NDB API, single-threaded kernel, or multi-threaded kernel).

Definition at line 304 of file TransporterCallback.hpp.

Member Function Documentation

virtual Uint32 TransporterCallback::bytes_sent ( NodeId  node,
Uint32  bytes 
)
pure virtual

Called when data has been sent, allowing to free / reuse the space. Passes number of bytes sent.

Note that this may be less than the sum of all iovec::iov_len supplied (in case of partial send). In particular, one iovec entry may have been partially sent, and may not be freed until another call to bytes_sent() which covers the rest of its data.

Returns total amount of unsent data in send buffers for this node.

Like get_bytes_to_send_iovec(), this is called during performSend().

Implemented in trp_callback, and TransporterFacade.

virtual int TransporterCallback::checkJobBuffer ( )
pure virtual

This method is called regularly (currently after receive from each transporter) by the transporter code.

It provides an opportunity for the upper layer to interleave signal handling with signal reception, if so desired, so as to not needlessly overflow the received signals job buffers. Ie. the single-threaded kernel implementation currently executes received signals if the job buffer reaches a certain percentage of occupancy.

The method should return non-zero if signals were execute, zero if not.

Implemented in trp_callback, and TransporterFacade.

Here is the caller graph for this function:

virtual void TransporterCallback::deliver_signal ( SignalHeader *const  header,
Uint8  prio,
Uint32 *const  signalData,
LinearSectionPtr  ptr[3] 
)
pure virtual

This method is called to deliver a signal to the upper layer.

The method may either execute the signal immediately (NDB API), or queue it for later execution (kernel).

Implemented in TransporterFacade, and TransporterCallbackKernel.

virtual Uint32 TransporterCallback::get_bytes_to_send_iovec ( NodeId  ,
struct iovec dst,
Uint32   
)
pure virtual

ToDo: In current patch, these are not used, instead we use default implementations in TransporterRegistry. Ask upper layer to supply a list of struct iovec's with data to send to a node.

The call should fill in data from all threads (if any).

The call will write at most MAX iovec structures starting at DST.

Returns number of entries filled-in on success, -1 on error.

Will be called from the thread that does performSend(), so multi-threaded use cases must be prepared for that and do any necessary locking.

Implemented in trp_callback, and TransporterFacade.

Here is the caller graph for this function:

virtual bool TransporterCallback::has_data_to_send ( NodeId  node)
pure virtual

Called to check if any data is available for sending with doSend().

Like get_bytes_to_send_iovec(), this is called during performSend().

Implemented in trp_callback, and TransporterFacade.

virtual void TransporterCallback::lock_transporter ( NodeId  node)
inlinevirtual

Locking (no-op in single-threaded VM).

These are used to lock/unlock the transporter for connect and disconnect operation.

Upper layer must implement these so that between return of lock_transporter() and call of unlock_transporter(), no thread will be running simultaneously in performSend() (for that node) or performReceive().

See src/common/transporter/trp.txt for more information.

Reimplemented in trp_callback.

Definition at line 396 of file TransporterCallback.hpp.

Here is the caller graph for this function:

virtual void TransporterCallback::reportConnect ( NodeId  nodeId)
pure virtual

Transporter code calls this method when a connection to a node has been established (state becomes CONNECTED).

This is called from TransporterRegistry::update_connections(), which only runs from the receive thread.

Implemented in TransporterFacade, and TransporterCallbackKernel.

virtual void TransporterCallback::reportDisconnect ( NodeId  nodeId,
Uint32  errNo 
)
pure virtual

Transporter code calls this method when a connection to a node is lost (state becomes DISCONNECTED).

This is called from TransporterRegistry::update_connections(), which only runs from the receive thread.

Implemented in TransporterFacade, and TransporterCallbackKernel.

virtual void TransporterCallback::reportError ( NodeId  nodeId,
TransporterError  errorCode,
const char *  info = 0 
)
pure virtual

Called by transporter code to report error

This is called from TransporterRegistry::update_connections(), which only runs from the receive thread.

Implemented in TransporterFacade, and TransporterCallbackKernel.

Here is the caller graph for this function:

virtual void TransporterCallback::reportReceiveLen ( NodeId  nodeId,
Uint32  count,
Uint64  bytes 
)
pure virtual

Same as reportSendLen(), but for received data.

For multithreaded cases, this is only called while holding the global receive lock.

Implemented in TransporterFacade, and TransporterCallbackKernel.

virtual void TransporterCallback::reportSendLen ( NodeId  nodeId,
Uint32  count,
Uint64  bytes 
)
pure virtual

The transporter periodically calls this method, indicating the number of sends done to one NodeId, as well as total bytes sent.

For multithreaded cases, this is only called while the send lock for the given node is held.

Implemented in trp_callback, and TransporterFacade.

virtual void TransporterCallback::reset_send_buffer ( NodeId  node,
bool  should_be_empty = false 
)
pure virtual

Called to completely empty the send buffer for a node (ie. disconnect).

Can be called to check that no one has written to the sendbuffer since it was reset last time by using the "should_be_emtpy" flag

Implemented in trp_callback, and TransporterFacade.

Here is the caller graph for this function:

virtual void TransporterCallback::transporter_recv_from ( NodeId  node)
pure virtual

Called from transporter code after a successful receive from a node.

Used for heartbeat detection by upper layer.

Implemented in TransporterFacade, and TransporterCallbackKernel.

Here is the caller graph for this function:


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