packed_data.hpp
1 
6 #pragma once
7 
8 #include <rapidsmpf/buffer/content_description.hpp>
9 #include <rapidsmpf/buffer/packed_data.hpp>
10 #include <rapidsmpf/streaming/core/message.hpp>
11 
13 
22 };
23 
31  return ContentDescription{
32  {{obj.data.data->mem_type(), obj.data.data->size}},
33  ContentDescription::Spillable::YES
34  };
35 }
36 
45  std::uint64_t sequence_number, std::unique_ptr<PackedDataChunk> chunk
46 ) {
47  auto cd = get_content_description(*chunk);
48  return Message{
49  sequence_number,
50  std::move(chunk),
51  cd,
52  [](Message const& msg, MemoryReservation& reservation) -> Message {
53  auto const& self = msg.get<PackedDataChunk>();
54  auto chunk = std::make_unique<PackedDataChunk>(self.data.copy(reservation));
55  auto cd = get_content_description(*chunk);
56  return Message{msg.sequence_number(), std::move(chunk), cd, msg.copy_cb()};
57  }
58  };
59 }
60 
61 } // namespace rapidsmpf::streaming
Description of an object's content.
Represents a reservation for future memory allocation.
Definition: resource.hpp:33
Type-erased message wrapper around a payload.
Definition: message.hpp:27
T const & get() const
Reference to the payload.
Definition: message.hpp:161
constexpr std::uint64_t sequence_number() const noexcept
Returns the sequence number of this message.
Definition: message.hpp:136
Message to_message(std::uint64_t sequence_number, std::unique_ptr< PackedDataChunk > chunk)
Wrap a PackedDataChunk into a Message.
Definition: packed_data.hpp:44
ContentDescription get_content_description(PackedDataChunk const &obj)
Generate a content description for a PackedDataChunk.
Definition: packed_data.hpp:30
Bag of bytes with metadata suitable for sending over the wire.
Definition: packed_data.hpp:26
std::unique_ptr< Buffer > data
The GPU data.
Definition: packed_data.hpp:28
PackedData data
Packed data payload.
Definition: packed_data.hpp:21