Base class for Squid-to-client bandwidth limiting. More...

#include <BandwidthBucket.h>

Inheritance diagram for BandwidthBucket:
Collaboration diagram for BandwidthBucket:

Public Member Functions

 BandwidthBucket (const int speed, const int initialLevelPercent, const double sizeLimit)
 
virtual ~BandwidthBucket ()
 
virtual int quota ()=0
 
virtual bool applyQuota (int &nleft, Comm::IoCallback *state)
 
virtual void scheduleWrite (Comm::IoCallback *state)=0
 Will plan another write call. More...
 
virtual void onFdClosed ()
 Performs cleanup when the related file descriptor becomes closed. More...
 
virtual void reduceBucket (const int len)
 Decreases the bucket level. 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...
 

Detailed Description

Definition at line 19 of file BandwidthBucket.h.

Constructor & Destructor Documentation

BandwidthBucket::BandwidthBucket ( const int  speed,
const int  initialLevelPercent,
const double  sizeLimit 
)

Definition at line 19 of file BandwidthBucket.cc.

References current_dtime, getCurrentTime(), and prevTime.

virtual BandwidthBucket::~BandwidthBucket ( )
inlinevirtual

Definition at line 23 of file BandwidthBucket.h.

Member Function Documentation

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

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 quota().

Referenced by ClientInfo::applyQuota().

bool BandwidthBucket::noLimit ( ) const
inline

Definition at line 41 of file BandwidthBucket.h.

References writeSpeedLimit.

Referenced by MessageBucket::quota(), reduceBucket(), and refillBucket().

virtual void BandwidthBucket::onFdClosed ( )
inlinevirtual

Reimplemented in ClientInfo.

Definition at line 37 of file BandwidthBucket.h.

References selectWaiting.

Referenced by ClientInfo::onFdClosed().

virtual int BandwidthBucket::quota ( )
pure virtual
Returns
the number of bytes this bucket allows to write, also considering aggregates, if any. Negative quota means no limitations by this bucket.

Implemented in ClientInfo, and MessageBucket.

Referenced by applyQuota().

void BandwidthBucket::reduceBucket ( const int  len)
virtual

Reimplemented in ClientInfo, and MessageBucket.

Definition at line 83 of file BandwidthBucket.cc.

References bucketLevel, DBG_IMPORTANT, debugs, len, and noLimit().

Referenced by MessageBucket::reduceBucket(), and ClientInfo::reduceBucket().

void BandwidthBucket::refillBucket ( )
protected
virtual void BandwidthBucket::scheduleWrite ( Comm::IoCallback state)
pure virtual

Implemented in ClientInfo, and MessageBucket.

BandwidthBucket * BandwidthBucket::SelectBucket ( fde f)
static

Member Data Documentation

double BandwidthBucket::bucketLevel
double BandwidthBucket::bucketSizeLimit
protected

Definition at line 54 of file BandwidthBucket.h.

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

double BandwidthBucket::prevTime
protected

Definition at line 52 of file BandwidthBucket.h.

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

double BandwidthBucket::writeSpeedLimit
protected

Definition at line 53 of file BandwidthBucket.h.

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


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors