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

Definition at line 25 of file MessageBucket.h.

Constructor & Destructor Documentation

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

bool BandwidthBucket::applyQuota ( int nleft,
Comm::IoCallback state 
)
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().

MessageBucket::MEMPROXY_CLASS ( MessageBucket  )
private
bool BandwidthBucket::noLimit ( ) const
inlineinherited
virtual void BandwidthBucket::onFdClosed ( )
inlinevirtualinherited

Reimplemented in ClientInfo.

Definition at line 37 of file BandwidthBucket.h.

References BandwidthBucket::selectWaiting.

Referenced by ClientInfo::onFdClosed().

int MessageBucket::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(), MessageDelayPool::refillBucket(), BandwidthBucket::refillBucket(), and theAggregate.

Referenced by checkTimeouts().

void MessageBucket::reduceBucket ( int  len)
overridevirtual

Reimplemented from BandwidthBucket.

Definition at line 36 of file MessageBucket.cc.

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

void BandwidthBucket::refillBucket ( )
protectedinherited
void MessageBucket::scheduleWrite ( Comm::IoCallback state)
overridevirtual
BandwidthBucket * BandwidthBucket::SelectBucket ( fde f)
staticinherited

Member Data Documentation

double BandwidthBucket::bucketSizeLimit
protectedinherited

Definition at line 54 of file BandwidthBucket.h.

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

double BandwidthBucket::prevTime
protectedinherited
bool BandwidthBucket::selectWaiting
inherited
MessageDelayPool::Pointer MessageBucket::theAggregate
private

Definition at line 35 of file MessageBucket.h.

Referenced by quota(), and reduceBucket().

double BandwidthBucket::writeSpeedLimit
protectedinherited

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors