Skip to main content

quota_refill

Function quota_refill 

Source
pub fn quota_refill(
    available: u64,
    debt: u64,
    fraction: u64,
    elapsed: u64,
    rate: u64,
    burst: u64,
) -> (u64, u64, u64)
Expand description

Credit elapsed nanoseconds at a micro-token rate, retaining the fractional micro-token numerator.

Repay debt before filling the bucket, and discard the fraction when the bucket reaches its burst. The caller claims the whole elapsed interval together with the returned state.