Skip to content

Commit

Permalink
iox-#27 Merge ConsumerTooSlowPolicy and SubscriberTooSlowPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Feb 9, 2022
1 parent 2bd74be commit 33bcc14
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
26 changes: 13 additions & 13 deletions iceoryx_posh/include/iceoryx_posh/popo/port_queue_policies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ namespace iox
{
namespace popo
{
/// @brief Used by publisher
/// @todo iox-#27 replace with ConsumerTooSlowPolicy
enum class SubscriberTooSlowPolicy : uint8_t
/// @brief Used by producers how to adjust to slow consumer
enum class ConsumerTooSlowPolicy : uint8_t
{
WAIT_FOR_SUBSCRIBER,
/// Waits for the consumer it it's queue is full
WAIT_FOR_CONSUMER,
/// @deprecated Compatibility value for the legacy use with publisher only. Will be remove in a future release.
/// Please use `WAIT_FOR_CONSUMER` instead.
WAIT_FOR_SUBSCRIBER = WAIT_FOR_CONSUMER,
/// Discards the oldest data and pushes the newest one into the queue
DISCARD_OLDEST_DATA
};
/// @deprecated Compatibility alias for the legacy use with publisher only. Will be remove in a future release.
/// Please use `ConsumerTooSlowPolicy` instead.
/// @todo iox-#27 decide whether this should be hard deprecated with [[deprecated]] attribute for the next release
using SubscriberTooSlowPolicy = ConsumerTooSlowPolicy;

/// @brief Used by consumers to request a specific behavior from the producer
enum class QueueFullPolicy : uint8_t
{
Expand All @@ -42,15 +51,6 @@ enum class QueueFullPolicy : uint8_t
DISCARD_OLDEST_DATA
};

/// @brief Used by producers how to adjust to slow consumer
enum class ConsumerTooSlowPolicy : uint8_t
{
/// Waits for the consumer it it's queue is full
WAIT_FOR_CONSUMER,
/// Discards the oldest data and pushes the newest one into the queue
DISCARD_OLDEST_DATA
};

} // namespace popo
} // namespace iox
#endif // IOX_POSH_POPO_PORT_QUEUE_POLICIES_HPP
5 changes: 1 addition & 4 deletions iceoryx_posh/source/popo/ports/client_port_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ ClientPortData::ClientPortData(const capro::ServiceDescription& serviceDescripti
mepoo::MemoryManager* const memoryManager,
const mepoo::MemoryInfo& memoryInfo) noexcept
: BasePortData(serviceDescription, runtimeName, clientOptions.nodeName)
, m_chunkSenderData(memoryManager,
static_cast<SubscriberTooSlowPolicy>(clientOptions.serverTooSlowPolicy),
HISTORY_CAPACITY_ZERO,
memoryInfo)
, m_chunkSenderData(memoryManager, clientOptions.serverTooSlowPolicy, HISTORY_CAPACITY_ZERO, memoryInfo)
, m_chunkReceiverData(getResponseQueueType(clientOptions.responseQueueFullPolicy),
clientOptions.responseQueueFullPolicy)
, m_connectRequested(clientOptions.connectOnCreate)
Expand Down
6 changes: 1 addition & 5 deletions iceoryx_posh/source/popo/ports/server_port_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace iox
{
namespace popo
{
/// @todo iox-#27 remove when the port queue policies are consolidated
cxx::VariantQueueTypes getRequestQueueType(const QueueFullPolicy policy) noexcept
{
return policy == QueueFullPolicy::DISCARD_OLDEST_DATA ? cxx::VariantQueueTypes::SoFi_MultiProducerSingleConsumer
Expand All @@ -34,10 +33,7 @@ ServerPortData::ServerPortData(const capro::ServiceDescription& serviceDescripti
mepoo::MemoryManager* const memoryManager,
const mepoo::MemoryInfo& memoryInfo) noexcept
: BasePortData(serviceDescription, runtimeName, serverOptions.nodeName)
, m_chunkSenderData(memoryManager,
static_cast<SubscriberTooSlowPolicy>(serverOptions.clientTooSlowPolicy),
HISTORY_REQUEST_OF_ZERO,
memoryInfo)
, m_chunkSenderData(memoryManager, serverOptions.clientTooSlowPolicy, HISTORY_REQUEST_OF_ZERO, memoryInfo)
, m_chunkReceiverData(getRequestQueueType(serverOptions.requestQueueFullPolicy),
serverOptions.requestQueueFullPolicy)
, m_offeringRequested(serverOptions.offerOnCreate)
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/source/popo/ports/server_port_roudi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ServerPortRouDi::MemberType_t* ServerPortRouDi::getMembers() noexcept

ConsumerTooSlowPolicy ServerPortRouDi::getClientTooSlowPolicy() const noexcept
{
return static_cast<ConsumerTooSlowPolicy>(getMembers()->m_chunkSenderData.m_subscriberTooSlowPolicy);
return getMembers()->m_chunkSenderData.m_subscriberTooSlowPolicy;
}

cxx::optional<capro::CaproMessage> ServerPortRouDi::tryGetCaProMessage() noexcept
Expand Down

0 comments on commit 33bcc14

Please sign in to comment.