Namespace Sportradar.LiveData.Sdk.Services.RateLimiter
Classes
- RateGate
 Used to control the rate of some occurrence per unit of time. Adapted from http://www.pennedobjects.com/2010/10/better-rate-limiting-with-dot-net/
- TokenBucket<T>
 A generic implementation of a token-bucket (used for traffic shaping purposes).
Simple analogy: there is bucket with a certain amount of tokens. If there are enough tokens inside, an element of type T can be forwarded. Every second another n tokens are added to the bucket and thus making it possible to forward more. The bucket can hold a maximum amount of tokens, no more than that can be added. If the bucket is relatively big, bursts are allowed.
The preferred way of using this class is constructing a token-bucket that corresponds to the desired link speed, calling Dispatch() for each PDU and setting the forward_callback so something will happen with the PDU at the correct interval.
If a simulation of a link speed is undesirable, you might also use the FillBucketByHand() method when a PDU was actually sent.
Dispatch(e) -> TOKENBUCKET -> forward_callback(e)
Delegates
- TokenBucket<T>.ForwardDelegate
 The delegate that is called as an output from the token-bucket.
- TokenBucket<T>.ObjToSizeDelegate
 The delegate that converts an object to the amount of bytes.