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
size
will 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_owner
equals thisField
payload.data
points to a buffer of at leastsize
bytesField
payload.max_size
is 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
data
has no owner, it means it is allocated on the stack of a reception thread, and a copy should be performed. If the ownership ofdata
needs 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_owner
points tothis
.- Parameters:
data – [inout] Serialized payload received
payload – [inout] Destination serialized payload
- Returns:
whether the operation succeeded or not
- Post:
Field
payload.payload_owner
equals thisField
payload.data
points to a buffer of at leastdata.length
bytesField
payload.length
is equal todata.length
Field
payload.max_size
is greater than or equal todata.length
Content of
payload.data
is 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_owner
ofpayload
equals this
- Post:
Field
payload_owner
ofpayload
isnullptr
-
virtual ~IPayloadPool() = default