`twisted.protocols.htb.Bucket`

class documentation`twisted.protocols.htb`

View Source
(View In Hierarchy)
Implementation of a Token bucket.

A bucket can hold a certain number of tokens and it drains over time.

Class Variable | maxburst | The maximum number of tokens that the bucket can hold at any given time. If
this is `None` ,
the bucket has an infinite size. (type: `int` ) |

Class Variable | rate | The rate at which the bucket drains, in number of tokens per second. If the
rate is `None` ,
the bucket drains instantaneously. (type: `int` ) |

Method | __init__ | Create a `Bucket` that may
have a parent `Bucket` . |

Method | add | Adds tokens to the `Bucket` and its
`parentBucket` . |

Method | drip | Let some of the bucket drain. |

maxburst =

The maximum number of tokens that the bucket can hold at any given time. If
this is

`None`

,
the bucket has an infinite size. (type: `int`

)
rate =

The rate at which the bucket drains, in number of tokens per second. If the
rate is

`None`

,
the bucket drains instantaneously. (type: `int`

)