Public Member Functions | List of all members
rapidsmpf::communicator::MetadataPayloadExchange::Message Class Reference

Message class for communication. More...

#include <core.hpp>

Public Member Functions

 Message (Rank peer_rank, std::vector< std::uint8_t > &&metadata, std::unique_ptr< Buffer > data=nullptr)
 Construct a new Message. More...
 
constexpr Rank peer_rank () const noexcept
 Get the destination rank for outgoing or source rank for incoming messages. More...
 
constexpr std::vector< std::uint8_t > const & metadata () const noexcept
 Get the serialized metadata for this message. More...
 
std::vector< std::uint8_t > release_metadata () noexcept
 Release ownership of the metadata. More...
 
Buffer const * data () const
 Get the data buffer for this message. More...
 
std::unique_ptr< Bufferrelease_data () noexcept
 Release ownership of the data buffer. More...
 
void set_data (std::unique_ptr< Buffer > buffer)
 Set the data buffer for this message. More...
 

Detailed Description

Message class for communication.

This class contains the essential information needed for communication: data payload, metadata, and peer rank (source/destination).

Definition at line 55 of file core.hpp.

Constructor & Destructor Documentation

◆ Message()

rapidsmpf::communicator::MetadataPayloadExchange::Message::Message ( Rank  peer_rank,
std::vector< std::uint8_t > &&  metadata,
std::unique_ptr< Buffer data = nullptr 
)

Construct a new Message.

Parameters
peer_rankDestination (outgoing) or source (incoming) rank.
metadataSerialized metadata.
dataData buffer (can be nullptr for metadata-only messages).

Member Function Documentation

◆ data()

Buffer const* rapidsmpf::communicator::MetadataPayloadExchange::Message::data ( ) const

Get the data buffer for this message.

Returns
The data buffer, or nullptr if no data.

◆ metadata()

constexpr std::vector<std::uint8_t> const& rapidsmpf::communicator::MetadataPayloadExchange::Message::metadata ( ) const
inlineconstexprnoexcept

Get the serialized metadata for this message.

This metadata is sent first to inform the receiver about the incoming message.

Returns
The serialized metadata.

Definition at line 88 of file core.hpp.

◆ peer_rank()

constexpr Rank rapidsmpf::communicator::MetadataPayloadExchange::Message::peer_rank ( ) const
inlineconstexprnoexcept

Get the destination rank for outgoing or source rank for incoming messages.

Returns
The rank of the destination or source.

Definition at line 76 of file core.hpp.

◆ release_data()

std::unique_ptr<Buffer> rapidsmpf::communicator::MetadataPayloadExchange::Message::release_data ( )
noexcept

Release ownership of the data buffer.

This is typically called when transferring a buffer to the communication layer.

Returns
Data buffer with ownership transferred, or nullptr if no data.

◆ release_metadata()

std::vector<std::uint8_t> rapidsmpf::communicator::MetadataPayloadExchange::Message::release_metadata ( )
noexcept

Release ownership of the metadata.

This is typically called when transferring metadata to the communication layer.

Returns
Metadata with ownership transferred.

◆ set_data()

void rapidsmpf::communicator::MetadataPayloadExchange::Message::set_data ( std::unique_ptr< Buffer buffer)

Set the data buffer for this message.

This method can be used by implementations to update the data buffer.

Parameters
bufferData buffer to be set.

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