Limits Squid-to-client bandwidth for each matching response. More...

#include <MessageBucket.h>

Inheritance diagram for MessageBucket:
Collaboration diagram for MessageBucket:

Public Types

typedef RefCount< MessageBucketPointer

Public Member Functions

 MessageBucket (const int speed, const int initialLevelPercent, const double sizeLimit, MessageDelayPool::Pointer pool)
virtual int quota () override
virtual void scheduleWrite (Comm::IoCallback *state) override
 Will plan another write call. More...
virtual 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 BandwidthBucketSelectBucket (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

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

Member Function Documentation

◆ applyQuota()

bool BandwidthBucket::applyQuota ( int nleft,
Comm::IoCallback state 

Adjusts nleft to not exceed the current bucket quota value, if needed.

Reimplemented in ClientInfo.

Definition at line 66 of file

References Comm::IoCallback::conn, debugs, min(), and BandwidthBucket::quota().

Referenced by ClientInfo::applyQuota(), Comm::Write(), and BandwidthBucket::~BandwidthBucket().


MessageBucket::MEMPROXY_CLASS ( MessageBucket  )

◆ noLimit()

bool BandwidthBucket::noLimit ( ) const

◆ onFdClosed()

virtual void BandwidthBucket::onFdClosed ( )

Reimplemented in ClientInfo.

Definition at line 37 of file BandwidthBucket.h.

References len, BandwidthBucket::reduceBucket(), and BandwidthBucket::selectWaiting.

Referenced by ClientInfo::onFdClosed().

◆ quota()

int MessageBucket::quota ( )
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

References BandwidthBucket::bucketLevel, MessageDelayPool::level(), min(), BandwidthBucket::noLimit(), MessageDelayPool::noLimit(), MessageDelayPool::refillBucket(), BandwidthBucket::refillBucket(), and theAggregate.

Referenced by checkTimeouts().

◆ reduceBucket()

void MessageBucket::reduceBucket ( int  len)

Reimplemented from BandwidthBucket.

Definition at line 36 of file

References MessageDelayPool::bytesIn(), BandwidthBucket::reduceBucket(), and theAggregate.

◆ refillBucket()

◆ scheduleWrite()

void MessageBucket::scheduleWrite ( Comm::IoCallback state)

◆ SelectBucket()

Member Data Documentation

◆ bucketLevel

◆ bucketSizeLimit

double BandwidthBucket::bucketSizeLimit

Definition at line 54 of file BandwidthBucket.h.

Referenced by BandwidthBucket::refillBucket(), and ClientInfo::setWriteLimiter().

◆ prevTime

double BandwidthBucket::prevTime

◆ selectWaiting

◆ theAggregate

MessageDelayPool::Pointer MessageBucket::theAggregate

Definition at line 35 of file MessageBucket.h.

Referenced by quota(), and reduceBucket().

◆ writeSpeedLimit

double BandwidthBucket::writeSpeedLimit

The documentation for this class was generated from the following files:






Web Site Translations