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 Variable maxburst Size of the bucket, in bytes. If None, the bucket is never full. (type: int)
Class Variable rate Rate 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.
maxburst =
Size of the bucket, in bytes. If None, the bucket is never full. (type: int)
rate =
Rate the bucket drains, in bytes per second. If None, the bucket drains instantaneously. (type: int)
def __init__(self, parentBucket=None): (source)
Undocumented
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 the bucket is empty after this drip. (type: bool)
API Documentation for Twisted, generated by pydoctor at 2012-06-04 17:20:01.