C# Class OpenMetaverse.TokenBucket

A hierarchical token bucket for bandwidth throttling. See http://en.wikipedia.org/wiki/Token_bucket for more information
ファイルを表示 Open project: Virtual-Universe/Virtual-LibOMV Class Usage Examples

Public Methods

Method Description
RemoveTokens ( int amount ) : bool

Remove a given number of tokens from the bucket

RemoveTokens ( int amount, bool &dripSucceeded ) : bool

Remove a given number of tokens from the bucket

TokenBucket ( TokenBucket parent, int maxBurst, int dripRate ) : System

Default constructor

Private Methods

Method Description
Drip ( ) : bool

Add tokens to the bucket over time. The number of tokens added each call depends on the length of time that has passed since the last call to Drip

Method Details

RemoveTokens() public method

Remove a given number of tokens from the bucket
public RemoveTokens ( int amount ) : bool
amount int Number of tokens to remove from the bucket
return bool

RemoveTokens() public method

Remove a given number of tokens from the bucket
public RemoveTokens ( int amount, bool &dripSucceeded ) : bool
amount int Number of tokens to remove from the bucket
dripSucceeded bool True if tokens were added to the bucket /// during this call, otherwise false
return bool

TokenBucket() public method

Default constructor
public TokenBucket ( TokenBucket parent, int maxBurst, int dripRate ) : System
parent TokenBucket Parent bucket if this is a child bucket, or /// null if this is a root bucket
maxBurst int Maximum size of the bucket in bytes, or /// zero if this bucket has no maximum capacity
dripRate int Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full
return System