t.p.h.Bucket : class documentation

Part of twisted.protocols.htb View Source View In Hierarchy

Token bucket, or something like it.

I can hold up to a certain number of tokens, and I drain over time.
Class VariablesmaxburstSize of the bucket, in bytes. If None, the bucket is never full. (type: int )
rateRate the bucket drains, in bytes per second. If None, the bucket drains instantaneously. (type: int )
Method __init__ Undocumented
Method add Add tokens to me.
Method drip Let some of the bucket drain.
def __init__(self, parentBucket=None): (source)
def add(self, amount): (source)
Add tokens to me.
ParametersamountA quanity of tokens to add. (type: int )
ReturnsThe number of tokens that fit. (type: int )
def drip(self): (source)

Let some of the bucket drain.

How much of the bucket drains depends on how long it has been since I was last called.
ReturnsTrue if I am now empty. (type: bool )
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:27:37.