A partition chunk representing either a data message or a control message. More...
#include <chunk.hpp>
Public Member Functions | |
| Chunk (Chunk &&other) noexcept=default | |
| move constructor More... | |
| Chunk & | operator= (Chunk &&other) noexcept=default |
| move assignment operator More... | |
| Chunk (Chunk const &)=delete | |
| Chunk & | operator= (Chunk const &)=delete |
| constexpr ChunkID | chunk_id () const |
| The ID of the chunk. More... | |
| constexpr PartID | part_id () const |
| Partition ID of the message. More... | |
| constexpr std::size_t | expected_num_chunks () const |
| The expected number of chunks for the message. More... | |
| constexpr bool | is_control_message () const |
| Whether the message is a control message. More... | |
| constexpr std::uint32_t | metadata_size () const |
| Get the size of the metadata of the message. More... | |
| constexpr std::size_t | data_size () const |
| Get the size of the packed data of the message. More... | |
| void | set_data_buffer (std::unique_ptr< Buffer > data) |
| Set the data buffer. More... | |
| bool | is_data_buffer_set () const |
| Whether the data buffer is set. More... | |
| bool | is_metadata_buffer_set () const |
| Whether the metadata buffer is set. More... | |
| MemoryType | data_memory_type () const |
| Get the memory type of the data buffer. More... | |
| std::unique_ptr< std::vector< std::uint8_t > > | release_metadata_buffer () |
| Release the ownership of the metadata buffer. More... | |
| std::unique_ptr< Buffer > | release_data_buffer () |
| Release the ownership of the data buffer. More... | |
| bool | is_ready () const |
| Whether the chunk is ready for consumption. More... | |
| std::string | str () const |
| Returns a description of this chunk. More... | |
| std::unique_ptr< std::vector< std::uint8_t > > | serialize () const |
| Returns a metadata message that represents this chunk. More... | |
Static Public Member Functions | |
| static constexpr std::size_t | metadata_message_header_size () |
| The size of the metadata message header. More... | |
| static Chunk | from_packed_data (ChunkID chunk_id, PartID part_id, PackedData &&packed_data) |
| Create a chunk from a packed data. More... | |
| static Chunk | from_finished_partition (ChunkID chunk_id, PartID part_id, std::size_t expected_num_chunks) |
| Create a chunk for a finished partition (control message). More... | |
| static Chunk | deserialize (std::vector< std::uint8_t > const &msg, BufferResource *br, bool validate=true) |
| Create a chunk by deserializing a metadata message. More... | |
| static bool | validate_format (std::vector< std::uint8_t > const &serialized_buf) |
| Validate if a deserialized buffer follows the Chunk format. More... | |
Friends | |
| Chunk | make_dummy_chunk (ChunkID, PartID) |
A partition chunk representing either a data message or a control message.
A Chunk represents a single message for a partition in the shuffler. There are two types.
Data Message. Contains actual partition data (metadata and optionally GPU data buffer).
expected_num_chunks is 0.is_control_message() returns false.Control Message. Signals partition completion without carrying data.
expected_num_chunks > 0 (indicates total number of data chunks expected).is_control_message() returns true.When serialized, the format is:
|
defaultnoexcept |
move constructor
| other | The chunk to move. |
|
inlineconstexpr |
|
inline |
|
inlineconstexpr |
Get the size of the packed data of the message.
PackedData::data of the message.
|
static |
Create a chunk by deserializing a metadata message.
| msg | The metadata message received from another rank. |
| br | Buffer resource for allocating a the data buffer of the deserialized message. |
| validate | Whether to validate the metadata buffer. |
| std::logic_error | if the chunk is not a control message and no buffer resource is provided. |
| std::runtime_error | if the metadata buffer does not follow the expected format and validate is true. |
|
inlineconstexpr |
|
static |
Create a chunk for a finished partition (control message).
| chunk_id | The ID of the chunk. |
| part_id | The ID of the partition. |
| expected_num_chunks | The expected number of chunks. |
|
static |
Create a chunk from a packed data.
| chunk_id | The ID of the chunk. |
| part_id | The ID of the partition. |
| packed_data | The packed data. |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inlinestaticconstexpr |
|
inlineconstexpr |
Get the size of the metadata of the message.
PackedData::metadata. move assignment operator
| other | The chunk to move. |
|
inlineconstexpr |
|
inline |
|
inline |
| std::unique_ptr<std::vector<std::uint8_t> > rapidsmpf::shuffler::detail::Chunk::serialize | ( | ) | const |
Returns a metadata message that represents this chunk.
|
inline |
| std::string rapidsmpf::shuffler::detail::Chunk::str | ( | ) | const |
Returns a description of this chunk.
|
static |