en	RatePolicy

en	An instance of [*RatePolicy] is associated with a [link beast.ref.boost__beast__basic_stream `basic_stream`], and controls the rate at which bytes may be independently sent and received. This may be used to achieve fine-grained bandwidth management and flow control.

en	Associated Types

en	* [link beast.ref.boost__beast__rate_policy_access `rate_policy_access`]

en	These requirements may undergo non-backward compatible

en	Requirements

en	In this table:

en	* `P` denotes a type that meets the requirements of [*RatePolicy]. * `x` denotes an xvalue of type `P` * `a` denotes a value of type `P`. * `n` denotes a value of type `std::size_t`

en	Valid expressions

en	Expression

en	Type

en	Semantics, Pre/Post-conditions

en	`P a(x)`

en	Requires ['MoveConstructible].

en	`friend rate_policy_access`

en	The member functions required in `P` should be private. [link beast.ref.boost__beast__rate_policy_access `rate_policy_access`] must be a friend of `P` for the implementation to gain access to the required member functions.

en	`a.available_read_bytes()`

en	`std::size_t`

en	This function is called by the implementation to determine the maximum number of allowed bytes to be transferred in the next read operation. The actual number of bytes subsequently transferred may be less than this number. If the policy returns a value of zero, the read operation will asynchronously wait until the next timer interval before retrying. When the retry occurs, this function will be called again.

en	`a.available_write_bytes()`

en	This function is called by the implementation to determine the maximum number of allowed bytes to be transferred in the next write operation. The actual number of bytes subsequently transferred may be less than this number. If the policy returns a value of zero, the read operation will asynchronously wait until the next timer interval before retrying. When the retry occurs, this function will be called again.

en	`a.transfer_read_bytes(n)`

en	The implementation calls this function to inform the policy that `n` bytes were successfully transferred in the most recent read operation. The policy object may optionally use this information to calculate throughputs and/or inform the algorithm used to determine subsequently queried transfer maximums.

en	`a.transfer_write_bytes(n)`

en	The implementation calls this function to inform the policy that `n` bytes were successfully transferred in the most recent write operation. The policy object may optionally use this information to calculate throughputs and/or inform the algorithm used to determine subsequently queried transfer limits.

en	`a.on_timer()`

en	The implementation calls this function every time the internal timer expires. The policy object may optionally use this opportunity to calculate elapsed time and throughput, and/or inform the algorithm used to determine subsequently queried transfer limits.

en	Exemplar

en	Models

en	* [link beast.ref.boost__beast__simple_rate_policy `simple_rate_policy`] * [link beast.ref.boost__beast__unlimited_rate_policy `unlimited_rate_policy`]