Return the capacity for a leaky bucket with the given rate and window.

Synopsis

Declared in <balb_leakybucket.h>

static
bsls::Types::Uint64
calculateCapacity(
    bsls::Types::Uint64 drainRate,
    bsls::TimeInterval const& timeWindow);

Description

Return the capacity of a leaky bucket as the rounded‐down product of the specified drainRate by the specified timeWindow. If the result evaluates to 0, return 1. The behavior is undefined unless the product of drainRate and timeWindow can be represented by a 64‐bit unsigned integral type.

Return Value

capacity as the rounded‐down product of drainRate by timeWindow, or 1 if that product is 0

Parameters

Name

Description

drainRate

rate at which units drain from the bucket

timeWindow

interval over which the capacity is calculated

Created with MrDocs