Class IPayloadPool
Defined in File IPayloadPool.hpp
Class Documentation
-
class IPayloadPool
An interface for classes responsible of serialized payload management.
Public Functions
-
virtual ~IPayloadPool() = default
-
virtual bool get_payload(uint32_t size, SerializedPayload_t &payload) = 0
Get a serialized payload for a new sample.
This method will usually be called in one of the following situations:
When a writer creates a new cache change
When a reader receives the first fragment of a cache change
sizewill be for the whole serialized payload.- Parameters:
size – [in] Number of bytes required for the serialized payload.
payload – [inout] Payload of the cache change used in the operation
- Returns:
whether the operation succeeded or not
- Post:
Field
payload.payload_ownerequals thisField
payload.datapoints to a buffer of at leastsizebytesField
payload.max_sizeis greater than or equal tosize
-
virtual bool get_payload(const SerializedPayload_t &data, SerializedPayload_t &payload) = 0
Assign a serialized payload to a new sample.
This method will usually be called when a reader receives a whole cache change.
Note
If
datahas no owner, it means it is allocated on the stack of a reception thread, and a copy should be performed. If the ownership ofdataneeds to be changed, a consecutive call to this method needs to be performed with the arguments swapped, leveraging the post-condition of this method which ensures thatpayload.payload_ownerpoints tothis.- Parameters:
data – [inout] Serialized payload received
payload – [inout] Destination serialized payload
- Returns:
whether the operation succeeded or not
- Post:
Field
payload.payload_ownerequals thisField
payload.datapoints to a buffer of at leastdata.lengthbytesField
payload.lengthis equal todata.lengthField
payload.max_sizeis greater than or equal todata.lengthContent of
payload.datais the same asdata.data
-
virtual bool release_payload(SerializedPayload_t &payload) = 0
Release a serialized payload from a sample.
This method will be called when a cache change is removed from a history.
- Parameters:
payload – [inout] Payload to be released
- Returns:
whether the operation succeeded or not
- Pre:
Field
payload_ownerofpayloadequals this
- Post:
Field
payload_ownerofpayloadisnullptr
-
virtual ~IPayloadPool() = default