Package twisted :: Package protocols :: Module htb :: Class Bucket
[frames | no frames]

Class Bucket


Token bucket, or something like it.

I can hold up to a certain number of tokens, and I drain over time.
Method Summary
  __init__(self, parentBucket)
int add(self, amount)
Add tokens to me.
bool drip(self)
Let some of the bucket drain.

Class Variable Summary
int _refcount = 0                                                                     
int maxburst: Size of the bucket, in bytes.
int rate: Rate the bucket drains, in bytes per second.

Method Details

add(self, amount)

Add tokens to me.
Parameters:
amount - A quanity of tokens to add.
           (type=int)
Returns:
The number of tokens that fit.
           (type=int)

drip(self)

Let some of the bucket drain.

How much of the bucket drains depends on how long it has been since I was last called.
Returns:
True if I am now empty.
           (type=bool)

Class Variable Details

_refcount

Type:
int
Value:
0                                                                     

maxburst

Size of the bucket, in bytes. If None, the bucket is never full.
Type:
int
Value:
None                                                                  

rate

Rate the bucket drains, in bytes per second. If None, the bucket drains instantaneously.
Type:
int
Value:
None                                                                  

Generated by Epydoc 2.0 on Sat May 15 20:07:42 2004 http://epydoc.sf.net