[#BloombergLP-balb-LeakyBucket-calculateCapacity]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balb.adoc[balb]::xref:BloombergLP/balb/LeakyBucket.adoc[LeakyBucket]::calculateCapacity
:relfileprefix: ../../../
:mrdocs:

Return the capacity for a leaky bucket with the given rate and window&period;

== Synopsis

Declared in `&lt;balb&lowbar;leakybucket&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64]
calculateCapacity(
    xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64] drainRate,
    xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] const& timeWindow);
----

== Description

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

== Return Value

capacity as the rounded&hyphen;down product of `drainRate` by `timeWindow`, or 1 if that product is 0

== Parameters

[cols="1,4"]
|===
| Name| Description
| *drainRate*
| rate at which units drain from the bucket
| *timeWindow*
| interval over which the capacity is calculated
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
