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)
 
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 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 MessageBucket.cc.

Member Function Documentation

◆ applyQuota()

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

◆ MEMPROXY_CLASS()

MessageBucket::MEMPROXY_CLASS ( MessageBucket  )
private

◆ noLimit()

bool BandwidthBucket::noLimit ( ) const
inlineinherited

◆ onFdClosed()

virtual void BandwidthBucket::onFdClosed ( )
inlinevirtualinherited

Reimplemented in ClientInfo.

Definition at line 37 of file BandwidthBucket.h.

References BandwidthBucket::selectWaiting.

Referenced by ClientInfo::onFdClosed().

◆ quota()

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

◆ reduceBucket()

void MessageBucket::reduceBucket ( int  len)
overridevirtual

Reimplemented from BandwidthBucket.

Definition at line 36 of file MessageBucket.cc.

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

◆ refillBucket()

void BandwidthBucket::refillBucket ( )
protectedinherited

◆ scheduleWrite()

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

◆ SelectBucket()

BandwidthBucket * BandwidthBucket::SelectBucket ( fde f)
staticinherited

Member Data Documentation

◆ bucketLevel

◆ bucketSizeLimit

double BandwidthBucket::bucketSizeLimit
protectedinherited

Definition at line 54 of file BandwidthBucket.h.

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

◆ prevTime

double BandwidthBucket::prevTime
protectedinherited

◆ selectWaiting

bool BandwidthBucket::selectWaiting
inherited

◆ theAggregate

MessageDelayPool::Pointer MessageBucket::theAggregate
private

Definition at line 35 of file MessageBucket.h.

Referenced by quota(), and reduceBucket().

◆ writeSpeedLimit

double BandwidthBucket::writeSpeedLimit
protectedinherited

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors