{auto} renamed the throttledchannel to AMQP::Throttle, since it is only a wrapper and not strictly a channel (#366)
This commit is contained in:
parent
e4e9358c10
commit
f10e861532
|
|
@ -75,7 +75,7 @@
|
|||
#include "amqpcpp/deferredpublisher.h"
|
||||
#include "amqpcpp/channelimpl.h"
|
||||
#include "amqpcpp/channel.h"
|
||||
#include "amqpcpp/throttledchannel.h"
|
||||
#include "amqpcpp/throttle.h"
|
||||
#include "amqpcpp/login.h"
|
||||
#include "amqpcpp/address.h"
|
||||
#include "amqpcpp/connectionhandler.h"
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ public:
|
|||
/**
|
||||
* Some internal classes may touch our implementation
|
||||
*/
|
||||
friend class ThrottledChannel;
|
||||
friend class Throttle;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* ThrottledChannel.h
|
||||
* Throttle.h
|
||||
*
|
||||
* A channel wrapper that publishes more messages as soon as there is more capacity.
|
||||
*
|
||||
|
|
@ -34,7 +34,7 @@ class Channel;
|
|||
/**
|
||||
* Class definition
|
||||
*/
|
||||
class ThrottledChannel
|
||||
class Throttle
|
||||
{
|
||||
private:
|
||||
/**
|
||||
|
|
@ -94,26 +94,26 @@ public:
|
|||
* @param channel
|
||||
* @param throttle
|
||||
*/
|
||||
ThrottledChannel(Channel &channel, size_t throttle);
|
||||
Throttle(Channel &channel, size_t throttle);
|
||||
|
||||
/**
|
||||
* Deleted copy constructor, deleted move constructor
|
||||
* @param other
|
||||
*/
|
||||
ThrottledChannel(const ThrottledChannel &other) = delete;
|
||||
ThrottledChannel(ThrottledChannel &&other) = delete;
|
||||
Throttle(const Throttle &other) = delete;
|
||||
Throttle(Throttle &&other) = delete;
|
||||
|
||||
/**
|
||||
* Deleted copy assignment, deleted move assignment
|
||||
* @param other
|
||||
*/
|
||||
ThrottledChannel &operator=(const ThrottledChannel &other) = delete;
|
||||
ThrottledChannel &operator=(ThrottledChannel &&other) = delete;
|
||||
Throttle &operator=(const Throttle &other) = delete;
|
||||
Throttle &operator=(Throttle &&other) = delete;
|
||||
|
||||
/**
|
||||
* Virtual destructor
|
||||
*/
|
||||
virtual ~ThrottledChannel() = default;
|
||||
virtual ~Throttle() = default;
|
||||
|
||||
/**
|
||||
* Publish a message to an exchange. See amqpcpp/channel.h for more details on the flags.
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
#include "amqpcpp/deferredget.h"
|
||||
#include "amqpcpp/channelimpl.h"
|
||||
#include "amqpcpp/channel.h"
|
||||
#include "amqpcpp/throttledchannel.h"
|
||||
#include "amqpcpp/throttle.h"
|
||||
#include "amqpcpp/login.h"
|
||||
#include "amqpcpp/address.h"
|
||||
#include "amqpcpp/connectionhandler.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* ThrottledChannel.cpp
|
||||
* Throttle.cpp
|
||||
*
|
||||
* Implementation for ThrottledChannel class.
|
||||
* Implementation for Throttle class.
|
||||
*
|
||||
* @author Michael van der Werve <michael.vanderwerve@mailerq.com>
|
||||
* @copyright 2020 Copernica BV
|
||||
|
|
@ -26,7 +26,7 @@ namespace AMQP {
|
|||
* @param channel
|
||||
* @param throttle
|
||||
*/
|
||||
ThrottledChannel::ThrottledChannel(Channel &channel, size_t throttle) : _implementation(channel._implementation), _throttle(throttle)
|
||||
Throttle::Throttle(Channel &channel, size_t throttle) : _implementation(channel._implementation), _throttle(throttle)
|
||||
{
|
||||
// activate confirm-select mode
|
||||
auto &deferred = channel.confirmSelect()
|
||||
|
|
@ -42,7 +42,7 @@ ThrottledChannel::ThrottledChannel(Channel &channel, size_t throttle) : _impleme
|
|||
* @param deliveryTag
|
||||
* @param multiple
|
||||
*/
|
||||
void ThrottledChannel::onAck(uint64_t deliveryTag, bool multiple)
|
||||
void Throttle::onAck(uint64_t deliveryTag, bool multiple)
|
||||
{
|
||||
// number of messages exposed
|
||||
if (multiple) _open.erase(_open.begin(), _open.upper_bound(deliveryTag));
|
||||
|
|
@ -83,7 +83,7 @@ void ThrottledChannel::onAck(uint64_t deliveryTag, bool multiple)
|
|||
* @param id
|
||||
* @param frame
|
||||
*/
|
||||
bool ThrottledChannel::send(uint64_t id, const Frame &frame)
|
||||
bool Throttle::send(uint64_t id, const Frame &frame)
|
||||
{
|
||||
// if there is already a queue, we always append it
|
||||
if (!_queue.empty() || (_open.size() >= _throttle && _last != id))
|
||||
|
|
@ -116,7 +116,7 @@ bool ThrottledChannel::send(uint64_t id, const Frame &frame)
|
|||
* @param size size of the message
|
||||
* @param flags optional flags
|
||||
*/
|
||||
bool ThrottledChannel::publish(const std::string &exchange, const std::string &routingKey, const Envelope &envelope, int flags)
|
||||
bool Throttle::publish(const std::string &exchange, const std::string &routingKey, const Envelope &envelope, int flags)
|
||||
{
|
||||
// @todo do not copy the entire buffer to individual frames
|
||||
|
||||
Loading…
Reference in New Issue