File: RatePolicy.qbk

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (124 lines) | stat: -rw-r--r-- 3,985 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
[/
    Copyright (c) 2019 Vinnie Falco (vinnie dot falco at gmail dot com)

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    Official repository: https://github.com/boostorg/beast
]

[section:RatePolicy RatePolicy]

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.

[heading Associated Types]

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

[warning
    These requirements may undergo non-backward compatible
    changes in subsequent versions.
]

[heading Requirements]

In this table:

* `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`

[table Valid expressions
[[Expression] [Type] [Semantics, Pre/Post-conditions]]
[
    [`P a(x)`]
    []
    [
        Requires ['MoveConstructible].
    ]
][
    [`friend rate_policy_access`]
    []
    [
        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.
    ]
][
    [`a.available_read_bytes()`]
    [`std::size_t`]
    [
        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.
    ]
][
    [`a.available_write_bytes()`]
    [`std::size_t`]
    [
        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.
    ]
][
    [`a.transfer_read_bytes(n)`]
    []
    [
        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.
    ]
][
    [`a.transfer_write_bytes(n)`]
    []
    [
        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.
    ]
][
    [`a.on_timer()`]
    []
    [
        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.
    ]
]]

[heading Exemplar]

[concept_RatePolicy]

[heading Models]

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

[endsect]