#include <gcs_message_stage_split.h>
|
Gcs_message_stage::stage_status | skip_apply (uint64_t const &original_payload_size) const override |
| Check if the apply operation which affects outgoing packets should be executed (i.e. More...
|
|
std::unique_ptr< Gcs_stage_metadata > | get_stage_header () override |
|
| Gcs_message_stage_split_v2 (bool enabled, unsigned long long split_threshold) |
| Creates an instance of the stage. More...
|
|
| ~Gcs_message_stage_split_v2 () override |
|
Stage_code | get_stage_code () const override |
| Return the stage code. More...
|
|
bool | update_members_information (const Gcs_member_identifier &me, const Gcs_xcom_nodes &xcom_nodes) override |
| Update the list of members in the group as this is required to process split messages. More...
|
|
void | set_threshold (unsigned long long split_threshold) |
| Sets the threshold in bytes after which messages are split. More...
|
|
| Gcs_message_stage () |
|
| Gcs_message_stage (bool enabled) |
|
virtual | ~Gcs_message_stage ()=default |
|
std::pair< bool, std::vector< Gcs_packet > > | apply (Gcs_packet &&packet) |
| Apply some transformation to the outgoing packet, and return a set of one, or more, transformed packets. More...
|
|
std::pair< Gcs_pipeline_incoming_result, Gcs_packet > | revert (Gcs_packet &&packet) |
| Revert some transformation from the incoming packet, and return one, or none, transformed packet. More...
|
|
bool | is_enabled () const |
| Return whether the message stage is enabled or not. More...
|
|
void | set_enabled (bool is_enabled) |
| Enable or disable the message stage. More...
|
|
|
std::pair< bool, std::vector< Gcs_packet > > | apply_transformation (Gcs_packet &&packet) override |
| Implements the logic of this stage's transformation to the packet, and returns a set of one, or more, transformed packets. More...
|
|
std::pair< Gcs_pipeline_incoming_result, Gcs_packet > | revert_transformation (Gcs_packet &&packet) override |
| Implements the logic to revert this stage's transformation to the packet, and returns one, or none, transformed packet. More...
|
|
Gcs_message_stage::stage_status | skip_revert (const Gcs_packet &packet) const override |
| Check if the revert operation which affects incoming packets should be executed (i.e. More...
|
|
void | encode (unsigned char *header, unsigned short header_length, unsigned long long old_payload_length) |
| Encode the fixed part of the associated dynamic header information into the header buffer. More...
|
|
void | decode (const unsigned char *header, unsigned short *header_length, unsigned long long *old_payload_length) |
| Decode the fixed part of the associated dynamic header information from the header buffer. More...
|
|
◆ Gcs_message_stage_split_v2()
Gcs_message_stage_split_v2::Gcs_message_stage_split_v2 |
( |
bool |
enabled, |
|
|
unsigned long long |
split_threshold |
|
) |
| |
|
inlineexplicit |
Creates an instance of the stage.
- Parameters
-
enabled | enables this message stage |
split_threshold | messages with the payload larger than split_threshold in bytes are split. |
◆ ~Gcs_message_stage_split_v2()
Gcs_message_stage_split_v2::~Gcs_message_stage_split_v2 |
( |
| ) |
|
|
inlineoverride |
◆ apply_transformation()
std::pair< bool, std::vector< Gcs_packet > > Gcs_message_stage_split_v2::apply_transformation |
( |
Gcs_packet && |
packet | ) |
|
|
overrideprotectedvirtual |
Implements the logic of this stage's transformation to the packet, and returns a set of one, or more, transformed packets.
- Parameters
-
[in] | packet | The packet upon which the transformation should be applied |
- Return values
-
{true,_} | If there was an error applying the transformation |
{false,P} | If the transformation was successful, and produced the set of transformed packets P |
Implements Gcs_message_stage.
◆ apply_transformation_single_fragment()
void Gcs_message_stage_split_v2::apply_transformation_single_fragment |
( |
Gcs_packet & |
packet | ) |
const |
|
private |
◆ create_fragment()
std::pair< bool, Gcs_packet > Gcs_message_stage_split_v2::create_fragment |
( |
unsigned int const & |
fragment_part_id, |
|
|
Gcs_packet const & |
other_fragment, |
|
|
unsigned char const *const |
original_payload_pointer, |
|
|
unsigned long long const & |
fragment_size |
|
) |
| const |
|
private |
◆ create_fragments()
std::pair< bool, std::vector< Gcs_packet > > Gcs_message_stage_split_v2::create_fragments |
( |
Gcs_packet && |
packet, |
|
|
unsigned int const & |
nr_fragments |
|
) |
| const |
|
private |
◆ get_fragments()
Fetch the fragments associated with the given metadata.
Removes the fragments from the table of ongoing tranmissions.
This method must only be called if there were previous calls to insert_fragment
, i.e. if given metadata is about a fragmented message.
- Parameters
-
fragment_header | Fragmentation metadata |
- Returns
- the list of already received fragments.
◆ get_snapshot()
◆ get_stage_code()
Stage_code Gcs_message_stage_split_v2::get_stage_code |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ get_stage_header()
◆ insert_fragment()
bool Gcs_message_stage_split_v2::insert_fragment |
( |
Gcs_packet && |
packet | ) |
|
|
private |
Insert a packet into the mapping that keeps track of fragments.
This method must only called when the packet received is part of a fragmented message.
- Parameters
-
packet | fragment Fragment that will be collected to reconstruct the original |
- Returns
- true if successful, false otherwise
◆ insert_sender()
void Gcs_message_stage_split_v2::insert_sender |
( |
const Gcs_sender_id & |
sender_id | ) |
|
|
private |
Insert a sender into the mapping that keeps track of sliced packets.
- Parameters
-
sender_id | Source identification |
◆ is_final_fragment()
bool Gcs_message_stage_split_v2::is_final_fragment |
( |
Gcs_split_header_v2 const & |
fragment_header | ) |
const |
|
private |
◆ reassemble_fragments()
Reassembles the given fragment list into the original, whole packet.
This method must only be called with a non-empty packet list.
- Parameters
-
fragments | The list of packet to reassemble |
- Return values
-
{true,Gcs_packet} | If reassembled successfully |
{false,_} | If we could not allocate memory for the reassembled packet |
◆ remove_sender()
void Gcs_message_stage_split_v2::remove_sender |
( |
const Gcs_sender_id & |
sender_id | ) |
|
|
private |
Remove a sender from the mapping that keeps track of sliced packets.
- Parameters
-
sender_id | Source identification |
◆ revert_transformation()
Implements the logic to revert this stage's transformation to the packet, and returns one, or none, transformed packet.
- Parameters
-
[in] | packet | The packet upon which the transformation should be reverted |
- Return values
-
{ERROR,_} | If there was an error reverting the transformation |
{OK_NO_PACKET,NP} | If the transformation was reverted, but produced no packet |
{OK_PACKET,P} | If the transformation was reverted, and produced the packet P |
Implements Gcs_message_stage.
◆ set_threshold()
void Gcs_message_stage_split_v2::set_threshold |
( |
unsigned long long |
split_threshold | ) |
|
|
inline |
Sets the threshold in bytes after which messages are split.
- Parameters
-
split_threshold | If the payload exceeds these many bytes, then the message is split. |
◆ skip_apply()
Check if the apply operation which affects outgoing packets should be executed (i.e.
applied), skipped or aborted.
If the outcome is code apply or code skip, the stage will process or skip the message, respectively. However, if the outcome is code abort, the message will be discarded and an error will be reported thus stopping the pipeline execution.
For example, if a packet's length is less than a pre-defined threshold the packet is not compressed.
- Parameters
-
original_payload_size | The size of the packet to which the transformation should be applied. |
- Returns
- a status specifying whether the transformation should be executed, skipped or aborted
Implements Gcs_message_stage.
◆ skip_revert()
Check if the revert operation which affects incoming packets should be executed (i.e.
applied), skipped or aborted.
If the outcome is code apply or code skip, the stage will process or skip the message, respectively. However, if the outcome is code abort, the message will be discarded and an error will be reported thus stopping the pipeline execution.
For example, if the packet length is greater than the maximum allowed compressed information an error is returned.
- Parameters
-
packet | The packet upon which the transformation should be applied |
- Returns
- a status specifying whether the transformation should be executed, skipped or aborted
Implements Gcs_message_stage.
◆ unknown_sender()
bool Gcs_message_stage_split_v2::unknown_sender |
( |
Gcs_split_header_v2 const & |
fragment_header | ) |
const |
|
private |
◆ update_members_information()
Update the list of members in the group as this is required to process split messages.
- Parameters
-
me | The local member identifier. |
xcom_nodes | List of members in the group. |
- Returns
- If there is an error, true is returned. Otherwise, false is returned.
Reimplemented from Gcs_message_stage.
◆ DEFAULT_THRESHOLD
constexpr unsigned long long Gcs_message_stage_split_v2::DEFAULT_THRESHOLD = 1048576 |
|
staticconstexpr |
◆ m_next_message_number
std::atomic<Gcs_message_id> Gcs_message_stage_split_v2::m_next_message_number {1} |
|
private |
Unique message identifier per sender.
◆ m_packets_per_source
◆ m_sender_id
Unique sender identifier that is dynamically generated when a node rejoins the group.
◆ m_split_threshold
This marks the threshold in bytes above which a message shall be split.
The documentation for this class was generated from the following files: