Limits Squid-to-client bandwidth for each matching response. More...
#include <MessageBucket.h>
Public Types | |
typedef RefCount< MessageBucket > | Pointer |
Public Member Functions | |
MessageBucket (const int speed, const int initialLevelPercent, const double sizeLimit, MessageDelayPool::Pointer pool) | |
int | quota () override |
void | scheduleWrite (Comm::IoCallback *state) override |
Will plan another write call. More... | |
void | reduceBucket (int len) override |
Decreases the bucket level. More... | |
virtual bool | applyQuota (int &nleft, Comm::IoCallback *state) |
virtual void | onFdClosed () |
Performs cleanup when the related file descriptor becomes closed. More... | |
bool | noLimit () const |
Whether this bucket will not do bandwidth limiting. More... | |
Static Public Member Functions | |
static BandwidthBucket * | SelectBucket (fde *f) |
Public Attributes | |
double | bucketLevel |
how much can be written now More... | |
bool | selectWaiting |
is between commSetSelect and commHandleWrite More... | |
Protected Member Functions | |
void | refillBucket () |
Increases the bucket level with the writeSpeedLimit speed. More... | |
Protected Attributes | |
double | prevTime |
previous time when we checked More... | |
double | writeSpeedLimit |
Write speed limit in bytes per second. More... | |
double | bucketSizeLimit |
maximum bucket size More... | |
Private Member Functions | |
MEMPROXY_CLASS (MessageBucket) | |
Private Attributes | |
MessageDelayPool::Pointer | theAggregate |
Detailed Description
Definition at line 20 of file MessageBucket.h.
Member Typedef Documentation
◆ Pointer
typedef RefCount<MessageBucket> MessageBucket::Pointer |
Definition at line 25 of file MessageBucket.h.
Constructor & Destructor Documentation
◆ MessageBucket()
MessageBucket::MessageBucket | ( | const int | speed, |
const int | initialLevelPercent, | ||
const double | sizeLimit, | ||
MessageDelayPool::Pointer | pool | ||
) |
Definition at line 17 of file MessageBucket.cc.
Member Function Documentation
◆ applyQuota()
|
virtualinherited |
Adjusts nleft to not exceed the current bucket quota value, if needed.
Reimplemented in ClientInfo.
Definition at line 66 of file BandwidthBucket.cc.
References Comm::IoCallback::conn, debugs, min(), and BandwidthBucket::quota().
Referenced by ClientInfo::applyQuota().
◆ MEMPROXY_CLASS()
|
private |
◆ noLimit()
|
inlineinherited |
Definition at line 41 of file BandwidthBucket.h.
References BandwidthBucket::writeSpeedLimit.
Referenced by quota(), BandwidthBucket::reduceBucket(), and BandwidthBucket::refillBucket().
◆ onFdClosed()
|
inlinevirtualinherited |
Reimplemented in ClientInfo.
Definition at line 37 of file BandwidthBucket.h.
References BandwidthBucket::selectWaiting.
Referenced by ClientInfo::onFdClosed().
◆ quota()
|
overridevirtual |
- Returns
- the number of bytes this bucket allows to write, also considering aggregates, if any. Negative quota means no limitations by this bucket.
Implements BandwidthBucket.
Definition at line 23 of file MessageBucket.cc.
References BandwidthBucket::bucketLevel, MessageDelayPool::level(), min(), BandwidthBucket::noLimit(), MessageDelayPool::noLimit(), BandwidthBucket::refillBucket(), MessageDelayPool::refillBucket(), and theAggregate.
◆ reduceBucket()
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 36 of file MessageBucket.cc.
References MessageDelayPool::bytesIn(), BandwidthBucket::reduceBucket(), and theAggregate.
◆ refillBucket()
|
protectedinherited |
Definition at line 31 of file BandwidthBucket.cc.
References BandwidthBucket::bucketLevel, BandwidthBucket::bucketSizeLimit, current_dtime, debugs, BandwidthBucket::noLimit(), BandwidthBucket::prevTime, and BandwidthBucket::writeSpeedLimit.
Referenced by ClientInfo::quota(), and quota().
◆ scheduleWrite()
|
overridevirtual |
Implements BandwidthBucket.
Definition at line 43 of file MessageBucket.cc.
References COMM_SELECT_WRITE, Comm::IoCallback::conn, F(), Comm::Connection::fd, fd_table, Comm::HandleWrite, and Comm::SetSelect().
◆ SelectBucket()
|
staticinherited |
Definition at line 95 of file BandwidthBucket.cc.
References fde::clientInfo, RefCount< C >::getRaw(), ClientInfo::writeLimitingActive, and fde::writeQuotaHandler.
Referenced by _comm_close(), and Comm::IoCallback::selectOrQueueWrite().
Member Data Documentation
◆ bucketLevel
|
inherited |
Definition at line 48 of file BandwidthBucket.h.
Referenced by ClientInfo::kickQuotaQueue(), ClientInfo::quota(), quota(), BandwidthBucket::reduceBucket(), BandwidthBucket::refillBucket(), and ClientInfo::setWriteLimiter().
◆ bucketSizeLimit
|
protectedinherited |
Definition at line 54 of file BandwidthBucket.h.
Referenced by BandwidthBucket::refillBucket(), and ClientInfo::setWriteLimiter().
◆ prevTime
|
protectedinherited |
Definition at line 52 of file BandwidthBucket.h.
Referenced by BandwidthBucket::BandwidthBucket(), BandwidthBucket::refillBucket(), and ClientInfo::setWriteLimiter().
◆ selectWaiting
|
inherited |
Definition at line 49 of file BandwidthBucket.h.
Referenced by commHandleWriteHelper(), ClientInfo::kickQuotaQueue(), BandwidthBucket::onFdClosed(), ClientInfo::setWriteLimiter(), and ClientInfo::writeOrDequeue().
◆ theAggregate
|
private |
Definition at line 35 of file MessageBucket.h.
Referenced by quota(), and reduceBucket().
◆ writeSpeedLimit
|
protectedinherited |
Definition at line 53 of file BandwidthBucket.h.
Referenced by BandwidthBucket::noLimit(), BandwidthBucket::refillBucket(), and ClientInfo::setWriteLimiter().
The documentation for this class was generated from the following files:
- src/MessageBucket.h
- src/MessageBucket.cc